Simple OpenGL operation not working?

BlitzMax Forums/OpenGL Module/Simple OpenGL operation not working?

Kryzon(Posted 2011) [#1]
Hello,
can someone tell me why the following doesn't work?

Graphics 800,600

myImage:TImage = LoadImage("image.png")

While Not KeyHit(KEY_ESCAPE) Or AppTerminate()

	DrawImage myImage,0,0
	glClear GL_COLOR_BUFFER_BIT
	
	Flip
Wend 

End


The screen is supposed to be completely black because of the glClear, but the image is still showing. It's like glClear is doing nothing.

Not only for this glClear, but I can't set any other state like glBlendFunc etc.
When I call Max2D's SetBlend() method it works properly, even though the same calls are going under the hood.
If I copy and paste SetBlend's code into an external function and call that, no changes are made - it's like I can't call OpenGL raw functions with my own code, even though I use modules that call these functions and don't suffer from the same problems (like Max2D or MiniB3D).


Regular K(Posted 2011) [#2]
Defaults to DirectX9 graphics driver.

SetGraphicsDriver GLMax2DDriver()

to the top will fix that.

You can use:
print GetGraphicsDriver().tostring()

to find out the current drivers name.


Kryzon(Posted 2011) [#3]
I'm sure I'll never forget this one.
Thanks for the answer!

Last edited 2011