Original Post
So I've got my nice little 2D game, and I'd like to ask what's the best method for handling resolutions?
Setting glViewPort to my new width and height scales the graphics well enough, but the window size doesn't change, but if I create a new window (and reload the textures) while setting my view port, the graphics don't scale, just remain in the same position with the same size. And if I create a new window without setting the view port the graphics just shift positions (and they do scale) but it doesn't seem like it's working right.
Also, would I ever need to manually scale up the graphics? Because I'm using box2d for the physics and it'd be annoying to have to destroy all box2d objects and create new, scaled versions. Just playing with the view port scales up and down the graphics without any collision problems, just need to get the window to change without any problems as well.
My resolution changing class.
Now question 2: Optimization
The game runs quite fine at 60 fps normally, but I decided to do some stress tests and tossed about 400 box2d objects with textures, PNG, with alpha and resized falling around, and ones that exit the screen are destroyed and new ones are created (Could have probably done some object pooling I think)
Now capping the FPS at 200, it runs at 60 fps on my above average computer, and about 30 on below average computers. Now I imagined openGL could render far more than 400 moving textures, especially since it can do all that 3D magic, so I'm guessing I'm doing something wrong?
Are there any optimization tips with openGL or "gotchas" ? For example when I first implemented openGL I was creating and destroying textures every time I drew, so that was incredibly laggy. Now I create the texture once, then bind and draw every frame.
Any tips on either of these questions would be appreciated, thanks!
Setting glViewPort to my new width and height scales the graphics well enough, but the window size doesn't change, but if I create a new window (and reload the textures) while setting my view port, the graphics don't scale, just remain in the same position with the same size. And if I create a new window without setting the view port the graphics just shift positions (and they do scale) but it doesn't seem like it's working right.
Also, would I ever need to manually scale up the graphics? Because I'm using box2d for the physics and it'd be annoying to have to destroy all box2d objects and create new, scaled versions. Just playing with the view port scales up and down the graphics without any collision problems, just need to get the window to change without any problems as well.
My resolution changing class.
Now question 2: Optimization
The game runs quite fine at 60 fps normally, but I decided to do some stress tests and tossed about 400 box2d objects with textures, PNG, with alpha and resized falling around, and ones that exit the screen are destroyed and new ones are created (Could have probably done some object pooling I think)
Now capping the FPS at 200, it runs at 60 fps on my above average computer, and about 30 on below average computers. Now I imagined openGL could render far more than 400 moving textures, especially since it can do all that 3D magic, so I'm guessing I'm doing something wrong?
Are there any optimization tips with openGL or "gotchas" ? For example when I first implemented openGL I was creating and destroying textures every time I drew, so that was incredibly laggy. Now I create the texture once, then bind and draw every frame.
Any tips on either of these questions would be appreciated, thanks!