Python bgl.glGetIntegerv() Examples
The following are 4
code examples of bgl.glGetIntegerv().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
bgl
, or try the search function
.
Example #1
Source File: bglx.py From Screencast-Keys with GNU General Public License v3.0 | 5 votes |
def glGetIntegerv(pname, params): bgl.glGetIntegerv(pname, params)
Example #2
Source File: gl.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def __init__(self, context): rv3d = context.region_data persmat = rv3d.perspective_matrix flatten_persmat = [persmat[i][j] for i in range(4) for j in range(4)] self.persmat_buffer = bgl.Buffer(bgl.GL_FLOAT, 16, flatten_persmat) # GL_BLEND blend = bgl.Buffer(bgl.GL_BYTE, [1]) bgl.glGetFloatv(bgl.GL_BLEND, blend) self.blend = blend[0] # GL_COLOR color = bgl.Buffer(bgl.GL_FLOAT, [4]) bgl.glGetFloatv(bgl.GL_COLOR, color) self.color = color # GL_LINE_WIDTH line_width = bgl.Buffer(bgl.GL_FLOAT, [1]) bgl.glGetFloatv(bgl.GL_LINE_WIDTH, line_width) self.line_width = line_width[0] # GL_Matrix_MODE matrix_mode = bgl.Buffer(bgl.GL_INT, [1]) bgl.glGetIntegerv(bgl.GL_MATRIX_MODE, matrix_mode) self.matrix_mode = matrix_mode[0] # GL_PROJECTION_MATRIX projection_matrix = bgl.Buffer(bgl.GL_DOUBLE, [16]) bgl.glGetFloatv(bgl.GL_PROJECTION_MATRIX, projection_matrix) self.projection_matrix = projection_matrix # blf: size, dpi self.size_dpi = (11, context.user_preferences.system.dpi)
Example #3
Source File: drawing.py From addon_common with GNU General Public License v3.0 | 5 votes |
def start(context): assert not ScissorStack.started rgn = context.region ScissorStack.context = context ScissorStack.box = (rgn.x, rgn.y, rgn.width, rgn.height) bgl.glGetIntegerv(bgl.GL_SCISSOR_BOX, ScissorStack.buf) ScissorStack.scissor_enabled = (bgl.glIsEnabled(bgl.GL_SCISSOR_TEST) == bgl.GL_TRUE) ScissorStack.stack = [tuple(ScissorStack.buf)] ScissorStack.started = True if not ScissorStack.scissor_enabled: bgl.glEnable(bgl.GL_SCISSOR_TEST)
Example #4
Source File: viewport.py From BlendLuxCore with GNU General Public License v3.0 | 4 votes |
def _init_opengl(self, engine, scene): # Create texture self.texture = bgl.Buffer(bgl.GL_INT, 1) bgl.glGenTextures(1, self.texture) self.texture_id = self.texture[0] # Bind shader that converts from scene linear to display space, # use the scene's color management settings. engine.bind_display_space_shader(scene) shader_program = bgl.Buffer(bgl.GL_INT, 1) bgl.glGetIntegerv(bgl.GL_CURRENT_PROGRAM, shader_program) # Generate vertex array self.vertex_array = bgl.Buffer(bgl.GL_INT, 1) bgl.glGenVertexArrays(1, self.vertex_array) bgl.glBindVertexArray(self.vertex_array[0]) texturecoord_location = bgl.glGetAttribLocation(shader_program[0], "texCoord") position_location = bgl.glGetAttribLocation(shader_program[0], "pos") bgl.glEnableVertexAttribArray(texturecoord_location) bgl.glEnableVertexAttribArray(position_location) # Generate geometry buffers for drawing textured quad width = self._width * self._pixel_size height = self._height * self._pixel_size position = [ self._offset_x, self._offset_y, self._offset_x + width, self._offset_y, self._offset_x + width, self._offset_y + height, self._offset_x, self._offset_y + height ] position = bgl.Buffer(bgl.GL_FLOAT, len(position), position) texcoord = [0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0] texcoord = bgl.Buffer(bgl.GL_FLOAT, len(texcoord), texcoord) self.vertex_buffer = bgl.Buffer(bgl.GL_INT, 2) bgl.glGenBuffers(2, self.vertex_buffer) bgl.glBindBuffer(bgl.GL_ARRAY_BUFFER, self.vertex_buffer[0]) bgl.glBufferData(bgl.GL_ARRAY_BUFFER, 32, position, bgl.GL_STATIC_DRAW) bgl.glVertexAttribPointer(position_location, 2, bgl.GL_FLOAT, bgl.GL_FALSE, 0, None) bgl.glBindBuffer(bgl.GL_ARRAY_BUFFER, self.vertex_buffer[1]) bgl.glBufferData(bgl.GL_ARRAY_BUFFER, 32, texcoord, bgl.GL_STATIC_DRAW) bgl.glVertexAttribPointer(texturecoord_location, 2, bgl.GL_FLOAT, bgl.GL_FALSE, 0, None) bgl.glBindBuffer(bgl.GL_ARRAY_BUFFER, NULL) bgl.glBindVertexArray(NULL) engine.unbind_display_space_shader()