wxGLCanvas doesnt like resizing

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

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




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


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.

Ahh.. I assumed it did that stuff automatically, thanks.