3D Textures

Started by
3 comments, last by Geometrian 14 years, 10 months ago
Hello, I asked this question on IRC, with no success. I'm trying to get 3D texturing working. For simplicity, I'm starting with a white texture, which I tried creating with NumPy. The relevant calls:

data = numpy.ones((64*64*64*3)).tostring()
glTexImage3D(GL_TEXTURE_3D,0,GL_RGB,64,64,64,0,GL_RGB,GL_UNSIGNED_BYTE,data)
I'm drawing a box with appropriate 3D texture coordinates, and I'm getting the result: Why isn't the box white? Thanks, -Geometrian

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

Advertisement
It just looks like your data is wrong. Seems like it is offset or something. I assume the texture is white?

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

The texture data is created with line 1 of the code I provided. It creates an array of 1.0's 6433 long, and then converts it to a string.

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

The problem seems to be solved. After much deliberation, I found that
data = Numeric.array([255.0,255.0,255.0]*(64*64*64*3),"uint8")
seems to work.

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

Alrighty, one more thing. There seems to be a z-fighting-esque problem on the surface of the box. I'm pretty sure it's not z-fighting. What's going on? It's using a new texture that's 2 on a side.

Thanks,
-G

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

This topic is closed to new replies.

Advertisement