本文整理汇总了Python中opengltk.OpenGL.GL.glDisable方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glDisable方法的具体用法?Python GL.glDisable怎么用?Python GL.glDisable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opengltk.OpenGL.GL
的用法示例。
在下文中一共展示了GL.glDisable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Draw
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def Draw(self):
#print"Box.Draw"
self.oldFPM = self.frontPolyMode
if self.frontPolyMode == GL.GL_LINE:
GL.glDisable(GL.GL_LIGHTING)
#c is 8x3 array
c= self.vertexSet.vertices.array
#lines parallel to x-axis should be red, y->blue and z->green
col = ((1,0,0),(0,1,0),(0,0,1))
#these groups of 4 pairs of points define lines parallel to x, y, and z axes
alines=[[(c[0],c[1]),(c[2],c[3]),(c[4],c[5]),(c[6],c[7])],
[(c[0],c[3]),(c[1],c[2]),(c[4],c[7]),(c[5],c[6])],
[(c[0],c[4]),(c[1],c[5]),(c[3],c[7]),(c[2],c[6])]]
namectr=0
for i in range(3):
if not self.inheritMaterial:
GL.glColor3fv(col[i])
for vpairs in alines[i]:
GL.glPushName(namectr)
GL.glBegin(GL.GL_LINES)
GL.glVertex3dv(list(vpairs[0]))
GL.glVertex3dv(list(vpairs[1]))
GL.glEnd()
GL.glPopName()
namectr=namectr+1
self.viewer.enableOpenglLighting()
return 1
else:
return IndexedPolygons.Draw(self)
示例2: Draw
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def Draw(self):
#print "StickerImage.Draw", self
if self.image is None:
return
GL.glMatrixMode(GL.GL_PROJECTION)
GL.glPushMatrix()
GL.glLoadIdentity()
Insert2d.Draw(self)
GL.glMatrixMode(GL.GL_MODELVIEW)
GL.glPushMatrix()
GL.glLoadIdentity()
GL.glDisable(GL.GL_DEPTH_TEST)
GL.glDisable(GL.GL_LIGHTING);
width = self.size[0]
height = self.size[1]
fullWidth = self.viewer.currentCamera.width
fullHeight = self.viewer.currentCamera.height
# we want the anchor of the image to be at the given position
posxFromLeft = self.position[0] * fullWidth - self.anchor[0] * width
posyFrombottom = (1.-self.position[1]) * fullHeight - (1.-self.anchor[1]) * height
#print "posxFromLeft, posyFrombottom", posxFromLeft, posyFrombottom
# used for picking
self.polygonContour = [ (posxFromLeft, posyFrombottom),
(posxFromLeft+width, posyFrombottom),
(posxFromLeft+width, posyFrombottom+height),
(posxFromLeft, posyFrombottom+height)
]
# this accept negative values were GL.glRasterPos2f(x,y) doesn't
GL.glRasterPos2f(0, 0)
_gllib.glBitmap(0, 0, 0, 0, posxFromLeft, posyFrombottom, 0)
GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1)
if self.image.mode == 'RGBA':
_gllib.glDrawPixels(self.image.size[0], self.image.size[1],
GL.GL_RGBA, GL.GL_UNSIGNED_BYTE,
self.image.tostring() )
elif self.image.mode == 'RGB':
_gllib.glDrawPixels(self.image.size[0], self.image.size[1],
GL.GL_RGB, GL.GL_UNSIGNED_BYTE,
self.image.tostring() )
elif self.image.mode == 'L':
_gllib.glDrawPixels(self.image.size[0], self.image.size[1],
GL.GL_LUMINANCE, GL.GL_UNSIGNED_BYTE,
self.image.tostring() )
GL.glMatrixMode(GL.GL_PROJECTION)
GL.glPopMatrix()
GL.glMatrixMode(GL.GL_MODELVIEW)
GL.glPopMatrix()
return 1
示例3: SetupGL
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def SetupGL(self):
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
"""Setup OpenGL rendering state for this object
"""
#print "SetupGL", self
if not self.inheritMaterial:
self.InitMaterial()
self.InitColor()
if self.GetLighting():
#glEnable(GL_LIGHTING)
if self.viewer is not None:
self.viewer.enableOpenglLighting()
shading = self.GetShading()
if shading != GL.GL_NONE:
if self.normals is not None:
if (shading==GL.GL_SMOOTH and \
len(self.normals)!=len(self.vertexSet)) or \
(shading==GL.GL_FLAT and \
len(self.normals)!=len(self.faceSet)):
self.GetNormals()
self.viewer.objectsNeedingRedo[self] = None
GL.glShadeModel(shading)
else: # no lighting
GL.glDisable(GL.GL_LIGHTING)
if not self.inheritCulling:
if self.culling in (GL.GL_BACK, GL.GL_FRONT, GL.GL_FRONT_AND_BACK):
GL.glCullFace(self.culling)
GL.glEnable(GL.GL_CULL_FACE)
else: GL.glDisable(GL.GL_CULL_FACE)
if not self.inheritFrontPolyMode:
mode =self.frontPolyMode
if self.frontPolyMode==viewerConst.OUTLINED:
mode = GL.GL_FILL
if self.frontAndBack:
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, mode)
else:
GL.glPolygonMode(GL.GL_FRONT, mode)
if not self.inheritBackPolyMode:
mode = self.backPolyMode
if self.backPolyMode==viewerConst.OUTLINED:
mode = GL.GL_FILL
GL.glPolygonMode(GL.GL_BACK, mode)
#self._AntiAliasing()
self._WidthAndStipple()
示例4: Draw
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def Draw(self):
#print "Sticker.Draw", self
GL.glMatrixMode(GL.GL_PROJECTION)
GL.glPushMatrix()
GL.glLoadIdentity()
Insert2d.Draw(self)
GL.glMatrixMode(GL.GL_MODELVIEW)
GL.glPushMatrix()
GL.glLoadIdentity()
GL.glDisable(GL.GL_DEPTH_TEST)
GL.glDisable(GL.GL_LIGHTING);
lLabelbounds = self.calculateSize()
width = self.size[0]
height = self.size[1]
fullWidth = self.viewer.currentCamera.width
fullHeight = self.viewer.currentCamera.height
# we want the anchor of the image to be at the given position
posxFromLeft = self.position[0] * fullWidth - self.anchor[0] * width
posyFrombottom = (1.-self.position[1]) * fullHeight - (1.-self.anchor[1]) * height
posxFromLeft = int(floor( posxFromLeft ) )
posyFrombottom = int(floor( posyFrombottom ) )
if (self.position[1] == 0.):
posyFrombottom -= 1
#print "posxFromLeft, posyFrombottom", posxFromLeft, posyFrombottom
# used for picking
self.polygonContour = [ (posxFromLeft, posyFrombottom),
(posxFromLeft+width, posyFrombottom),
(posxFromLeft+width, posyFrombottom+height),
(posxFromLeft, posyFrombottom+height)
]
GL.glTranslatef(float(posxFromLeft), float(posyFrombottom), 0)
self.drawSticker(lLabelbounds)
GL.glEnable(GL.GL_DEPTH_TEST)
GL.glEnable(GL.GL_LIGHTING);
GL.glMatrixMode(GL.GL_PROJECTION)
GL.glPopMatrix()
GL.glMatrixMode(GL.GL_MODELVIEW)
GL.glPopMatrix()
return 1
示例5: drawpolygons
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def drawpolygons(self):
g = self.geom
vertices = g.getVertices()
faces = g.getFaces()
normals = g.getFNormals()
GL.glDisable(GL.GL_CULL_FACE)
for i,f in enumerate(faces):
GL.glBegin(GL.GL_POLYGON)
GL.glNormal3fv(normals[i])
for vi in f:
GL.glVertex3fv(vertices[vi])
GL.glEnd()
i+=1
示例6: redraw
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def redraw(self):
""" redraw the Material editor opengl sphere that shows the effect
of the modifications
"""
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
self.tk.call(self._w, 'makecurrent')
GL.glClearColor(0,0,0,0)
self.initProjection()
self.Configure()
GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
""" draw the black background squares """
GL.glDisable( GL.GL_LIGHTING )
GL.glColor3f( 0.1, 0.1, 0.1 )
GL.glBegin(GL.GL_QUADS)
GL.glVertex3f(-2, 0, 2); GL.glVertex3f(-2, 2, 2)
GL.glVertex3f( 0, 2, 2); GL.glVertex3f( 0, 0, 2)
GL.glEnd()
GL.glBegin(GL.GL_QUADS)
GL.glVertex3f( 0,-2, 2); GL.glVertex3f( 0, 0, 2)
GL.glVertex3f( 2, 0, 2); GL.glVertex3f( 2,-2, 2)
GL.glEnd()
""" draw the grey background squares """
GL.glColor3f( 0.3, 0.3, 0.3 )
GL.glBegin(GL.GL_QUADS)
GL.glVertex3f(-2,-2, 2); GL.glVertex3f(-2, 0, 2)
GL.glVertex3f( 0, 0, 2); GL.glVertex3f( 0,-2, 2)
GL.glEnd()
GL.glBegin(GL.GL_QUADS)
GL.glVertex3f( 0, 0, 2); GL.glVertex3f( 0, 2, 2)
GL.glVertex3f( 2, 2, 2); GL.glVertex3f( 2, 0, 2)
GL.glEnd()
""" enable the sphere transparancy """
GL.glEnable(GL.GL_BLEND)
GL.glDepthMask(GL.GL_FALSE)
GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
""" draw the sphere """
#GL.glEnable(GL.GL_LIGHTING)
if self.viewer is not None:
self.viewer.enableOpenglLighting()
self.setMaterial()
extractedGlutSolidSphere(1.6, 30, 30, 0)
示例7: display
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def display(self):
GL.glClear( GL.GL_COLOR_BUFFER_BIT)
# select white for all lines
GL.glColor3f( 1.0, 1.0, 1.0)
# in 1st row, 3 lines, each with a different stipple
GL.glEnable( GL.GL_LINE_STIPPLE)
GL.glLineStipple( 1, 0x0101) # dotted
self.drawOneLine( 50.0, 125.0, 150.0, 125.0)
GL.glLineStipple( 1, 0x00FF) # dashed
self.drawOneLine( 150.0, 125.0, 250.0, 125.0);
GL.glLineStipple( 1, 0x1C47) # dash/dot/dash
self.drawOneLine( 250.0, 125.0, 350.0, 125.0)
# in 2nd row, 3 wide lines, each with different stipple
GL.glLineWidth( 5.0)
GL.glLineStipple( 1, 0x0101) # dotted
self.drawOneLine( 50.0, 100.0, 150.0, 100.0)
GL.glLineStipple( 1, 0x00FF) # dashed
self.drawOneLine( 150.0, 100.0, 250.0, 100.0)
GL.glLineStipple( 1, 0x1C47) # dash/dot/dash
self.drawOneLine( 250.0, 100.0, 350.0, 100.0)
GL.glLineWidth( 1.0)
# in 3rd row, 6 lines, with dash/dot/dash stipple
# as part of a single connected line strip
GL.glLineStipple( 1, 0x1C47) # dash/dot/dash
GL.glBegin( GL.GL_LINE_STRIP)
try:
for i in range( 0, 7):
GL.glVertex2f( 50.0 + (i * 50.0), 75.0)
finally:
GL.glEnd()
# in 4th row, 6 independent lines with same stipple */
for i in range( 0, 6):
self.drawOneLine( 50.0 + (i * 50.0), 50.0, 50.0 + ((i+1) * 50.0), 50.0)
# in 5th row, 1 line, with dash/dot/dash stipple
# and a stipple repeat factor of 5
GL.glLineStipple( 5, 0x1C47) # dash/dot/dash
self.drawOneLine( 50.0, 25.0, 350.0, 25.0)
GL.glDisable( GL.GL_LINE_STIPPLE)
GL.glFlush()
示例8: Draw
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def Draw(self):
GL.glEnable(GL.GL_DEPTH_TEST);
GL.glClear( GL.GL_STENCIL_BUFFER_BIT)
GL.glDisable(GL.GL_FOG)
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)
OpenCSG.render(self.primitives, self.algo, self.depthalgo)
GL.glDepthFunc(GL.GL_EQUAL)
# FIXME should only enable fog if it is on in camera
GL.glEnable(GL.GL_FOG)
self.SetupGL()
for p in self.pyprimitives:
p.render()
GL.glDepthFunc(GL.GL_LESS);
示例9: redraw
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def redraw(self, event=None, filter=None):
if self.imarray is None:
return
if filter:
self.master.lift()
GL.glConvolutionFilter2D(GL.GL_CONVOLUTION_2D, GL.GL_LUMINANCE,
3, 3, GL.GL_LUMINANCE, GL.GL_FLOAT,
filter)
## GL.glConvolutionParameterfv(GL.GL_CONVOLUTION_2D,
## GL.GL_CONVOLUTION_FILTER_SCALE,
## (3., 3.,3.,3.))
## s= self.scale
## GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_RED_SCALE, s)
## GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_BLUE_SCALE, s)
## GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_GREEN_SCALE, s)
## s = self.bias
## GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_RED_BIAS, s)
## GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_BLUE_BIAS, s)
## GL.glPixelTransferf(GL.GL_POST_CONVOLUTION_GREEN_BIAS, s)
## GL.GL_CONVOLUTION_FILTER_SCALE,
## (3., 3.,3.,3.))
## GL.glConvolutionParameteriv(GL.GL_CONVOLUTION_2D,
## GL.GL_CONVOLUTION_FILTER_BIAS,
## (1500, 1500, 1500, 1500))
GL.glEnable(GL.GL_CONVOLUTION_2D)
self.tk.call(self._w, 'makecurrent')
GL.glClearColor(0.0, 0.0, 0.0, 0.0)
GL.glClear(GL.GL_COLOR_BUFFER_BIT)
GL.glRasterPos2i( 0, 0)
GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1)
if self.mode=='RGB':
_gllib.glDrawPixels( self.width, self.height,
GL.GL_RGB, GL.GL_UNSIGNED_BYTE, self.imarray)
elif self.mode in ['L','P']:
_gllib.glDrawPixels( self.width, self.height,
GL.GL_LUMINANCE, GL.GL_UNSIGNED_BYTE,
self.imarray)
GL.glDisable(GL.GL_CONVOLUTION_2D)
示例10: _WidthAndStipple
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def _WidthAndStipple(self):
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
"""Set the line or points width
"""
#print "_WidthAndStipple", self.stippleLines , self.inheritStippleLines , self
GL.glPointSize(self.getPointWidth())
GL.glLineWidth(self.getLineWidth())
if self.getStippleLines() in (True, 1):
GL.glEnable(GL.GL_LINE_STIPPLE)
ls = self.linestipple
GL.glLineStipple(ls.factor, ls.pattern)
else:
GL.glDisable(GL.GL_LINE_STIPPLE)
if self.getStipplePolygons() in (True, 1):
GL.glEnable(GL.GL_POLYGON_STIPPLE)
ps = self.polygonstipple
GL.glPolygonStipple(self.polygonstipple.pattern)
else:
GL.glDisable(GL.GL_POLYGON_STIPPLE)
示例11: extrude
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def extrude(self):
"""Extrude a cone with radii specified at each point
of the extrusion"""
assert len(self.radii)==len(self.trace3D)
from gle import glec
gle.gleSetJoinStyle ( self.joinStyle | self.normalStyle )
glec.gleFeedBack()
#DisplayFunction of the old GlePolyCylinder
GL.glColorMaterial (GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT)
GL.glEnable (GL.GL_COLOR_MATERIAL)
if self.viewer is not None:
self.viewer.enableOpenglLighting()
colors = self.materials[GL.GL_FRONT].prop[0][:,:3]
gle.glePolyCone(self.trace3D, colors, self.radii)
GL.glDisable (GL.GL_COLOR_MATERIAL)
glec.gleTextureMode(0)
v,n,s = glec.gleGetTriangleMesh()
return v,n,s
示例12: Draw
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def Draw(self):
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
GL.glEnable(GL.GL_AUTO_NORMAL)
GL.glEnable(GL.GL_NORMALIZE)
if self.theNurb is None:
self.theNurb = GLU.gluNewNurbsRenderer()
GLU.gluNurbsProperty(self.theNurb, GLU.GLU_SAMPLING_TOLERANCE,
25.0)
GLU.gluNurbsProperty(self.theNurb, GLU.GLU_DISPLAY_MODE,
GLU.GLU_OUTLINE_POLYGON)
GLU.gluNurbsCallback(self.theNurb, GLU.GLU_ERROR, self.nurbsError)
GLU.gluBeginSurface(self.theNurb)
_glulib.gluNurbsSurface( self.theNurb,
8, self.knots,
8, self.knots,
4*3,
3,
self.ctlpoints,
4, 4,
GL.GL_MAP2_VERTEX_3)
GLU.gluEndSurface(self.theNurb)
GL.glPointSize(5.0)
GL.glDisable(GL.GL_LIGHTING)
GL.glColor3f(1.0, 1.0, 0.0)
GL.glBegin(GL.GL_POINTS)
for i in range(4):
for j in range(4):
GL.glVertex3fv(self.ctlpoints[i][j])
GL.glEnd()
GL.glDisable(GL.GL_AUTO_NORMAL)
GL.glDisable(GL.GL_NORMALIZE)
示例13: Draw
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def Draw(self):
if __debug__:
if hasattr(DejaVu, 'functionName'): DejaVu.functionName()
""" draw geom
"""
#print "IndexedGeom.Draw", self.name
if self.vertexArrayFlag is True \
and DejaVu.enableVertexArray is True:
if not (hasattr(self.vertexSet, "texCoords") \
and self.vertexSet.texCoords.status >= viewerConst.COMPUTED):
return self.drawVertexArray()
if len(self.faceSet) and len(self.vertexSet):
if self.materials[GL.GL_FRONT] and \
not self.inheritMaterial:
mat = self.materials[GL.GL_FRONT]
fpProp = []
fpBind = []
for propInd in range(4):
b, p = mat.GetProperty(propInd)
fpProp.append(p)
fpBind.append(b)
fpProp.append(mat.prop[4])
fpBind.append(mat.binding[4])
else:
fpProp = None
fpBind = None
if self.materials[GL.GL_BACK] and \
not self.inheritMaterial:
mat = self.materials[GL.GL_BACK]
bpProp = []
bpBind = []
for propInd in range(4):
b, p = mat.GetProperty(propInd)
bpProp.append(p)
bpBind.append(b)
bpProp.append(mat.prop[4])
bpBind.append(mat.binding[4])
else:
bpProp = None
bpBind = None
texCoords = None
if hasattr(self.vertexSet, "texCoords"):
if self.vertexSet.texCoords.status >= viewerConst.COMPUTED:
texCoords = self.vertexSet.texCoords.array
if self.lighting and self.normals is not None:
if self.invertNormals:
norms = - self.normals
else:
norms = self.normals
else:
norms = None
from DejaVu import preventIntelBug_BlackTriangles
if preventIntelBug_BlackTriangles:
preventIntelBug = 1
else:
preventIntelBug = 0
lsharpColorBoundaries = self.getSharpColorBoundaries()
if self.disableStencil is True:
GL.glDisable(GL.GL_STENCIL_TEST)
status = glDrawIndexedGeom(
self.primitiveType,
self.vertexSet.vertices.array,
self.faceSet.faces.array,
norms,
texCoords,
fpProp, bpProp, fpBind, bpBind,
self.frontAndBack, 1,
lsharpColorBoundaries,
preventIntelBug,
highlight=self.highlight,
)
if self.disableStencil is True:
GL.glEnable(GL.GL_STENCIL_TEST)
return status
示例14: drawLegendOnly
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def drawLegendOnly(
fullWidth,
fullHeight,
ramp,
verticalLegend=True,
roomLeftToLegend=0,
roomBelowLegend=50,
legendShortSide=10,
legendLongSide=150,
interpolate=True,
selected=False,
tile=None,
):
if ramp is None or len(ramp) == 0:
return
if tile is not None and selected is True:
selected = False
# deducted values
if verticalLegend is True:
lRoomToLegendCloseLongSide = roomLeftToLegend
lRoomToLegendCloseShortSide = roomBelowLegend
if legendShortSide < 1:
legendShortSide = 1
if legendLongSide < 1:
legendLongSide = 1
else:
lRoomToLegendCloseLongSide = roomBelowLegend
lRoomToLegendCloseShortSide = roomLeftToLegend
if legendShortSide < 1:
legendShortSide = 1
if legendLongSide < 1:
legendLongSide = 1
lRoomToLegendFarLongSide = lRoomToLegendCloseLongSide + legendShortSide
GL.glMatrixMode(GL.GL_PROJECTION)
GL.glPushMatrix()
GL.glLoadIdentity()
if tile is None:
GL.glOrtho(0, float(fullWidth), 0, float(fullHeight), -1, 1)
else:
GL.glOrtho(float(tile[0]), float(tile[1]), float(tile[2]), float(tile[3]), -1, 1)
GL.glMatrixMode(GL.GL_MODELVIEW)
GL.glPushMatrix()
GL.glLoadIdentity()
GL.glDisable( GL.GL_LIGHTING )
GL.glPolygonMode(GL.GL_FRONT, GL.GL_FILL)
GL.glDisable(GL.GL_DEPTH_TEST)
GL.glDepthMask(GL.GL_FALSE)
if len(ramp[0]) == 4: # there are alpha values, draw checkered bg
GL.glEnable(GL.GL_BLEND)
GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
#draw a bunch of quads as background
lCheckerSquareSize = legendShortSide * .5
if lCheckerSquareSize != 0:
nbquads = int(legendLongSide / lCheckerSquareSize)
else:
nbquads = 1
c1 = ( 0.1, 0.1, 0.1 )
c2 = ( 0.3, 0.3, 0.3 )
c = c1
x2 = None
for i in range(nbquads+1):
GL.glColor3fv(c)
if i==nbquads and nbquads != 0:
x1=x2
x2=legendLongSide
else:
x1 = i*lCheckerSquareSize
x2 = min (x1+lCheckerSquareSize, legendLongSide)
GL.glBegin(GL.GL_QUADS)
if verticalLegend is True:
GL.glVertex2f(float(lRoomToLegendCloseLongSide),
float(lRoomToLegendCloseShortSide + x1))
GL.glVertex2f(float(lRoomToLegendCloseLongSide+lCheckerSquareSize),
float(lRoomToLegendCloseShortSide + x1))
GL.glVertex2f(float(lRoomToLegendCloseLongSide+lCheckerSquareSize),
float(lRoomToLegendCloseShortSide + x2))
GL.glVertex2f(float(lRoomToLegendCloseLongSide),
float(lRoomToLegendCloseShortSide + x2))
else:
GL.glVertex2f(float(lRoomToLegendCloseShortSide + x2),
float(lRoomToLegendCloseLongSide))
GL.glVertex2f(float(lRoomToLegendCloseShortSide + x2),
float(lRoomToLegendCloseLongSide+lCheckerSquareSize))
GL.glVertex2f(float(lRoomToLegendCloseShortSide + x1),
float(lRoomToLegendCloseLongSide+lCheckerSquareSize))
GL.glVertex2f(float(lRoomToLegendCloseShortSide + x1),
float(lRoomToLegendCloseLongSide))
GL.glEnd()
if c==c1:
c=c2
else:
#.........这里部分代码省略.........
示例15: _Disable
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glDisable [as 别名]
def _Disable(self):
"""Deactivate the clipping plane"""
GL.glDisable(self.clipPlaneNames[self.num])