wxGLCanvas doesnt like resizing

BlitzMax Forums/Brucey's Modules/wxGLCanvas doesnt like resizing

plash(Posted 2008) [#1]
It looks fine until I maximize the window, then this happens:


Any idea why?

I tried connecting wxEVT_SIZE in my frame to a function just for testing, nothing inside the frame got sized with it.

ConnectAny(wxEVT_SIZE, OnSize)
...
Function OnSize(event:wxEvent)
	wxMessageBox("Frame has been resized.")
End Function





plash(Posted 2008) [#2]
This doesn't work either (in the canvas type)
ConnectAny(wxEVT_SIZE, OnSize)

Function OnSize(event:wxEvent)
	  Local fcnv:FryCanvas = FryCanvas(event.Parent)
		fcnv.Refresh()
		fcnv.Update()
		
End Function



Retimer(Posted 2008) [#3]
If you are using max2d, after resizing the viewport (once you get that working, if it isn't already), use the setviewport command and resize the viewport to prevent weird rendering problems.

Here's what i'm using:

Type LayerCanvas Extends wxGLCanvas
	Field Timer:wxTimer
	Method OnInit() 
		ConnectAny(wxEVT_TIMER, OnTick) 
		connectany(wxEVT_SIZE, OnSize) 
		timer = wxTimer.CreateTimer(Self) 
		timer.Start(333) 
		
	End Method
	
	Function OnSize(Event:wxEvent) 
		Local w:Int, H:Int
		LayerCanvas(event.parent).GetSize(w, h) 
		LayerCanvasWidth = w
		LayerCanvasHeight = h
		LayerCanvas(event.parent).Refresh() 
	End Function
	
	Method OnPaint(event:wxPaintEvent) 
		SetGraphics (CanvasGraphics2D(Self)) 
		SetViewport(0, 0, LayerCanvasWidth, LayerCanvasHeight) 
		Cls
			RenderLayerWindow() 
		Flip
	End Method
	
	Function OnTick(Event:wxEvent) 
		LayerCanvas(event.parent).Refresh() 
	End Function
End Type


No problems at all.


plash(Posted 2008) [#4]
Ahh.. I assumed it did that stuff automatically, thanks.