Base code
I want to use the NeHe Dialog base code but when i try to put this simple code in....
glTranslatef (0.0f, 0.0f, -10.0f);
glBegin (GL_TRIANGLES);
glColor3f (1.f, 0.f, 0.f); glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f (0.f, 1.f, 0.f); glVertex3f(-1.0f,-1.0f, 1.0f);
glColor3f (0.f, 0.f, 1.f); glVertex3f( 1.0f,-1.0f, 1.0f);
glEnd ();
it doesnt work, any help?
July 29, 2003 01:14 AM
Clarify.
I probably couldnt help you much as i am a newb and havent worked with opengl for a while, but im pretty sure more information is needed then a blurt out of a simple glBegin/glEnd tidbit. Where did you put this code? Can you get the regular base code to compile?? Unless ofcoure it is a syntax error? What error is the compiler giving you? Help us help you!
I probably couldnt help you much as i am a newb and havent worked with opengl for a while, but im pretty sure more information is needed then a blurt out of a simple glBegin/glEnd tidbit. Where did you put this code? Can you get the regular base code to compile?? Unless ofcoure it is a syntax error? What error is the compiler giving you? Help us help you!
I put it in the draw function provided, and yes i am able to get the basecode to run error free with out any modifications, with the addition of this code there were no errors
void Draw (void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity ();
glTranslatef (0.0f, 0.0f, -10.0f);
glBegin (GL_TRIANGLES);
glColor3f (1.f, 0.f, 0.f); glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f (0.f, 1.f, 0.f); glVertex3f(-1.0f,-1.0f, 1.0f);
glColor3f (0.f, 0.f, 1.f); glVertex3f( 1.0f,-1.0f, 1.0f);
glEnd ();
glFlush ();
}
[edited by - henszey on July 29, 2003 2:39:30 AM]
void Draw (void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity ();
glTranslatef (0.0f, 0.0f, -10.0f);
glBegin (GL_TRIANGLES);
glColor3f (1.f, 0.f, 0.f); glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f (0.f, 1.f, 0.f); glVertex3f(-1.0f,-1.0f, 1.0f);
glColor3f (0.f, 0.f, 1.f); glVertex3f( 1.0f,-1.0f, 1.0f);
glEnd ();
glFlush ();
}
[edited by - henszey on July 29, 2003 2:39:30 AM]
Well I use
The CreateGLWindow function has this code in it
which calls the DrawGLScene function to draw the shapes etc on screen.
In your code it's calling a function which doesn't exist, and your 'void Draw' function isn't called by any other part of the program.
Of course this is assuming you're using basecode from the nehe tuts I used...try pasting the whole thing if this doesn't work.
[edited by - Squalion on July 29, 2003 12:42:58 PM]
int DrawGLScene(GLvoid){// triangles herereturn TRUE;}
The CreateGLWindow function has this code in it
else // Not Time To Quit, Update Screen { DrawGLScene(); // Draw The Scene SwapBuffers(hDC); // Swap Buffers (Double Buffering)
which calls the DrawGLScene function to draw the shapes etc on screen.
In your code it's calling a function which doesn't exist, and your 'void Draw' function isn't called by any other part of the program.
Of course this is assuming you're using basecode from the nehe tuts I used...try pasting the whole thing if this doesn't work.
[edited by - Squalion on July 29, 2003 12:42:58 PM]
lol
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement