App-Wizard
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]
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
I changed "glEnable(GL_TRIANGLES);"
to "glBegin(GL_TRIANGLES);"
But that still doesn't help me...
Need help... This is really aggravating.
~Thanks
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.
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. :)
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 texturingglDisable(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 problemglDisable(GL_CULL_FACE);// your original drawing codeglBegin(GL_TRIANGLES);glVertex3f( 0.0f, 1.0f, 0.0f); // TopglVertex3f(-1.0f,-1.0f, 0.0f); // Bottom LeftglVertex3f( 1.0f,-1.0f, 0.0f); // Bottom RightglEnd();// re-enable texturing and cullingglEnable(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. :)
--
Cheers,
Darren Clark
Cheers,
Darren Clark
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement