resizing window

Moderator
Posts: 916
Joined: 2002.10
Post: #1
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?
Quote this message in a reply
furballphat
Unregistered
 
Post: #2
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.
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #3
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.

hth,
Codemattic
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #4
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.
Quote this message in a reply
Hog
Member
Posts: 151
Joined: 2002.09
Post: #5
maybe you still need to call glViewport() after resizing the window
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Resizing Window and View Nick 6 3,482 Jun 7, 2005 01:43 PM
Last Post: Malarkey