System halt in RenderWorld()

BlitzMax Modules Forums/MiniB3D/System halt in RenderWorld()

Hello, I'm stuck with my project and I realy need your help.
I short while ago I tried (with success and a little help from this forum) to make a 2D interface with 3D elements in it. This was for a full screen touch-screen application. The results were impressive and everybody here is enthusiastic about the interaction design. So now we want to prototype this same interface in a windows environment. I use klepto's version of the miniB3D module for the 3D stuff and MaxGUI for the windows gadgets. And now something strange happens.

Please have a look at the following (stripped) code:
Type TPrinterDriver

	Field poWindow:TGadget
	Field poCanvas:TGadget
		
	Function Create:TPrinterDriver()
		Local p:TPrinterDriver = New TPrinterDriver
		Local dw% = GadgetWidth(Desktop())
		Local dh% = GadgetHeight(Desktop())
		Local dww% = 800
		Local dwh% = 600
		
		p.poWindow = CreateWindow("Print", (dw - dww) / 2, (dh - dwh) / 2, dww, dwh, Null, WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS | WINDOW_HIDDEN) 
		p.poCanvas:TGadget = CreateCanvas(0, 0, dww, dwh, p.poWindow) 
		Return p
	End Function
	


	Method update(event:TEvent)
		Select event.ID
			Case EVENT_TIMERTICK
				poPreview.update()
				RedrawGadget poCanvas
			Case EVENT_WINDOWCLOSE
				If event.Source = poWindow Then 
					HideGadget(poWindow)
				End If
			Case EVENT_GADGETPAINT
				If event.Source = poCanvas Then draw()
		 	Case EVENT_GADGETLOSTFOCUS

			Case EVENT_GADGETACTION

		End Select
	End Method
	
	
	Method draw()
		CanvasGraphics3D(poCanvas) 

		'put 2D in between BeginMax2D and EndMax2D
		TGlobal.BeginMax2D

			SetClsColor 255, 255, 255
			Cls
			SetColor 0, 0, 0
			DrawText("Hello World", 100, 100)

		TGlobal.EndMax2D

		'everything 3D goes here
		'do some 3D stuff and...
		RenderWorld() 
		
		Flip
	End Method
	
End Type


In the main loop I take care of the system events:
CreateTimer(60) 

EnablePolledInput()

AddHook EmitEventHook, updateWindows

gApplicationWindow.open()

While WaitEvent() 
Wend

End

Function updateWindows:Object( id:Int, data:Object, context:Object)
	Local ev:TEvent = TEvent(data)
	If Not ev Then Return data
	gApplicationWindow.update(ev)
	If gPrinterDriver.IsOpen() Then gPrinterDriver.update(ev) 
	Return data
End Function


When the program runs ands wants to Render the 3D part of the interface, the programs halts on the following comand in RenderWorld3D() method in TGlobal.bmx
glActiveTexture(GL_TEXTURE0)


I have no idea what is going on and where to look for an error. I hope the problem is clear. Hopefully one of you genius can help me.

Ok. Seems that
SetGraphicsDriver(GLMax2DDriver())
did the trick.
Learning on the job.

Anyone interested in giving me a one or two day's course in BlitzMAX Graphics programming?