Archived

This topic is now archived and is closed to further replies.

There's a triangle but i dont see it

This topic is 5589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My main loop envolves the following code: while (1) { if(PeekMessage(&msg,sysw_hwnd, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) SYS_Quit(); else { TranslateMessage(&msg); DispatchMessage(&msg); } } // call application main loop function SYS_Frame(); } // the following is from Ch2 in OpenGL game programming. // SYS_Frame(): static float angle; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); angle = angle + 0.1f; if(angle >= 360.0f) angle = 0.0f; glTranslatef(0.0f, 0.0f, -5.0f); glRotatef(angle, 0.0f, 0.0f, 1.0f); glColor3f(1.0f, 1.0f, 0.0f); glBegin(GL_TRIANGLES); glVertex3f(0.0f, 0.0f, 0.0f); glVertex3f(1.0f, 0.0f, 0.0f); glVertex3f(1.0f, 1.0f, 0.0f); glVertex3f(1.0f, 1.0f, 0.0f); glVertex3f(1.0f, 0.0f, -1.0f); glVertex3f(1.0f, -1.0f, 0.0f); glEnd(); SwapBuffers(sysw_hDC); i know the prog goes into this loop cos i placed messages here and there, and the screen is set to black (glClear func), but no triangles. Any ideas? When you have the power and resources to create on a large scale, by all means, create something meaningful.

Share this post


Link to post
Share on other sites
Are you handling the sizing of the window? Also that code looks exactly like the code from OpenGL Game Programming, so take a look at it again thats a part your missing (its the part in the WM_SIZE handdler)

Share this post


Link to post
Share on other sites

No sizing is taken care of, and that would not matter(??) unless i resized the window and its on fullscreen all the time.

I implimented all of the example from OpenGL Game Programming.

When you have the power and resources to create on a large scale, by all means, create something meaningful.

Share this post


Link to post
Share on other sites