本文整理汇总了Python中bgl.GL_LINEAR属性的典型用法代码示例。如果您正苦于以下问题:Python bgl.GL_LINEAR属性的具体用法?Python bgl.GL_LINEAR怎么用?Python bgl.GL_LINEAR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类bgl
的用法示例。
在下文中一共展示了bgl.GL_LINEAR属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_texture
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import GL_LINEAR [as 别名]
def _update_texture(self, scene):
if self._transparent:
gl_format = bgl.GL_RGBA
internal_format = bgl.GL_RGBA32F
else:
gl_format = bgl.GL_RGB
internal_format = bgl.GL_RGB32F
bgl.glActiveTexture(bgl.GL_TEXTURE0)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, self.texture_id)
bgl.glTexImage2D(bgl.GL_TEXTURE_2D, 0, internal_format, self._width, self._height,
0, gl_format, bgl.GL_FLOAT, self.buffer)
bgl.glTexParameteri(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_WRAP_S, bgl.GL_CLAMP_TO_EDGE)
bgl.glTexParameteri(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_WRAP_T, bgl.GL_CLAMP_TO_EDGE)
bgl.glTexParameteri(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MIN_FILTER, bgl.GL_NEAREST)
mag_filter = bgl.GL_NEAREST if scene.luxcore.viewport.mag_filter == "NEAREST" else bgl.GL_LINEAR
bgl.glTexParameteri(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MAG_FILTER, mag_filter)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, NULL)
示例2: draw_texture
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import GL_LINEAR [as 别名]
def draw_texture(self, context):
sc = context.scene
# no textures are selected
if sc.muv_texproj_tex_image == "None":
return
# setup rendering region
rect = get_canvas(context, sc.muv_texproj_tex_magnitude)
positions = [
[rect.x0, rect.y0],
[rect.x0, rect.y1],
[rect.x1, rect.y1],
[rect.x1, rect.y0]
]
tex_coords = [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [1.0, 0.0]]
# get texture to be renderred
img = bpy.data.images[sc.muv_texproj_tex_image]
# OpenGL configuration
bgl.glEnable(bgl.GL_BLEND)
bgl.glEnable(bgl.GL_TEXTURE_2D)
if img.bindcode:
bind = img.bindcode
bgl.glBindTexture(bgl.GL_TEXTURE_2D, bind)
bgl.glTexParameteri(
bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MIN_FILTER, bgl.GL_LINEAR)
bgl.glTexParameteri(
bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MAG_FILTER, bgl.GL_LINEAR)
bgl.glTexEnvi(
bgl.GL_TEXTURE_ENV, bgl.GL_TEXTURE_ENV_MODE, bgl.GL_MODULATE)
# render texture
bgl.glBegin(bgl.GL_QUADS)
bgl.glColor4f(1.0, 1.0, 1.0, sc.muv_texproj_tex_transparency)
for (v1, v2), (u, v) in zip(positions, tex_coords):
bgl.glTexCoord2f(u, v)
bgl.glVertex2f(v1, v2)
bgl.glEnd()
示例3: buffer_image
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import GL_LINEAR [as 别名]
def buffer_image(self):
if not self.loaded: return
if self.buffered: return
if self.deleted: return
bgl.glBindTexture(bgl.GL_TEXTURE_2D, self.texture_id)
bgl.glTexEnvf(bgl.GL_TEXTURE_ENV, bgl.GL_TEXTURE_ENV_MODE, bgl.GL_MODULATE)
bgl.glTexParameterf(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MAG_FILTER, bgl.GL_NEAREST)
bgl.glTexParameterf(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MIN_FILTER, bgl.GL_LINEAR)
# texbuffer = bgl.Buffer(bgl.GL_BYTE, [self.width,self.height,self.depth], image_data)
image_size = self.image_width*self.image_height*self.image_depth
texbuffer = bgl.Buffer(bgl.GL_BYTE, [image_size], self.image_flat)
bgl.glTexImage2D(bgl.GL_TEXTURE_2D, 0, bgl.GL_RGBA, self.image_width, self.image_height, 0, bgl.GL_RGBA, bgl.GL_UNSIGNED_BYTE, texbuffer)
del texbuffer
bgl.glBindTexture(bgl.GL_TEXTURE_2D, 0)
self.buffered = True
示例4: execute
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import GL_LINEAR [as 别名]
def execute(self, context):
"""
Args:
context:
Returns:
"""
loadModelsAndPoses()
modelsPosesColl = bUtils.getPhobosPreferences().models_poses
for model_pose in modelsPosesColl:
if model_pose.name not in bpy.data.images.keys():
if model_pose.type == 'robot_name':
bpy.data.images.new(model_pose.name, 0, 0)
elif 'robot_pose':
if model_pose.preview != '':
if os.path.split(model_pose.preview)[-1] in bpy.data.images.keys():
bpy.data.images[os.path.split(model_pose.preview)[-1]].reload()
im = bpy.data.images.load(model_pose.preview)
model_pose.name = im.name
# im.name = model_pose.name
im.gl_load(0, bgl.GL_LINEAR, bgl.GL_LINEAR)
else:
bpy.data.images.new(model_pose.name, 0, 0)
else:
bpy.data.images[model_pose.name].reload()
bpy.data.images[model_pose.name].gl_load(0, bgl.GL_LINEAR, bgl.GL_LINEAR)
return {'FINISHED'}