Results 1 to 2 of 2

Thread: Drawing on a 2D texture

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    1

    Drawing on a 2D texture

    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

  2. #2
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: Drawing on a 2D texture

    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.

Similar Threads

  1. Drawing texture tiles it 3x3
    By petemyster in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-15-2012, 10:23 AM
  2. Drawing lines on top of a texture
    By Legento in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 01-11-2012, 04:46 PM
  3. Drawing to a texture
    By Ubereil in forum OpenGL: GLSL
    Replies: 2
    Last Post: 12-19-2009, 01:49 AM
  4. drawing into 2D texture
    By oren miron in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 01-07-2009, 01:02 AM
  5. I have a problem with drawing RGB 2d texture.
    By Bystrov Sergey in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-12-2007, 03:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean