PDA

View Full Version : Drawing on a 2D texture



aureline
10-03-2009, 05:19 AM
Hello everybody,

I have a 2D texture created from a bmp. It is displayed very well.
Now I would like to draw a point on it. Trouble begins here..

My initial code :
glViewport(190,360,798,340);
glMatrixMode(GL_PROJECTION);
glLoadIdentity () ;
gluOrtho2D(190, 988, 360, 700) ;
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
glEnable(GL_TEXTURE_2D) ;

glBindTexture( GL_TEXTURE_2D, textureBmp->id );
glBegin( GL_QUADS );
glTexCoord2i( 0, 0 ); glVertex2i( textureBmp->x, textureBmp->y);
glTexCoord2i( 1, 0 ); glVertex2i( textureBmp->x + textureBmp->width, textureBmp->y);
glTexCoord2i( 1, 1 ); glVertex2i( textureBmp->x + textureBmp->width, textureBmp->y - textureBmp->height);
glTexCoord2i( 0, 1 ); glVertex2i( textureBmp->x, textureBmp->y - textureBmp->height);
glEnd();
glDisable(GL_TEXTURE_2D) ;


When I try adding a glBegin (GL_POINTS); glVertex2i(...,...) ; glEnd() ; nothing happens.

So I tried replacing gluOrtho by glOrtho, and use glVertex3i instead of glVertex2i, and draw a point nearer than the texture, but still the point is no displayed.
I think I misunderstand how it works here, could you please give me some ideas where to look at ?

Thank you

dletozeun
10-03-2009, 06:50 AM
Disable 2D*texturing when drawing the point, and set the color your want. You may also have to disable depth testing if it is not required.