Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   Opengl problem (http://www.programmingforums.org/showthread.php?t=11722)

mark Oct 27th, 2006 11:39 PM

Opengl problem
 
1 Attachment(s)
Hello i'm trying to get an example in my book working. It is supposed to allow you to move the camera around in a 3d scene. It compiles fine but when i try to run it the window is destorted and i cant figure out why.

there are four files Point3, Vector3, camera.h, and test.cpp

I included them in a zip file and it is attached

Klarre Oct 28th, 2006 6:43 AM

The first error is in the function call to glClear at Ln. 70 in test.cpp.
Bad
:

glClear(GL_COLOR_BUFFER_BIT||GL_DEPTH_BUFFER_BIT);
Correct
:

glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

The second error is in the Camera::setShape function, where the identity matrix should be loaded before you set the matrix mode.
Bad
:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

Correct
:

glLoadIdentity();
glMatrixMode(GL_PROJECTION);


Have a nice day!

/Klarre

mark Oct 28th, 2006 11:31 AM

thank you so much that worked


All times are GMT -5. The time now is 1:11 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC