Loading from Assimp(Pyassimp) to pyglet - bad results - python

So I'm learning OpenGL using pyglet and I'm importing some models from Blender using Assimp ( port: Pyassimp). So the scene is really basic, it is just 2 cubes and I'm saving it in blend format.In the next piece of code I'm just trying to draw one cube simply using its vertex positions, nothing else.
self.scene = pyassimp.load(FILENAME, pyassimp.postprocess.aiProcess_Triangulate) # Load the scene
self.vertices = numpy.array((), dtype=GLfloat)
for v in self.scene.meshes[1].vertices:
self.vertices = numpy.append(self.vertices, v)
self.vbo = pyglet.graphics.vertexbuffer.create_buffer(self.vertices.nbytes, GL_ARRAY_BUFFER, GL_STATIC_DRAW)
glEnableVertexAttribArray(0)
self.vbo.bind()
self.vbo.set_data(self.vertices.ctypes.data)
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0)
And next piece of code is the draw event:
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glEnable(GL_DEPTH_TEST)
glEnable(GL_COLOR_MATERIAL)
glEnable(GL_LIGHTING)
glEnable(GL_LIGHT0)
glLightfv(GL_LIGHT0, GL_POSITION, self.lightfv(1.0, 1.0, 1.0, 1.0))
glLightfv(GL_LIGHT0, GL_AMBIENT, self.lightfv(0.0, 0.0, 0.0, 1.0))
glLightfv(GL_LIGHT0, GL_DIFFUSE, self.lightfv(1.0, 1.0, 1.0, 1.0))
glLightfv(GL_LIGHT0, GL_SPECULAR, self.lightfv(1.0, 1.0, 1.0, 1.0))
glTranslated(0, 10, -25)
glRotatef(self.rotation, 0, 1, 0)
glDrawArrays(GL_TRIANGLES, 0, len(self.model.vertices))
Finally the result:

You have to loop over the faces of the mesh, read the vertex index from there and then draw the faces.
See the C example of assimp. It's quite simple, shows how to do and can very easy be ported to python.
https://github.com/assimp/assimp/blob/master/samples/SimpleOpenGL/Sample_SimpleOpenGL.c
For pyglet you can use the following snipped:
for node in self.scene.rootnode.children:
glPushMatrix()
glMultMatrixf((GLfloat * 16)(*node.transformation.transpose().flatten()))
for mesh in node.meshes:
for face in mesh.faces:
num_indices = len(face)
if num_indices == 1:
mode = GL_POINTS
elif num_indices == 2:
mode = GL_LINES
elif num_indices == 3:
mode = GL_TRIANGLES
else:
mode = GL_POLYGON
pyglet.graphics.draw_indexed(len(mesh.vertices), mode, face, ('v3f', mesh.vertices.flatten()))
glPopMatrix()

Related

Consider a circle (𝑥 − 40) 2 + (𝑦 − 40) 2 = 400. Rotate it along X- axis counter clockwise 30 degree & translate it along Z- axis for +20 units

Write a PYOpenGL code for this operation.
I am able to draw the circle but my code for rotating and translating is not working. The code is executing but not giving the correct result. Help me with the rotation and translation part of the question.
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from math import *
def circle():
posx, posy = 40,40
sides = 80
radius = 20
glBegin(GL_POLYGON)
for i in range(100):
cosine= radius * cos(i*2*pi/sides) + posx
sine = radius * sin(i*2*pi/sides) + posy
glVertex2f(cosine,sine)
glEnd()
def iterate():
glViewport(0, 0, 3000, 3000)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
# glMatrixMode(GL_MODELVIEW)
# glLoadIdentity()
# glTranslatef(0, 0, -3)
# glRotatef(50, 1, 0, 0)
# glRotatef(70, 0, 1, 0)
glOrtho(0.0, 500, 0.0, 500, 0.0, 1.0)
glMatrixMode (GL_MODELVIEW)
glLoadIdentity()
def showScreen():
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glLoadIdentity()
iterate()
glColor3f(1.0, 0.0, 3.0)
circle()
glutSwapBuffers()
glutInit()
glutInitDisplayMode(GLUT_RGBA)
glutInitWindowSize(400, 400)
glutInitWindowPosition(200, 200)
wind = glutCreateWindow("OpenGL Coding Practice")
glutDisplayFunc(showScreen)
glutIdleFunc(showScreen)
glutMainLoop()
When you transalte the circle along the z axis or rotate the circle it is clipped by the near (= 0) and far plane (= 1) of the Orthographic projection.
Change the distance to the near and far plane (e.g. -100 and 100):
glOrtho(0.0, 500, 0.0, 500, 0.0, 1.0)
glOrtho(0.0, 500, 0.0, 500, -100, 100)
iterate function:
def iterate():
glViewport(0, 0, 3000, 3000)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glOrtho(0.0, 500, 0.0, 500, -100, 100)
glMatrixMode (GL_MODELVIEW)
glLoadIdentity()
glTranslatef(0, 0, 20)
glRotatef(30, 1, 0, 0)

PyOpenGL(or PyGame) pixel-sized textures

I downloaded a simple sample program for using textures with PyOpenGL, Python & PyGame, but when I tried to replace the original texture with this:
(If you don't see that, its a 2x2 pixels square, where all the pixels has different colors)
than it gave me THIS:
I DON'T WANT THIS UGLY WINDOW LOGO!!
The code I downloaded:
#!/usr/bin/env python
from OpenGL.GL import *
from OpenGL.GLU import *
import pygame
from pygame.locals import *
class Texture():
# simple texture class
# designed for 32 bit png images (with alpha channel)
def __init__(self,fileName):
self.texID=0
self.LoadTexture(fileName)
def LoadTexture(self,fileName):
try:
textureSurface = pygame.image.load(fileName)
textureData = pygame.image.tostring(textureSurface, "RGBA", 1)
self.texID=glGenTextures(1)
glBindTexture(GL_TEXTURE_2D, self.texID)
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA,
textureSurface.get_width(), textureSurface.get_height(),
0, GL_RGBA, GL_UNSIGNED_BYTE, textureData )
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR)
except:
print "can't open the texture: %s"%(fileName)
def __del__(self):
glDeleteTextures(self.texID)
class Main():
def resize(self,(width, height)):
if height==0:
height=1
glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
#gluOrtho2D(-8.0, 8.0, -6.0, 6.0)
glFrustum(-2,2,-2,2,1,8)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
def init(self):
#set some basic OpenGL settings and control variables
glShadeModel(GL_SMOOTH)
glClearColor(0.0, 0.0, 0.0, 0.0)
glClearDepth(1.0)
glDisable(GL_DEPTH_TEST)
glDisable(GL_LIGHTING)
glDepthFunc(GL_LEQUAL)
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
#glEnable(GL_BLEND)
self.tutorial_texture=Texture("pixels.png")
self.demandedFps=30.0
self.done=False
self.x,self.y,self.z=0.0 , 0.0, -4.0
self.rX,self.rZ=0,0
def draw(self):
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
glLoadIdentity()
glDisable(GL_LIGHTING)
glEnable(GL_TEXTURE_2D)
#glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glPushMatrix()
glTranslatef(self.x, self.y, self.z)
glRotate(-self.rZ/3,0,0,1)
glRotate(-self.rX/3,1,0,0)
glColor4f(1.0, 1.0, 1.0,1.0)
glBindTexture(GL_TEXTURE_2D,self.tutorial_texture.texID)
glBegin(GL_QUADS)
glTexCoord2f(0.0,1.0)
glVertex3f(-1.0, 1.0,0.0)
glTexCoord2f(1.0,1.0)
glVertex3f(1.0, 1.0,-1.0)
glTexCoord2f(1.0,0.0)
glVertex3f(1.0, -1.0,0.0)
glTexCoord2f(0.0,0.0)
glVertex3f(-1.0, -1.0,1.0)
glEnd()
glBegin(GL_LINES)
glColor(1,17,0)
glVertex(0,0,0)
glVertex(3,0,0)
glColor(1,0,1)
glVertex(0,0,0)
glVertex(0,3,0)
glColor(0,1,1)
glVertex(0,0,0)
glVertex(0,0,3)
glEnd()
glPopMatrix()
def Input(self,fl):
#mpb=pygame.mouse.get_pressed() # mouse pressed buttons
kpb=pygame.key.get_pressed() # keyboard pressed buttons
msh=pygame.mouse.get_rel() # mouse shift
if kpb[K_ESCAPE] or kpb[K_q]:
self.done=True
if kpb[K_UP]:
self.y+=0.1
if kpb[K_DOWN]:
self.y-=0.1
if kpb[K_RIGHT]:
self.x+=0.1
if kpb[K_LEFT]:
self.x-=0.1
if fl: self.rZ-=msh[0]/3; self.rX-=msh[1]/3
def __init__(self):
glOrtho(0, 800, 0, 600, 0.0, 100.0)
video_flags = OPENGL|DOUBLEBUF|RESIZABLE
pygame.init()
pygame.display.set_mode((800,800), video_flags)
pygame.display.set_caption("www.jason.gd")
self.resize((800,800))
self.init()
fl=0
clock = pygame.time.Clock()
while 1:
for event in pygame.event.get():
if event.type == QUIT or self.done:
pygame.quit ()
break
if event.type==MOUSEBUTTONDOWN:
if event.button==4: self.z+=0.1
if event.button==5: self.z-=0.1
if event.button==2: fl=1
if event.type==MOUSEBUTTONUP:
if event.button==2: fl=0
if event.type==VIDEORESIZE: self.resize((event.w,event.h))
self.Input(fl)
self.draw()
pygame.display.flip()
#limit fps
clock.tick(self.demandedFps)
if __name__ == '__main__': Main()
When I tried to use bigger(512x512 px) textures, it worked fine.
How can I let the OpenGL to DO NOT mix the pixel borders? Or- the PyGame did this?
What you see here is the GL_LINEAR texture magnification mode (aka "bilinear filtering", which your code explicitely requests) in combination with the default GL_REPEAT texture coordinate repetition at the borders.
I'm not 100% sure which one of the two things you don't want.
You might try changing GL_LINEAR to GL_NEAREST:
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST)
and/or adding
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE)

Pygame + OpenGL - how to draw text after glBegin()?

I found somewhere on StackOverflow this cross-platform way to draw text:
def drawText(x, y, text):
position = (x, y, 0)
font = pygame.font.Font(None, 64)
textSurface = font.render(text, True, (255,255,255,255),
(0,0,0,255))
textData = pygame.image.tostring(textSurface, "RGBA", True)
GL.glRasterPos3d(*position)
GL.glDrawPixels(textSurface.get_width(), textSurface.get_height(),
GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, textData)
The problem is that I cannot call drawText after I called glBegin(GL_QUADS). How can I create a rectangle and texture it with the text's contents, then display it so that this drawText could be called even after glBegin?
I found that I can't change the current texture inside of glBegin, so I had to redesign parts of my code. Here's an example of using pygame to create the texture, based on Python version of Nehe's tutorial, lesson 6:
#!/usr/bin/env python
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
import pygame
ESCAPE = '\033'
window = 0
texture = 0
A_TEX_NUMBER = None
B_TEX_NUMBER = None
def GenTextureForText(text):
font = pygame.font.Font(None, 64)
textSurface = font.render(text, True, (255,255,255,255),
(0,0,0,255))
ix, iy = textSurface.get_width(), textSurface.get_height()
image = pygame.image.tostring(textSurface, "RGBX", True)
glPixelStorei(GL_UNPACK_ALIGNMENT,1)
i = glGenTextures(1)
glBindTexture(GL_TEXTURE_2D, i)
glTexImage2D(GL_TEXTURE_2D, 0, 3, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, image)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL)
return i
def InitGL(Width, Height):
global A_TEX_NUMBER, B_TEX_NUMBER
pygame.init()
A_TEX_NUMBER = GenTextureForText("a")
B_TEX_NUMBER = GenTextureForText("b")
glEnable(GL_TEXTURE_2D)
glClearColor(0.0, 0.0, 0.0, 0.0)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(45.0, float(Width)/float(Height), 0.1, 100.0)
glMatrixMode(GL_MODELVIEW)
done = 1
def DrawGLScene():
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glLoadIdentity()
glTranslatef(0.0,0.0,-10.0)
glBindTexture(GL_TEXTURE_2D, B_TEX_NUMBER)
glBegin(GL_QUADS)
glTexCoord2f(0.0, 0.0); glVertex3f(-1.0, -1.0, 1.0)
glTexCoord2f(1.0, 0.0); glVertex3f( 1.0, -1.0, 1.0)
glTexCoord2f(1.0, 1.0); glVertex3f( 1.0, 1.0, 1.0)
glTexCoord2f(0.0, 1.0); glVertex3f(-1.0, 1.0, 1.0)
glEnd()
glutSwapBuffers()
def keyPressed(*args):
if args[0] == ESCAPE:
glutDestroyWindow(window)
sys.exit()
def main():
global window
glutInit("")
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
glutInitWindowSize(640, 480)
glutInitWindowPosition(0, 0)
window = glutCreateWindow("Jeff Molofee's GL Code Tutorial ... NeHe '99")
glutDisplayFunc(DrawGLScene)
glutIdleFunc(DrawGLScene)
glutKeyboardFunc(keyPressed)
InitGL(640, 480)
glutMainLoop()
print "Hit ESC key to quit."
main()

Spot light shining on a flat surface

I want to shine a nice spotlight on a flat surface. I know that lighting is done per vertex and thus have create may vertices on the surface -- see this answer. However, I am getting these -- with GL_QUADS and GL_LINE_STRIP just to check that I have done things correctly.
These are clearly rather poor. so,
What need I chance so that the spotlight appears more like a circle on the surface?
How can I draw this scene faster?
Note: I realise that the normal calculation is not strictly necessary in this case but in a general case, it would be needed. Also, I could use a display list for the surface so it was only drawn once.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from OpenGL.GLUT import *
from OpenGL.GL import *
from OpenGL.GLU import *
import numpy as np
from Numeric import *
lightPosition = np.array([10, 30, 20, 1])
view_rotation = np.array([0, 0, 0])
def init():
globAmb = [0.3, 0.3, 0.3, 1.0]
lightAmb = [0.0, 0.0, 0.0, 1.0]
lightDifAndSpec = [0.7, 0.7, 0.7, 1.0]
glutInit()
glClearColor(0.0, 0.0, 0.0, 0.0)
glEnable(GL_DEPTH_TEST)
glClearDepth(1.0)
glDepthFunc(GL_LESS)
glShadeModel(GL_SMOOTH)
glEnable(GL_LIGHTING)
glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmb)
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDifAndSpec)
glLightfv(GL_LIGHT0, GL_SPECULAR, lightDifAndSpec)
glEnable(GL_LIGHT0)
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, globAmb)
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE)
glEnable(GL_CULL_FACE)
glCullFace(GL_BACK)
def display():
glClearColor(0.0, 0.0, 0.0, 0.0)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glLoadIdentity()
gluLookAt(0.0, 40.0, 40.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glRotatef(view_rotation[0], 1.0, 0.0, 0.0)
glRotatef(view_rotation[1], 0.0, 1.0, 0.0)
glRotatef(view_rotation[2], 0.0, 0.0, 1.0)
glPushMatrix()
pos = [0, 20, 0, 1]
direction = [0.0, -1.0, 0.0]
spotAngle = 20
glLightfv(GL_LIGHT0, GL_POSITION, pos)
glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, spotAngle)
glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, direction)
glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, 2)
glPushMatrix();
glDisable(GL_LIGHTING)
glTranslate(pos[0], 0.5* pos[1], pos[2])
glRotatef(-90.0, 1.0, 0.0, 0.0)
glColor3f(1.0, 1.0, 1.0)
PI = 3.141592
glutWireCone(3.0 * np.tan( spotAngle/180.0 * PI ), pos[1], 10, 6)
glEnable(GL_LIGHTING)
glPopMatrix();
draw_cube()
glPopMatrix()
glFlush ()
def reshape(w, h):
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(45.0, float(w) / float(h), 0.1, 100.0)
glMatrixMode(GL_MODELVIEW)
def keyboard(key, x, y):
if key == chr(27):
sys.exit(0)
elif key == 'w':
view_rotation[0] += 10
display()
elif key == 's':
view_rotation[0] -= 10
display()
elif key == 'a':
view_rotation[1] -= 10
display()
elif key == 'd':
view_rotation[1] += 10
display()
else:
print "Unknown %s key" %(key)
def draw_cube ():
glPushMatrix()
glRotatef(45, 0, 1, 0)
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, [183/256.0, 65/256.0, 14/256.0, 1.0]);
glMaterialfv(GL_FRONT, GL_SPECULAR, [1, 1, 1, 1]);
glMaterialfv(GL_FRONT, GL_SHININESS, [100.0]);
sz = 10
step = 1
for x in arange(-sz, sz, step):
for z in arange(-sz, sz, step):
v0 = np.array([x, sz, z])
v1 = np.array([x, sz, z+step])
v2 = np.array([x+step, sz, z+step])
v3 = np.array([x+step, sz, z])
#glBegin(GL_QUADS) # Uncomment to get the surface instead of lines.
glBegin(GL_LINE_STRIP)
n = get_normal_vector(v0, v1, v3)
glNormal(n[0], n[1], n[2])
glVertex3f(v0[0], v0[1], v0[2])
n = get_normal_vector(v1, v2, v0)
glNormal(n[0], n[1], n[2])
glVertex3f(v1[0], v1[1], v1[2])
n = get_normal_vector(v2, v3, v1)
glNormal(n[0], n[1], n[2])
glVertex3f(v2[0], v2[1], v2[2])
n = get_normal_vector(v3, v0, v2)
glNormal(n[0], n[1], n[2])
glVertex3f(v3[0], v3[1], v3[2])
glEnd()
glPopMatrix()
def get_normal_vector (v1, v2, v3):
v = np.cross(v2-v1, v3-v1)
n = np.sqrt(np.dot(v, v.conj()))
if n:
return v/n
else:
print v1
print v2
print v3
print v/n
sys.exit(-1)
glutInit(sys.argv)
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowSize(800, 800)
glutInitWindowPosition(300, 0)
glutCreateWindow('Lines')
init()
glutDisplayFunc(display)
glutReshapeFunc(reshape)
glutKeyboardFunc(keyboard)
glutMainLoop()
PS: I will update an answer with the source code using a shader when I have it working...
Use a fragment shader to render the spotlight. This is also the fastest way you can render the scene because you won't be increasing tessellation, yet get the highest quality lighting.
Hope this helps!

uv mapping python OpenGL triangles

Im trying to display a simple immediate mode sets of textured polygons with pyOpenGL with no luck. I have lashed together some code that loads a some geometry data and that all works fine and as far as I can tell I have all the code to add a texture to it but just getting white polys.
Here's the important bits of the code:
self.img = PIL.Image.open('/projects/openGL_robot_face/facemap.png')
self.image_data = numpy.array(list(self.img.getdata()), numpy.uint8)
def paintGL(self):
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
texture = glGenTextures( 1)
glPixelStorei(GL_UNPACK_ALIGNMENT,1)
glBindTexture(GL_TEXTURE_2D, texture)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, self.img.size[0], self.img.size[1], 0, GL_RGB, GL_UNSIGNED_BYTE, self.image_data)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glTranslate(0.0, 0.0, -50.0)
glScale(20.0, 20.0, 20.0)
glRotate(self.yRotDeg, 0.2, 1.0, 0.3)
glTranslate(-0.5, -0.5, -0.5)
glBegin(GL_TRIANGLES)
for vert in self.poly_verts:
glTexCoord2f(vert[6], vert[7])
glVertex3f(vert[0], vert[1], vert[2])
glEnd()
Have you enabled textures in OpenGL, using :
glEnable(GL_TEXTURE_2D)
Also, you should not create the texture on each Paint call, you should create it once and for all (with glGenTextures, and glTex*), then store the texture ID, and do the strict minimum during Paint, which is binding with the texture.
def paintGL(self):
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glEnable(GL_TEXTURE_2D)
glBindTexture(GL_TEXTURE_2D, texture)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glTranslate(0.0, 0.0, -50.0)
glScale(20.0, 20.0, 20.0)
glRotate(self.yRotDeg, 0.2, 1.0, 0.3)
glTranslate(-0.5, -0.5, -0.5)
glBegin(GL_TRIANGLES)
for vert in self.poly_verts:
glTexCoord2f (vert[6], vert[7]);
glVertex3f(vert[0], vert[1], vert[2])
glEnd()
glDisable(GL_TEXTURE_2D)
Unfortunately I cannot try the answer right now so this is purely from the top of my head.
You could probably benefit from this previous post :
Render a textured rectangle with PyOpenGL

Categories