Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

BSXrider

NeHe Basecode 2

This topic is 6072 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
maybe disable the textures after the font is drawn then re-enable texture right before fonts

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
So that''s normaly behaviour then that lines and triangles don''t show up if texture_2d is enabled? Fair enough I guess.

- seb

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!