max2d on MaxGui canvas - resize trouble

BlitzMax Modules Forums/MiniB3D/max2d on MaxGui canvas - resize trouble

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Function BeginMax2D()

Local x,y,w,h
		GetViewport(x,y,w,h)
		
		glDisable(GL_LIGHTING)
		glDisable(GL_DEPTH_TEST)
		glDisable(GL_SCISSOR_TEST)
		glDisable(GL_FOG)
		glDisable(GL_CULL_FACE)

		glMatrixMode GL_TEXTURE
		glLoadIdentity
		
		glMatrixMode GL_PROJECTION
		glLoadIdentity
		glOrtho 0,GraphicsWidth(),GraphicsHeight(),0,-1,1
		
		glMatrixMode GL_MODELVIEW
		glLoadIdentity
		
		SetViewport x,y,w,h
		
		
		Local MaxTex:Int 
		glGetIntegerv(GL_MAX_TEXTURE_UNITS, Varptr(MaxTex))

		
		For Local Layer = 0 Until MaxTex
			glActiveTexture(GL_TEXTURE0+Layer)
					
			glDisable(GL_TEXTURE_CUBE_MAP)
			glDisable(GL_TEXTURE_GEN_S)
			glDisable(GL_TEXTURE_GEN_T)
			glDisable(GL_TEXTURE_GEN_R)
	
			glDisable(GL_TEXTURE_2D)
		Next
		
		glActiveTexture(GL_TEXTURE0)
		
		'DrawRect - 10 , - 10 , 5 , 5
		
		glViewport(0,0,TGlobal.Width,TGlobal.Height)
		glScissor(0,0,TGlobal.Width,TGlobal.Height)
		

End Function

Function EndMax2D()

		glDisable(GL_TEXTURE_CUBE_MAP)
		glDisable(GL_TEXTURE_GEN_S)
		glDisable(GL_TEXTURE_GEN_T)
		glDisable(GL_TEXTURE_GEN_R)
	
		glDisable(GL_TEXTURE_2D)

		TGlobal.EnableStates()

End Function


Replace these Functions with the original ones or just insert them in your App to override the original ones. This should work.