Athos
08-28-2008, 01:59 AM
Hi,
I am trying to create a kind of "radar" application (black screen, red static points and text, and a green rotating line, with its fixed point in the center of the screen).
The problem is that points are not static. They rotate, together with the line.
This is the code I am using:
GLvoid Render(System::Void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPointSize(5.0f);
glBegin(GL_POINTS);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(-350.0f, 0.0f);
glEnd();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0, wid, 0, hei);
glScalef(1, -1, 1);
glTranslatef(0, -hei, 0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glColor3f(1.0f, 0.0f, 0.0f);
char* c = "point";
glRasterPos2f(15.0f, 235.0f);
for (; *c != '\0'; c++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, *c);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
//glPushMatrix();
glRotatef(-1.0f, 0.0f, 0.0f, 1.0f);
glLineWidth(3.0f);
glBegin(GL_LINES);
glColor3f(0.0f, 0.5f, 0.0f);
glVertex2f(0.0f, 0.0f);
glVertex2f(500.0f, 0.0f);
glEnd();
//glPopMatrix();
SwapBuffers(m_hDC);
}
I am trying to create a kind of "radar" application (black screen, red static points and text, and a green rotating line, with its fixed point in the center of the screen).
The problem is that points are not static. They rotate, together with the line.
This is the code I am using:
GLvoid Render(System::Void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPointSize(5.0f);
glBegin(GL_POINTS);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(-350.0f, 0.0f);
glEnd();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0, wid, 0, hei);
glScalef(1, -1, 1);
glTranslatef(0, -hei, 0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glColor3f(1.0f, 0.0f, 0.0f);
char* c = "point";
glRasterPos2f(15.0f, 235.0f);
for (; *c != '\0'; c++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, *c);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
//glPushMatrix();
glRotatef(-1.0f, 0.0f, 0.0f, 1.0f);
glLineWidth(3.0f);
glBegin(GL_LINES);
glColor3f(0.0f, 0.5f, 0.0f);
glVertex2f(0.0f, 0.0f);
glVertex2f(500.0f, 0.0f);
glEnd();
//glPopMatrix();
SwapBuffers(m_hDC);
}