PyOpenGL- 1D Automatic Tex Gen supported?
mark at sabinosoft.com
Sun Feb 2 18:26:18 CET 2003
Hi, I'm trying to apply a stripe to an image, like the striped teapot
example in the Red Book Example 9-8. I've followed example 9.8 as
closely as possible, adapting for Python as necessary, and can't get
any reasonable results.
The image does change when I apply this texture- it's doing
*something*- but the stripe is the wrong color and appears to be
interpolated, plus the orientation and spacing is not correct.
It could be a type issue, although I've tried different formats.
I have used 2D automatic texture generation with PyOpenGL
successfully. Does anyone know whether 1D is fully supported?
Here's my stripped-down code- any ideas are appreciated!
stripeWidth = 4
stripeImage = array.array('B', [0,0,0,255, 0,0,0,255, 0,0,0,255,
255,255,255,255]) # we'll spec RGBA format in glTexImage1D
tex = glGenTextures(1)
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, stripeImageWidth, 0, GL_RGBA,
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); # tried
# make a slanted object plane- should be able to see *something* like
sp = 0.1 # I've tried a range of spacings
plane = (sp, sp, sp, 0.0)
glTexGenfv(GL_S, GL_OBJECT_PLANE, plane);
Thanks for any help,
More information about the Python-list