resizing window - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: resizing window (/thread-7511.html)
resizing window - skyhawk - Nov 1, 2002 03:27 PM
I don't know how to work IB all that well
I have a window. in that window I have a opengl view that takes up the whole window, I want it so it resizes that opengl window to be the size of the window when the window is resized. It also be nice to have the proportions stay the same when I am resizing the window..
can anybody help?
resizing window - furballphat - Nov 1, 2002 04:09 PM
Changing the view size is easy enough. In IB select the view and go into size, then turn all the inside lines to springs by clicking on them. Try dumping a ColorWell down and exploring the springs.
Actually changing the OpenGL code is something I'm not to sure about. I'd assume you'd put in a viewDidEndLiveResize method in the view a code which sets up all the OpenGL window size stuff again.
resizing window - codemattic - Nov 1, 2002 04:23 PM
click on your NSOpenGLView. Open the Info Panel (shift-command-I). Choose 'Size' from the pop-up menu (command-3). In the autosizing box make sure there are springs in the inside of the box - and straight lines on the outside of the box. What that means is that the size of the box is allowed to grow and shrink - while the distance from the edges of the box to the edges of your window should remain constant.
Test the interface (command-R). Resize the window - and watch as your view is risized along with it. However - with an NSOpenGLView as you resize in IB the view will fill with garbage - this is ok - dont panic - in your app you will have a drawRect: method that refreshes the view correctly. To leave the test interface hit command-Q - it will not quit IB, it will just quit the test.
The view will reshape with the window - it will not stay in the same proportions. However you can draw in your view in the same proportions by always setting the glViewport in some constant proportion in your resize method. Also you could try using NSWindow's setAspectRatio: method to keep the window itself in a certain constant proportion - if that is an acceptable solution.
resizing window - skyhawk - Nov 2, 2002 12:35 AM
Alright, I have tried this and it is weird, the window resizes... but I lose part of my screen... as if the openglview is .... but isn't keeping everything on screen... it pushes some things off the upper and right corners. when you resize up and down, the whole view moves up. when you resize left to right, it just cuts off the right side.
resizing window - Hog - Nov 2, 2002 03:09 AM
maybe you still need to call glViewport() after resizing the window