glutWarpPointer() does nothing in my program

162 Views Asked by At

I have been trying to create a simple voxel game with Glut, and everything is working great except for 'glutWarpPointer()' that does nothing at all, the cursor is not altered in any way and I have no idea why. I've tried with WSL on windows 11 (freeglut vers. 2.8.1-6), macos big sur (freeglut vers. 3.4.0) and catalina and it does not work anywhere.

#define GL_SILENCE_DEPRECATION
#include <GL/freeglut.h>

int     width = 0, height = 0;

void    display()
{
    glutSwapBuffers();
    glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
    glFlush();
}

void    idle()
{
    glutWarpPointer(width / 2, height / 2);
    glutPostRedisplay();
}

int     main(int argc, char** argv)
{
    glutInit(&argc, argv);
    width = glutGet(GLUT_SCREEN_WIDTH);
    height = glutGet(GLUT_SCREEN_HEIGHT);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
    glutInitWindowSize(width, height);
    glutCreateWindow("42");
    glutFullScreen();
    glutDisplayFunc(display);
    glutIdleFunc(idle);
    glutMainLoop();
}

It does work with WSL on windows 10 (freeglut vers. 2.8.1-3) with Xming in full screen mode, but i would like to be able to use it everywhere

0

There are 0 best solutions below