Rakefet
11-04-2011, 10:22 AM
All,
I draw an overlay of a triangle shape over an image. The triangle tip points to a known location (x,y,z) on the image. I want the triangle to stay the same size even if I zoom in.
Here is my code:
glDisable(GL_DEPTH_TEST);
glPushMatrix()
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glTranslatef(x, y, z);
glBegin(GL_TRIANGLES);
glColor4f(1,0,0,0.75);
glVertex3f(0,0,0);
glVertex3f(0,0-0.5f,0);
glVertex3f(0+0.5f,0,0);
glEnd();
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glPopMatrix();
When I zoom in, the triangle is still points to the same point of the image but its size get bigger.
Also, is there any redundancy in the call to those functions?
Thank you for your help.
I draw an overlay of a triangle shape over an image. The triangle tip points to a known location (x,y,z) on the image. I want the triangle to stay the same size even if I zoom in.
Here is my code:
glDisable(GL_DEPTH_TEST);
glPushMatrix()
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glTranslatef(x, y, z);
glBegin(GL_TRIANGLES);
glColor4f(1,0,0,0.75);
glVertex3f(0,0,0);
glVertex3f(0,0-0.5f,0);
glVertex3f(0+0.5f,0,0);
glEnd();
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glPopMatrix();
When I zoom in, the triangle is still points to the same point of the image but its size get bigger.
Also, is there any redundancy in the call to those functions?
Thank you for your help.