fruitloop.utils package¶
Submodules¶
fruitloop.utils.gl module¶
-
class
BindNoTargetMixin¶ Bases:
fruitloop.utils.gl.BindTargetMixinSame as BindTargetMixin, but for bind functions that don’t have a specified target.
-
bind()¶
-
classmethod
unbind()¶
-
-
class
BindTargetMixin¶ Bases:
objectMixin that speifices a bind() and unbind() interface by taking advantage of the OpenGL bind format: bind: bindfun(target, id) unbind: bindfun(target, 0)
-
bind()¶
-
bindfun= None¶
-
classmethod
unbind()¶
-
-
class
BindingContextMixin¶ Bases:
objectMixin that calls self.bind() and self.unbind() when used in a context manager.
-
class
ElementArrayBuffer(*args, **kwargs)¶ Bases:
fruitloop.utils.gl.VBO-
target¶
-
-
class
VAO(indices=None, **kwargs)¶ Bases:
fruitloop.utils.gl.GlGenMixin,fruitloop.utils.gl.BindingContextMixin,fruitloop.utils.gl.BindNoTargetMixinOpenGL Vertex Array Object. Sends array data in a Vertex Buffer to the GPU. This data can be accessed in the vertex shader using the ‘layout(location = N)’ header line, where N = the index of the array given the VAO.
Example: VAO(vertices, normals, texcoords):
Fragshader: layout(location = 0) in vec3 vertexCoord; layout(location = 1) in vec2 texCoord; layout(location = 2) in vec3 normalCoord;
-
assign_vertex_attrib_location(vbo, location)¶ Load data into a vbo
-
bindfun¶
-
draw(mode=<Mock id='140636315753808'>)¶
-
element_array_buffer¶
-
genfun¶
-
-
class
VBO(ndarray, *args, **kwargs)¶ Bases:
fruitloop.utils.gl.GlGenMixin,fruitloop.utils.gl.BindingContextMixin,fruitloop.utils.gl.BindTargetMixin-
bindfun¶
-
genfun¶
-
target¶
-
-
create_opengl_object(gl_gen_function, n=1)¶ Returns int pointing to an OpenGL texture
-
enable_states(*args, **kwds)¶ Context Manager that calls glEnable and glDisable on a list of gl states.
-
setpriority(pid=None, priority=1)¶ Set The Priority of a Windows Process. Priority is a value between 0-5 where 2 is normal priority. Default sets the priority of the current python process but can take any valid process ID.
-
vec(floatlist, newtype='float')¶ Makes GLfloat or GLuint vector containing float or uint args. By default, newtype is ‘float’, but can be set to ‘int’ to make uint list.
fruitloop.utils.orienting module¶
-
calculate_model_matrix(position, rotation, scale)¶ Returns 4x4 model matrix from the (x.y,z) position and XYZ Euler rotation, in degrees.
-
calculate_view_matrix(position, rotation)¶ TReturns 4x4 view matrix from the (x.y,z) position and XYZ Euler rotation, in degrees.
fruitloop.utils.timers module¶
-
countdown_timer(total_secs, stop_iteration=False)¶ Generates an iterator that returns the time remaining from total_time (secs). Returns 0.0 when time is up, unless stop_iteration is True.
-
dt_timer()¶ A Generator that returns the time since last called. Never returns StopIteration.