Python bgl.GL_TEXTURE_MAG_FILTER Examples
The following are 4
code examples of bgl.GL_TEXTURE_MAG_FILTER().
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: viewport.py From BlendLuxCore with GNU General Public License v3.0 | 6 votes |
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)
Example #2
Source File: muv_texproj_ops.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
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()
Example #3
Source File: ui.py From addon_common with GNU General Public License v3.0 | 5 votes |
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
Example #4
Source File: archipack_gl.py From archipack with GNU General Public License v3.0 | 5 votes |
def draw(self, context, render=False): if self.image is None: return bgl.glPushAttrib(bgl.GL_ENABLE_BIT) p0 = self.pts[0] p1 = self.pts[1] bgl.glEnable(bgl.GL_BLEND) bgl.glColor4f(*self.colour) bgl.glRectf(p0.x, p0.y, p1.x, p1.y) self.image.gl_load() bgl.glEnable(bgl.GL_BLEND) bgl.glBindTexture(bgl.GL_TEXTURE_2D, self.image.bindcode[0]) bgl.glTexParameteri(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MIN_FILTER, bgl.GL_NEAREST) bgl.glTexParameteri(bgl.GL_TEXTURE_2D, bgl.GL_TEXTURE_MAG_FILTER, bgl.GL_NEAREST) bgl.glEnable(bgl.GL_TEXTURE_2D) bgl.glBlendFunc(bgl.GL_SRC_ALPHA, bgl.GL_ONE_MINUS_SRC_ALPHA) # bgl.glColor4f(1, 1, 1, 1) bgl.glBegin(bgl.GL_QUADS) bgl.glTexCoord2d(0, 0) bgl.glVertex2d(p0.x, p0.y) bgl.glTexCoord2d(0, 1) bgl.glVertex2d(p0.x, p1.y) bgl.glTexCoord2d(1, 1) bgl.glVertex2d(p1.x, p1.y) bgl.glTexCoord2d(1, 0) bgl.glVertex2d(p1.x, p0.y) bgl.glEnd() self.image.gl_free() bgl.glDisable(bgl.GL_TEXTURE_2D)