Errors with GLGraphicsDriver
BlitzMax Forums/BlitzMax Programming/Errors with GLGraphicsDriver
| ||
What is wrong with this code? I get Unhandled Memory Exception Error SetGraphicsDriver GLGraphicsDriver() Local g:TGraphics=CreateGraphics(1024,768,32,60,GRAPHICS_BACKBUFFER|GRAPHICS_ALPHABUFFER) SetGraphics(g) 'Graphics(1024,768,32) Local img:TImage=LoadImage("images/move.png") time=MilliSecs() For i=1 To 100000 DrawImage(img, 0,0) Next time=MilliSecs()-time Flip() Delay(1000) Print(time) |
| ||
Is that image where it's supposed to be? Check it actually loads by seeing if img is Null after loading. |
| ||
Actually, the GLMax2DDriver works just fine. |
| ||
Just curious, where do you find the flags like "GRAPHICS_BACKBUFFER"? EDIT: Opps, sometimes you ask a stupid question and find the answer a few moments later. |
| ||
>>>Is that image where it's supposed to be? Check it actually loads by seeing if img is Null after loading. I added this line after LoadImage: If img=Null Then End when i start my program with debug - i get this error: Unhandles Exception: Attempt to access field or method of Null object. AND DrawImage is selected in editor!!! If i disable first 3 lines and anable Graphics (=DirectX) - this program run without errors... |
| ||
Actually, the GLMax2DDriver works just fine. No it doesn't. It doesn't work at all on some Intel GMA chipsets, where other GL stuff runs perfectly. |
| ||
The GLMax2D Driver actually even works on Intel GMA as Max2D is written in a way that allows it to run on MS OGL 1.1 Emulation! The problem here is that GLGraphicsDriver is used, not GLMax2D, this means that you can not use any Max2D commands at all. That simple it is. You can only use pure opengl |
| ||
Dream's right. You need to specify the correct Max2D driver. The way the drivers works inside BlitzMax is a bit confusing (try writing a new one and you'll see what I mean!). By default each driver you Import sets itself as the graphics driver. If you need one different to the last one that was set, you set the driver you need. If you intend using Max2D commands, always set the Max2D driver you need (be it GL or D3D). |
| ||
The GLMax2D Driver actually even works on Intel GMA I have one. I guarantee it does not work. The problem here is that GLGraphicsDriver is used, not GLMax2D, this means that you can not use any Max2D commands at all. That simple it is. Well, that's no good. You can only use pure opengl |
| ||
>>>If you intend using Max2D commands, always set the Max2D driver you need And how can i do this? I think SetGraphicsDriver GLGraphicsDriver() was right? |
| ||
There is apparently a difference between "GLGraphicsDriver()" and "GLMax2DDriver()". So Use: SetGraphicsDriver( GLMax2DDriver() ); As far as my tests have shown (which are not very thourough), this allows the use of both raw OpenGL commands as well as using Max2D commands. |
| ||
a thanks - this works |
| ||
You can use raw OpenGL commands with the GLMax2DDriver, BUT don't mess with the stack or it will bomb out. |