I’m having a bit of trouble getting my head around the coordinate system in opengl. I’m trying to render an object at the mouse position.
in my objects class I have a posX and posY variables
and here is my draw routine incase I’m doing something wrong here:
glPushMatrix();
glColor3f(1.0,1.0,1.0);
glTranslatef(posX,posY,0.0f);
glBegin(GL_POLYGON);
glVertex3f(0.0,0.0,0.0);
glVertex3f(0.025,0.0,0.0);
glVertex3f(0.025,0.1,0.0);
glVertex3f(0.0,0.1,0.0);
glEnd();
glPopMatrix();
So in my main class I have a passivemotion callback function and I simply do myObject->posY = y; Now I know thats wrong but I’m not sure how I should convert it into screenCoords;
Note that Im rendering the scene with an orthographic projection.