Hey.. I'm encountering a strange problem intermixing OpenGL into PySFML code..
I'm using two methods..
The first: directly accessing GL using ctypes
The second: accessing GL through PyOpenGL (which directly accesses GL using ctypes)
Other than the method for importing the GL lib, the code is the same.. but the first method fails...
First:
from ctypes import CDLL
from ctypes.util import find_library, sys
if sys.platform == 'win32': GL = CDLL( find_library( 'opengl32' ) )
else: GL = CDLL( find_library( 'GL' ) )
from PySFML import sf
window = sf.RenderWindow( sf.VideoMode( 800, 600 ), 'title' )
GL.glClearColor( 255, 0, 0, 255 )
while True:
GL.glClear( 0x00004000 ) # mask == GL_COLOR_CLEAR_VALUE
window.Display()
Second:
from OpenGL import GL
from PySFML import sf
window = sf.RenderWindow( sf.VideoMode( 800, 600 ), 'title' )
GL.glClearColor( 255, 0, 0, 255 )
while True:
GL.glClear( 0x00004000 ) # mask == GL_COLOR_CLEAR_VALUE
window.Display()
Basically, the first results in a constant BLACK window while the second results in a constant RED window, as expected.
The glClear() call in the first example obviously 'works' because the window is getting cleared, but it's not the correct color.
PyOpenGL at
http://pyopengl.sourceforge.net/Again, PyOpenGL accesses OpenGL via ctypes as I'm trying to do on a lower level, so this must be possible, *somehow*.
My ideas are that glClearColor() might be failing to set the color for some reason, or PyOpenGL is doing some essential initializations that I'm missing..
I'll be looking through PyOpenGL source until I figure this out.
Any ideas?