I wand to set the MaxGui Canvas in the mode of GLMax2D so I can use OpenGL commands to draw.
MaxGui Canvas and GLMax2D
BlitzMax Forums/BlitzMax Beginners Area/MaxGui Canvas and GLMax2D Well i think you just set the graphics driver before you create the canvas (what i did below). Below i mixed your gltexturedtriangle thingy:
SuperStrict Global textureGL : Int Global imagen : TImage Local filter:String="Image Files:png,jpg,bmp;Text Files:txt;All Files:*" Local FileName:String =RequestFile( "Select graphic file to open",filter$ ) If FileName = Null Then End SetGraphicsDriver GLMax2DDriver() Global myWindow:TGadget = CreateWindow("Full screen", 0, 0, ClientWidth(Desktop()), ClientHeight(Desktop()), Null) MaximizeWindow(myWindow) Global myCanvas:TGadget = CreateCanvas(0, 0, ClientWidth(myWindow), ClientHeight(myWindow), myWindow) SetGadgetLayout(myCanvas, 1, 1, 1, 1) ' Canvas 'rules' SetGraphics(CanvasGraphics(myCanvas)) SetMaskColor 255, 0, 255 imagen = LoadImage(FileName) textureGL% = GLTexFromPixmap%(LoadPixmap:TPixmap(FileName)) Global myButton:TGadget = CreateButton("Exit", (ClientWidth(myCanvas) / 2) - (75), (ClientHeight(myCanvas) / 2) - 20, 150, 40, myCanvas) Global myTimer:TTimer = CreateTimer(60) While True WaitEvent() Local event:TEvent = CurrentEvent Select event.id Case EVENT_WINDOWCLOSE End Case EVENT_GADGETACTION If event.source = myButton Then End Case EVENT_TIMERTICK RedrawGadget(myCanvas) Case EVENT_GADGETPAINT If event.source = myCanvas Then Update(myCanvas) Render(myCanvas) EndIf End Select Wend Function Render(_canvas:TGadget) SetGraphics(CanvasGraphics(_canvas)) Cls SetColor 0, 255, 0 DrawRect 0, 0, GraphicsWidth(), 5 DrawRect 0, 0, 5, GraphicsHeight() DrawRect 0, GraphicsHeight() - 5, GraphicsWidth(), 5 DrawRect GraphicsWidth() - 5, 0, 5, GraphicsHeight() SetColor 255, 0, 0 DrawRect(GraphicsWidth() - 105, GraphicsHeight() - 105, 100, 100) SetColor 0, 0, 255 DrawRect(5, 5, 100, 100) SetColor 255, 255, 255 DrawRect(GraphicsWidth() - 5 - 100, 5, 100, 100) DrawRect(5, GraphicsHeight() - 5 - 100, 100, 100) If (TextureGL%) glBindTexture(GL_TEXTURE_2D,TextureGL%) glEnable(GL_TEXTURE_2D) EndIf glBegin GL_TRIANGLES glTexCoord2f 0.0 , 0.0 glVertex2f 0.0 , 0.0 glTexCoord2f 1.0 , 0.0 glVertex2f GraphicsWidth() , 0.0 glTexCoord2f 1.0 , 1.0 glVertex2f GraphicsWidth() , GraphicsHeight() glEnd Flip End Function Function Update(_canvas:TGadget) SetGraphics(CanvasGraphics(_canvas)) End Function
Thanks.