Hallo,
is there a way to define and use a second texture like as easy as the first:
def LoadTexture():
import Image
im = Image.open("textures/abc.bmp")
image = im.tostring("raw", "RGBX", 0, -1)
glBindTexture(GL_TEXTURE_2D, glGenTextures(1))
glPixelStorei(GL_UNPACK_ALIGNMENT,1)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, image)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
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)
Of course I start the function in the init-part …
this is the object in my DisplayFunction:
glBegin(GL_QUADS)
glTexCoord2f(0.0, 0.0); glVertex3f(-0.064, 0.064, 0.0)
glTexCoord2f(1.0, 0.0); glVertex3f( 0.064, 0.064, 0.0)
glTexCoord2f(1.0, 1.0); glVertex3f( 0.064, -0.064, 0.0)
glTexCoord2f(0.0, 1.0); glVertex3f(-0.064, -0.064, 0.0)
glEnd()
How to define and use a second texture mapped on another object in the DisplayFunction ?