I don't know much about OpenGL but I would think that you would not want or need to change the actual size of the window for this, but rather just change how the view is displayed in the GL canvas.
However if you really do want the client window to resize, and if you are using sizers, then as you've seen the sizer does not take the physical size of the window into account when doing the layout and it will just resize it back to the size it was before when Layout is called. You should change the MinSize instead. If you want the frame to change size too then you'll need to do a Fit or something at that level as well.
···
On 12/20/11 12:36 AM, Neacsa Bogdan Valentin wrote:
Hello,
So I'm in the following situation. I need to create a screen that
containing a big glcanvas and a big table next to it. Both these require
a lot of text, so as a solution I'm trying to start with a small
glcanvas and then use the EVT_ENTER_WINDOW, EVT_LEAVE_WINDOW to 'zoom'
on the glcanvas when needed. The actions binded to the events are:def _on_mouse_enter(self, event):
old_size = self.GetClientSize()
self.SetClientSize((old_size[0] * 2, old_size[1] * 2))
ratio = float(self.width) / self.height
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glViewport(0, 0, self.width, self.height)
gluPerspective(45, ratio, 1, 1000)
self.on_draw()
self.parent.Layout()def _on_mouse_leave(self, event):
old_size = self.GetClientSize()
self.SetClientSize((old_size[0] / 2, old_size[1] / 2))
ratio = float(self.width) / self.height
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glViewport(0, 0, self.width, self.height)
gluPerspective(45, ratio, 1, 1000)
self.on_draw()
self.parent.Layout()Now these seem to have some of the desired effect, however the
_on_mouse_leave still considers the original canvas size. So, say my
canvas is 400/200 size, on mouse enter makes it 800/400 but when mouse
leaves the original 400/200 sized area the canvas is shrunk back to it's
original form. I also tried with GetSize/SetSize instead of
GetClientSize/SetClientSize with the same result. What am I doing wrong
here?
--
Robin Dunn
Software Craftsman