Browse Source

Merge pull request #7 from GWRon/fix_immediate_render_config

Fix: Handle SetViewport() and Cls()'s immediate mode by flushing batches before
Brucey 9 years ago
parent
commit
1808d1c86c
1 changed files with 8 additions and 0 deletions
  1. 8 0
      gl2sdlmax2d.mod/gl2sdlmax2d.bmx

+ 8 - 0
gl2sdlmax2d.mod/gl2sdlmax2d.bmx

@@ -683,6 +683,9 @@ Type TGL2Max2DDriver Extends TMax2DDriver
 	Const PRIMITIVE_TRIANGLE_STRIP:Int = 6
 	Const PRIMITIVE_TEXTURED_TRIANGLE:Int = 7
 
+	Const PRIMITIVE_CLS:Int = 8
+	Const PRIMITIVE_VIEWPORT:Int = 9
+
 	' variables for tracking
 
 	Field vert_index:Int
@@ -895,6 +898,8 @@ Type TGL2Max2DDriver Extends TMax2DDriver
 	End Method
 	
 	Method SetViewport( x, y, w, h )
+		'render what has been batched till now
+		FlushTest( PRIMITIVE_VIEWPORT )
 
 		If x = 0 And y = 0 And w = GraphicsWidth() And h = GraphicsHeight()
 			glDisable( GL_SCISSOR_TEST )
@@ -915,6 +920,9 @@ Type TGL2Max2DDriver Extends TMax2DDriver
 	End Method
 
 	Method Cls()
+		'render what has been batched till now - maybe this happens
+		'with an restricted viewport
+		FlushTest( PRIMITIVE_CLS )
 
 		glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT )