本文整理匯總了Python中pi3d.util.Utility.texture_min_mag方法的典型用法代碼示例。如果您正苦於以下問題:Python Utility.texture_min_mag方法的具體用法?Python Utility.texture_min_mag怎麽用?Python Utility.texture_min_mag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pi3d.util.Utility
的用法示例。
在下文中一共展示了Utility.texture_min_mag方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: string
# 需要導入模塊: from pi3d.util import Utility [as 別名]
# 或者: from pi3d.util.Utility import texture_min_mag [as 別名]
def string(font, string, x, y, z, rot, sclx, scly):
opengles.glNormalPointer(GL_BYTE, 0, RECT_NORMALS)
Utility.texture_min_mag()
opengles.glEnableClientState(GL_TEXTURE_COORD_ARRAY)
opengles.glBindTexture(GL_TEXTURE_2D,font.tex)
opengles.glEnable(GL_TEXTURE_2D)
opengles.glDisable(GL_DEPTH_TEST)
opengles.glDisable(GL_CULL_FACE)
opengles.glEnable(GL_BLEND)
opengles.glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)
mtrx =(c_float * 16)()
opengles.glGetFloatv(GL_MODELVIEW_MATRIX,ctypes.byref(mtrx))
Utility.translatef(x, y, z)
Utility.rotatef(rot, 0, 0, 1)
Utility.scalef(sclx, scly, 1)
for c in range(0,len(string)):
v = ord(string[c])-32
w, h, texc, verts = font.chr[v]
if v > 0:
opengles.glVertexPointer(3, GL_FLOAT, 0,verts)
opengles.glTexCoordPointer(2, GL_FLOAT,0,texc)
opengles.glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, RECT_TRIANGLES)
Utility.translatef(w, 0, 0)
opengles.glLoadMatrixf(mtrx)
opengles.glDisable(GL_TEXTURE_2D)
opengles.glDisable(GL_BLEND)
opengles.glEnable(GL_DEPTH_TEST)
opengles.glEnable(GL_CULL_FACE)
示例2: draw
# 需要導入模塊: from pi3d.util import Utility [as 別名]
# 或者: from pi3d.util.Utility import texture_min_mag [as 別名]
def draw(self,tex, x, y, z):
mtrx = (ctypes.c_float*16)()
opengles.glGetFloatv(GL_MODELVIEW_MATRIX,ctypes.byref(mtrx))
Utility.translatef(-x, -y, -z)
Utility.texture_min_mag();
opengles.glVertexPointer(3, GL_FLOAT, 0, self.vertices)
opengles.glNormalPointer(GL_FLOAT, 0, self.normals)
opengles.glEnableClientState(GL_TEXTURE_COORD_ARRAY)
opengles.glDisable(GL_LIGHTING)
opengles.glEnable(GL_TEXTURE_2D)
if self.maptype=="FACES":
opengles.glTexCoordPointer(2, GL_FLOAT, 0, self.tex_faces)
opengles.glBindTexture(GL_TEXTURE_2D,tex[0].tex)
opengles.glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT , self.indtop)
Utility.texture_min_mag()
opengles.glBindTexture(GL_TEXTURE_2D,tex[1].tex)
opengles.glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT , self.indleft)
Utility.texture_min_mag()
opengles.glBindTexture(GL_TEXTURE_2D,tex[2].tex)
opengles.glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT , self.indfront)
Utility.texture_min_mag()
opengles.glBindTexture(GL_TEXTURE_2D,tex[3].tex)
opengles.glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT , self.indright)
Utility.texture_min_mag()
opengles.glBindTexture(GL_TEXTURE_2D,tex[4].tex)
opengles.glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT , self.indback)
if tex[5] >0:
Utility.texture_min_mag()
opengles.glBindTexture(GL_TEXTURE_2D,tex[5].tex)
opengles.glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT , self.indbot)
else:
#load view matrix
opengles.glTexCoordPointer(2, GL_FLOAT, 0, self.tex_coords)
opengles.glBindTexture(GL_TEXTURE_2D,tex.tex)
opengles.glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_SHORT , self.indices)
opengles.glEnable(GL_LIGHTING)
opengles.glDisable(GL_TEXTURE_2D)
#restore to previous matrix
opengles.glLoadMatrixf(mtrx)