How can I?

BlitzMax Modules Forums/MiniB3D/How can I?

Thx all of you.
Now I have another problem.
The code works well when I use it with graphics3d 800,600 bla bla bla.
But when I try to put the minib3d in a canvas this thing doesn't work anymore.
SuperStrict

Framework Sidesign.minib3d
Import BRL.MaxGUI
Import BRL.win32maxgui
Import BRL.EventQueue
Import BRL.retro
Import brl.max2d
Import BRL.GLMax2D
Import brl.graphics
Import brl.timer

Include "GUI_init.bmx"
Include "Global_init.bmx"


Global obj:TObject = New TObject
obj.name = "box1"
obj.entity = CreateCube()

cam:Tcamera = CreateCamera()
PositionEntity cam, 0,0,-6
Local Light:TLight = CreateLight()

CreateTimer( 60 )
While True
	WaitEvent 
	Print CurrentEvent.ToString()
	Select EventID()
	
		Case EVENT_WINDOWCLOSE
			End
		Case EVENT_TIMERTICK
		
			RedrawGadget Maincanvas
			
			TurnEntity obj.entity,1,1,1

			
		Case EVENT_GADGETPAINT
			
			
			CameraClsMode cam,True,True

			Wireframe(False)
	
			EntityColor obj.entity , 0 , 255 , 0
	
			RenderWorld()

	
			'Second Pass
			CameraClsMode cam , False , False
	
			EntityColor obj.entity , 255 , 0 , 0
	
			Wireframe(True)
	
			RenderWorld()
			
			Flip


	End Select
Wend

and here is some other code that might be needed to understand the first one:
Global MainCanvas:Tgadget = CreateCanvas(0,0,GadgetWidth(Main_Window)-200,GadgetHeight(Main_Window),Main_Window,0)


SetGraphicsDriver GLGraphicsDriver(),GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER
TGlobal.width=ClientWidth(MainCanvas)
TGlobal.height=ClientHeight(MainCanvas)

TGlobal.depth=16
TGlobal.mode=0
TGlobal.rate=60

SetGraphics CanvasGraphics(MainCanvas)

TGlobal.GraphicsInit()
Global cam:TCamera=CreateCamera()

Global ObjectList:TList = New TList

Type TObject
	Field name:String
	Field entity:Tentity
End Type

Type TObject_texture
	Field name:String
	Field brush:TBrush
End Type 

Function Points_Mode(enable:Byte)
		If enable = 1
			glEnable GL_POINT_SMOOTH
			glPointSize(8)
			glPolygonMode(GL_FRONT,GL_POINT)
		Else
			glDisable GL_POINT_SMOOTH
			glPolygonMode(GL_FRONT,GL_FILL)
		EndIf
End Function