Jump to content
  • Advertisement
Sign in to follow this  
Joey_V

OpenGL Opengl with glut. Saving previous screen, and resizing correctly

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

Hi. Please help. I have been trying this for days, and I can't figure it out. I am creating a basic 2D application. The User can click on the screen and a box is displayed at the location of the mouse click. Problem 1: I can get the box to appear, but it is not saved. When I click again, the previous box disappears. I want whatever was on the screen before I clicked again, to be saved, and for the next box to be added to whatever was saved. But this is not happening. Problem 2: My resize does not work. Whenever I resize the screen, the whole display is messed up. Any help is greatly appreciated :) [Edited by - Joey_V on November 27, 2005 1:56:58 PM]

Share this post


Link to post
Share on other sites
Advertisement
Well, you should be storing the squares you want to draw in a list, and draw them inside the display() function. You could just use a vector<pair<int, int> > to store the list of the positions of the squares (you might consider a struct for the square that includes its size instead of the pair).

Every time you detect a mouse click, you add a square to the list.

Hope that helps,
YUY0x7

Share this post


Link to post
Share on other sites
Thanks gfaraj

I think I may have to do like you said, store all the values of every item on the screen, but I was hoping there was an easier way

Does anyone know if there a way to automatically store the contents of an opengl screen in a buffer of some sort, then just add something to it, update the screen and display it in its updated state?

Also, any help with my resize function, this is really troubling me


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Don't use double buffering?

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!