Browse Source

NG overload support.

woollybah 9 years ago
parent
commit
0838b44da9
2 changed files with 72 additions and 71 deletions
  1. 68 68
      mojo2.mod/examples/drawprimitives/drawprimitives.bmx
  2. 4 3
      mojo2.mod/graphics.bmx

+ 68 - 68
mojo2.mod/examples/drawprimitives/drawprimitives.bmx

@@ -1,68 +1,68 @@
-SuperStrict
-
-Framework mky.mojo2
-?Not opengles
-Import brl.GLGraphics
-?opengles
-Import sdl.sdlgraphics
-?
-Import brl.pngloader
-Import brl.random
-
-Graphics 800, 600, 0
-
-Local canvas:TCanvas = New TCanvas.CreateCanvas()
-
-Local vertices:Float[] = New Float[4*2*100]
-	
-Local indices:Int[]
-
-Local sz:Float=20.0
-Local p:Int=0
-
-For Local i:Int=0 Until 100
-
-	Local x:Float=Rnd(GraphicsWidth())-sz/2-GraphicsWidth()/2
-	Local y:Float=Rnd(GraphicsHeight())-sz/2-GraphicsHeight()/2
-	
-	vertices[p+0]=x
-	vertices[p+1]=y
-	
-	vertices[p+2]=x+sz
-	vertices[p+3]=y
-	
-	vertices[p+4]=x+sz
-	vertices[p+5]=y+sz
-	
-	vertices[p+6]=x
-	vertices[p+7]=y+sz
-	
-	p:+8
-Next
-
-'quick test of indices...
-indices = New Int[400]
-For Local i:Int=0 Until 400
-	indices[i]=i
-Next
-
-
-While Not KeyDown(key_escape)
-
-	canvas.Clear 0,0,1
-		
-	canvas.SetColor Sin( MilliSecs()*.01 )*.5+.5,Cos( MilliSecs()*.03 )*.5+.5,Sin( MilliSecs()*.05 )*.5+.5
-	
-	canvas.PushMatrix
-	canvas.Translate MouseX(),MouseY()
-	
-	canvas.DrawIndexedPrimitives 4,100,vertices,indices	'should draw same thing...
-	
-	canvas.PopMatrix
-
-	canvas.Flush
-
-	Flip
-
-Wend
-
+SuperStrict
+
+Framework mky.mojo2
+?Not opengles
+Import brl.GLGraphics
+?opengles
+Import sdl.sdlgraphics
+?
+Import brl.pngloader
+Import brl.random
+
+Graphics 800, 600, 0
+
+Local canvas:TCanvas = New TCanvas.CreateCanvas()
+
+Local vertices:Float[] = New Float[4*2*100]
+	
+Local indices:Int[]
+
+Local sz:Float=20.0
+Local p:Int=0
+
+For Local i:Int=0 Until 100
+
+	Local x:Float=Rnd(GraphicsWidth())-sz/2-GraphicsWidth()/2
+	Local y:Float=Rnd(GraphicsHeight())-sz/2-GraphicsHeight()/2
+	
+	vertices[p+0]=x
+	vertices[p+1]=y
+	
+	vertices[p+2]=x+sz
+	vertices[p+3]=y
+	
+	vertices[p+4]=x+sz
+	vertices[p+5]=y+sz
+	
+	vertices[p+6]=x
+	vertices[p+7]=y+sz
+	
+	p:+8
+Next
+
+'quick test of indices...
+indices = New Int[400]
+For Local i:Int=0 Until 400
+	indices[i]=i
+Next
+
+
+While Not KeyDown(key_escape)
+
+	canvas.Clear 0,0,1
+		
+	canvas.SetColor Float(Sin( MilliSecs()*.01 )*.5+.5),Float(Cos( MilliSecs()*.03 )*.5+.5),Float(Sin( MilliSecs()*.05 )*.5+.5)
+	
+	canvas.PushMatrix
+	canvas.Translate MouseX(),MouseY()
+	
+	canvas.DrawIndexedPrimitives 4,100,vertices,indices	'should draw same thing...
+	
+	canvas.PopMatrix
+
+	canvas.Flush
+
+	Flip
+
+Wend
+

+ 4 - 3
mojo2.mod/graphics.bmx

@@ -159,7 +159,8 @@ Function InitVbos()
 			idxs.PokeShort i*12+k+10,i*4+j+3
 		Next
 	Next
-	glBufferData GL_ELEMENT_ARRAY_BUFFER,idxs.Size(),idxs._buf,GL_STATIC_DRAW
+	Local size:Int = idxs.Size()
+	glBufferData GL_ELEMENT_ARRAY_BUFFER,Varptr size,idxs._buf,GL_STATIC_DRAW
 	'idxs.Discard
 End Function
 
@@ -1792,7 +1793,7 @@ Type TDrawList
 	bbdoc: Rotates the current 2d matrix.
 	end rem
 	Method Rotate( rz:Float )
-		Transform Cos( rz ),-Sin( rz ),Sin( rz ),Cos( rz ),0,0
+		Transform Float(Cos( rz )),Float(-Sin( rz )),Float(Sin( rz )),Float(Cos( rz )),0,0
 	End Method
 	
 	Rem
@@ -3119,7 +3120,7 @@ Type TCanvas Extends TDrawList
 		EndIf
 		
 		If _dirty & DIRTY_COLORMASK
-			glColorMask _colorMask[0],_colorMask[1],_colorMask[2],_colorMask[3]
+			glColorMask Byte(_colorMask[0]),Byte(_colorMask[1]),Byte(_colorMask[2]),Byte(_colorMask[3])
 		End If
 		
 		_dirty=0