Clipping Canvas

BlitzMax Forums/BlitzMax Programming/Clipping Canvas

TeraBit(Posted 2005) [#1]
I'm having a problem with my Canvases. When it resizes to a larger size than the original canvas that was created, it clips the OpenGL to the size of the originally created canvas. What am I doing wrong?

Resize code:
	If Vrs.E = EVENT_WINDOWSIZE and EventSource() = Wn Then
		gfx_width = ClientWidth(Can)
		gfx_height = ClientHeight(Can)
		SetGraphics CanvasGraphics(Can)
		SetViewport 0,0,gfx_width,gfx_height
		glMatrixMode GL_PROJECTION
		glLoadIdentity
		gluPerspective 20,Float(gfx_WIDTH)/Float(GFX_HEIGHT),0.01,50
		glGetDoublev GL_PROJECTION_MATRIX,Stat.pjMatrix
		SetViewport 0,0,gfx_width,gfx_height
	End If


Note that the perspective view sizes correctly, but is clipped as if the viewport is getting clipped. [edit] Changed it to SetViewport.


FlameDuck(Posted 2005) [#2]
Try using SetViewport instead of glViewport. Works here.


TeraBit(Posted 2005) [#3]
Hi SetViewPort seems to have no effect either. I've gone through the source to make sure that the Viewport is not being set elsewhere, but this is the only place.

Not sure what's going on..again.

Actually it seems to happen when the canvas gets quite big and sometimes will work ok if you 'very' gradually drag the window out to the right size.

Any further ideas?


TeraBit(Posted 2005) [#4]
Anyone else getting the 'Canvas clipped' appearance when you resize?


TeraBit(Posted 2005) [#5]
It's ok. I've figured it out. It appears that you need to reset the ViewPort each time you change the projection Matrix (Which in this case I am swapping between perspective and Orthographic projections quite rapidly).