Jump to content
  • Advertisement
Sign in to follow this  

Beginning problem with vc++ and opengl

This topic is 4410 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

Hey guys, ive got vc++ 6.0 and im using their opengl libraries...i created a new win32 app (as per Genesis I : Windows Game Programming guide) but im having trouble drawing anything to the screen...the window shows up fine and all the menu funtionality works ( set up pixel format, proper window styles for opengl, the rendering context ect), but all my gl function calls dont show up in the window..someone take a look please, thanks! I haave the main loop going infinitly, and as long as there is no message in the queue, I draw a scene, something like this (in main):
while (!done) {
   if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
      if (msg.message == WM_QUIT) {
         done = TRUE;
      } else {
   } else {
      //printf("Hello, World!");

and DrawScene is like:
glClearColor(0.0, 0.0, 1.0, 0.0);
	glColor3f(1.0, 1.0, 1.0);
	glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); 

	glVertex2f(-0.5, -0.5);
	glVertex2f(-0.5, 0.5);
	glVertex2f(0.5, 0.5);
	glVertex2f(0.5, -0.5);


why isn't anything showing up? [Edited by - dj_unforgetable on November 18, 2006 10:59:53 PM]

Share this post

Link to post
Share on other sites
But you said in your first post you draw the scene over and over again as long as there are no other messages in the loop. That means you're drawing it several times, not just once.

But then again, swapping buffers have nothing to do whether you're only drawing a single image or not. It has to do whether your application is double buffered, and to what buffer you draw.

Concider this. You have a front and a back buffer. The front buffer is what's shown on the screen and the back buffer is where you draw. As long as you're not swapping the buffers, what you draw will always be in the back buffer. Swap the buffers and the back buffer is now the front buffer.

So if you requested a double buffered pixel format, you must swap buffers no matter how many, or few, images you draw.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!