1

I'm trying to do some GLSL particle stuff with precomputed velocity vector fields. These vector fields are stored as ~13 1024x170 float textures, each corresponding to a different "slice" in the z-plane. Ideally, I'd like to load these as a 3D texture with dimensions 1024x170x13, to allow automatic interpolation in my shader, but my local implementation gives a GL_MAX_3D_TEXTURE_SIZE of 256, which means (if I understand correctly) that my maximum size in each dimension is 256, so that won't work.

So, my next step was to try to use a GL_TEXTURE_2D_ARRAY, and do the interpolation between planes in the shader. Unfortunately, pyglet doesn't appear to expose this functionality (??):

Traceback (most recent call last):
  File "particle_trace.py", line 67, in <module>
    load_vectortex3d(f, tex)
  File "particle_trace.py", line 56, in load_vectortex3d
    glBindTexture(GL_TEXTURE_2D_ARRAY, tex)
NameError: global name 'GL_TEXTURE_2D_ARRAY' is not defined

My next step is to bind all of the textures separately, pass them all independently to the shader, and do my computations there. But... am I barking up the wrong tree here? Surely there must be a better way to do this.

  • I'd certainly recommend not making a collection of individual textures, but rather combining all 13 textures into a single texture, with the textures "stacked" in the _t_ direction. In your shader, you could try sampling the texture twice, modifying the _t_ coordinate to index into the appropriate image. Of course, this technique isn't great if you're using bilinear filtering mode, as you'll run into issues sampling along the edges of your images (i.e., the boundaries along their horizontal edges). – radical7 Mar 27 '13 at 22:41
  • Have you tried upgrading Pyglet to a version that has been updated in the last 5 years (that's how long it's been since array textures were added to core OpenGL)? Or perhaps using a Python OpenGL implementation that is even remotely current with OpenGL? – Nicol Bolas Mar 28 '13 at 00:44
  • @radical7 Thanks for the tip, that's of course much better than using individual textures. – user2217644 Mar 28 '13 at 22:46
  • @NicolBolas I'm using pyglet 1.1.4 provided by my package manager, which appears to be the most current stable release. The documentation states that it exposes "all" of the OpenGL functions. Does this mean my driver (nouveau) doesn't support this functionality, but that it would work if I used the same code on a different machine/switch drivers? – user2217644 Mar 28 '13 at 22:48

0 Answers0