Statements: OpenGL statement for the “with” keyword
Save and restore the matrix
with gx_matrix:
glTranslatef(55, 34, 0)
# draw stuff
# here, the matrix will be restored as previous state
Modify a display list (compiled OpenGL operations)
dl = GlDisplayList()
with dl:
# draw stuff
# here you can call the display list
dl.draw()
Bind a texture and draw with OpenGL
with DO(gx_texture(my_texture), gx_begin(GL_TRIANGLE_FAN)):
# call multiple time glVertex2f()
Save and restore the color after drawing
set_color(1, 0, 0) # color is red.
with gx_color(0, 1, 0):
# here the color is green
# draw stuff
pass
# here the color is restored back to red
A way to do multiple action in with statement
with DO(stmt1, stmt2):
print 'something'
Abstraction to opengl display-list usage. Here is an example of usage
dl = GlDisplayList()
with dl:
# do draw function, like drawLabel etc...
dl.draw()
| Parameters : |
|
|---|
Clear compiled flag
Call the list only if it’s compiled
Return compiled flag
Start recording GL operation
Stop recording GL operation
Abstraction to use blending ! Don’t use directly this class. We’ve got an alias you can use
with gx_blending:
# do draw function
Statement of glPushMatrix/glPopMatrix, designed to be use with “with” keyword.
Alias: gx_matrix, gx_matrix_identity
with gx_matrix:
# do draw function
with gx_matrix_identity:
# do draw function
Statement of glEnable/glDisable, designed to be use with “with” keyword.
Alias: gx_enable.
Statement of glBegin/glEnd, designed to be use with “with” keyword
Alias: gx_begin.
Statement of glPushAttrib/glPopAttrib, designed to be use with “with” keyword
Alias: gx_attrib.
Statement of glPushAttrib/glPopAttrib on COLOR BUFFER + color, designed to be use with “with” keyword
Alias: gx_color.
Statement of setting a texture
Alias: gx_texture.
Bind the texture on the current context / texture unit
Return the GL id of texture
Get the GL target of the texture
Release the current attribute from the binded texture
Alias to GlBlending()
Alias to GlBlending(sfactor=GL_DST_COLOR, dfactor=GL_ONE_MINUS_SRC_ALPHA)
Alias to GlMatrix()
Alias to GlMatrix(do_loadidentity=True)
Repalce the content with the source content