Reputation: 383
I'd like to know how to set fog color using pyglet.gl.
I couldn't find information about fog color in the documentation, but I found this useful. However, the code I wrote
pyglet.gl.glFogfv(gl.GL_FOG_COLOR, (0.5, 0.7, 1.0, 1.0))
produces the error: ctypes.ArgumentError: argument 2: <class 'TypeError'>: expected LP_c_float instance instead of tuple
I'm not sure how to give it a LP_c_float from my color tuple, as it is not found in pyglet.gl or in the above documentation.
Upvotes: 1
Views: 487
Reputation: 210909
The 2nd paramter of pyglet.gl.glFogfv
is an array of 4 floats, sp you have to create an ctypes array by (GLfloat * 4)
, see pyglet.gl.glFogfv:
pyglet.gl.glFogfv(gl.GL_FOG_COLOR, (GLfloat * 4)(0.5, 0.7, 1.0, 1.0))
See ctypes — A foreign function library for Python - Arrays:
Arrays are sequences, containing a fixed number of instances of the same type.
The recommended way to create array types is by multiplying a data type with a positive integer:
TenPointsArrayType = POINT * 10
Upvotes: 2