Sign in to follow this  
Mod-Man

App-Wizard

Recommended Posts

Mod-Man    122
Ok this is gonna be really stupid... I used the NeHe Visual C++ 6 App-Wizard to make a new demo... not the MFC one. I'm trying to add code to void Draw(void) in the Example.cpp file. Problem is that it's not drawing anything but the 2d-text that is auto generated... I'm just drawing triangles for now... I'll get into the harder stuff later. Any suggestions? ~Thanks [\code] void Draw (void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glColor3f(1.0f,1.0f,1.0f); fNeHe.SetBase(32); // Adjust Base Start Pos (First Set of Fonts) fNeHe.Print(20,30,"Test for OpenGL scene:"); // Print GL Text To The Screen glColor3f(1.0f,1.0f,1.0f); fNeHe.SetBase(32 - 128); // Adjust Base Start Pos (Second Set of Fonts) fNeHe.Print(20,50,"Built with NeHe basecode"); // Print GL Text To The Screen glLoadIdentity(); glEnable(GL_TRIANGLES); glVertex3f( 0.0f, 1.0f, 0.0f); // Top glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glEnd(); glFlush (); // Flush The GL Rendering Pipeline } [\code]

Share this post


Link to post
Share on other sites
Mod-Man    122
Ok I'm an idiot:

I changed "glEnable(GL_TRIANGLES);"

to "glBegin(GL_TRIANGLES);"

But that still doesn't help me...

Need help... This is really aggravating.

~Thanks

Share this post


Link to post
Share on other sites
eSCHEn    394
Generally this kind of problem is linked to either having a texture bound which is interfering as no texture co-ordinates are being specified, the wrong colour is being used or finally that culling is the issue.

To try and figure out if any of these are the problem then add the following lines to your code and remember that OpenGL is a state based machine, i.e. anything that you set will stay that way until you change it again.

// you have already bound a texture for the font call before this I presume, so let's eliminate that first by disabling texturing
glDisable(GL_TEXTURE_2D);

// your call to your font sets the colour to white so that bit is fine
// let's disable culling for now to make sure that's not the problem
glDisable(GL_CULL_FACE);

// your original drawing code
glBegin(GL_TRIANGLES);
glVertex3f( 0.0f, 1.0f, 0.0f); // Top
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
glEnd();

// re-enable texturing and culling
glEnable(GL_TEXTURE_2D);
glEnable(GL_CULL_FACE);


Now if none of this works then it could be that you're drawing the triangle behind the camera so it can't be seen, if so then either translate into or out of the screen using glTranslate or simply specify a positive or negative value for the z component of your triangle's vertices.

Best of luck. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this