本文整理汇总了Python中bgl.glGetIntegerv方法的典型用法代码示例。如果您正苦于以下问题:Python bgl.glGetIntegerv方法的具体用法?Python bgl.glGetIntegerv怎么用?Python bgl.glGetIntegerv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bgl
的用法示例。
在下文中一共展示了bgl.glGetIntegerv方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: glGetIntegerv
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glGetIntegerv [as 别名]
def glGetIntegerv(pname, params):
bgl.glGetIntegerv(pname, params)
示例2: __init__
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glGetIntegerv [as 别名]
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)
示例3: start
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glGetIntegerv [as 别名]
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)
示例4: _init_opengl
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glGetIntegerv [as 别名]
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()