Jump to content
  • Advertisement

Archived

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

noxa

OpenGL Weird OpenGL problems with switching screen

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

I''ve been working on my OpenGL code and gotten quite far, but I''ve run into a problem. It''s not really that serious, I can still work with it, but it would not be right in a final version... My problem: In fullscreen mode, all is good: things align correctly, and it looks good. But once I switch to windowed mode, everything is offset! I think my problem is the glViewport command - I don''t think I''m using it right... Can anyone help me with it? Thanks... Just a simple definition :-) ~noxa~

Share this post


Link to post
Share on other sites
Advertisement
Check your resize command, the problem could be there. Make sure you''ll calling resize after you switch to windowed mode, etc. Cheers!

Share this post


Link to post
Share on other sites
By what do you mean? (My coding machine is on my floor, I''m about to head out to a LAN party with it so I can''t get to my code :-) What command would I have to redo? I thought that too, but I checked it and it seemed ok, heres an example of my program:

-Starts
-Inits GL
-Goes into windowed mode
-Draws a triangle until key hit
-Key hit: Switches to fullscreen
-Draws a triangle until key hit (but this time offset to the lower-left)
-Key hit: Switches to windowed
-Draws a triangle in the correct position

... Go figure, just my luck :-)

Share this post


Link to post
Share on other sites
Make sure you reset glViewport when you change from windowed to full screen...

glViewport(0, 0, (int)Width, (int)Height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.15f, 1.15f, -1.0f, 1.0f, 1.5f, 2048.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

Share this post


Link to post
Share on other sites

  • 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!