🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

When adding in polygons and what not how is it supposed to be placed?

Started by
1 comment, last by ajm113 17 years, 2 months ago
OK, I fallowed most of the tutorials and info on the forum/Nehe's website and I mite have misted something, but when I add the first tutorial on your first polygon I get errors on the first line of the polygon code I added on the bottom. Is there a certain way it show be placed. Not like Python programming if you place a if statement in the wrong column you get errors. Code: int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glLoadIdentity(); // Reset The View glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0 glBegin(GL_TRIANGLES); // Drawing Using 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(); glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units glBegin(GL_QUADS); // Draw A Quad glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left glEnd(); // Done Drawing The Quad return TRUE; // Keep Going } if (keys[VK_F1]) // Is F1 Being Pressed? { keys[VK_F1]=FALSE; // If So Make Key FALSE KillGLWindow(); // Kill Our Current Window fullscreen=!fullscreen; // Toggle Fullscreen / Windowed Mode // Recreate Our OpenGL Window ( Modified ) if (!CreateGLWindow("My First Render!",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } } Errors: C:\Dev-Cpp\3d.cpp In function `int DrawGLScene()': 406 C:\Dev-Cpp\3d.cpp redefinition of `int DrawGLScene()' 51 C:\Dev-Cpp\3d.cpp `int DrawGLScene()' previously defined here 51 C:\Dev-Cpp\3d.cpp At global scope: 425 C:\Dev-Cpp\3d.cpp expected unqualified-id before "if" 425 C:\Dev-Cpp\3d.cpp expected `,' or `;' before "if" C:\Dev-Cpp\Makefile.win [Build Error] [3d.o] Error 1 I am using Dev C++ I hate asking questions but I don't want to go out and blow money on a book that mite have codes that don't work as well for more then 20 bucks.
Check out my open source code projects/libraries! My Homepage You may learn something.
Advertisement
Seems like you defined DrawGLScene twice, the code itself looks fine, just look for a definition of DrawGLScene in line 51, as your compiler error states it, and then delete the whole method there, then you'll get only the triangle and quad on the screen.

You just can have one definition per method!
Oh! Man do I feel stupid... Sorry I did not notice that part, thanks a lot any ways! :)
Check out my open source code projects/libraries! My Homepage You may learn something.

This topic is closed to new replies.

Advertisement