NeHe Basecode 2

Started by
3 comments, last by BSXrider 22 years, 2 months ago
I''m just converting my current project over to NeHe basecode 2. In his provided GL initialisation setup he calls glEnable(GL_TEXTURE_2D); If I comment this out then obviously the fonts don''t work, but if I leave it uncommented none of my code (glVertex3f stuff) draws to the screen. what gives eh? - seb
Advertisement
maybe disable the textures after the font is drawn then re-enable texture right before fonts
Heya,
Try doing something like this:

void Draw (void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Clear Screen And Depth Buffer
glLoadIdentity();
// Reset The View
glDisable(GL_TEXTURE_2D);
// Position View Up Vector
gluLookAt(0, 0, -6, 0, 0, 0, 0, 1, 0);

// This creates a 3D pyramid in the center at (0, 0, 0)
CreatePyramid(0, 0, 0, 1, 1);

glEnable(GL_TEXTURE_2D);
CreateText();

glFlush (); // Flush The GL Rendering Pipeline
}

Kind Regards,
John Zantey
Kind Regards,John Zantey
So that''s normaly behaviour then that lines and triangles don''t show up if texture_2d is enabled? Fair enough I guess.

- seb
The reason you need glDisable(GL_TEXTURE_2D) in the basecode II if you''re doing some simple graphics (like the starting NeHe examples, for instance) is otherwise it''ll try and texture map the primitives you draw. Because the last thing it drew was the fonts, the last texture position it''s got is the corner of one of the characters in the font bitmap, which of course has an alpha of zero. Therefore all the things you draw are textured transparent.

cheers,

Tim

This topic is closed to new replies.

Advertisement