I'm making a voxel engine in OpenGL and wondering how many 3D textures I can have at once. They are fairly large (256x256x256 in GL_R32UI format). I want it to be able to run on any graphics card supporting OpenGL 3.3, if possible. I'm accessing them all from the same fragment shader, by the way. So how many can I have? Will 8 work? Thanks!

  • 1
    I'm fairly certain that these values are hardware/version specific, but there are minimum values that an implementation must support. You can query them with glGet. – glampert Sep 6 '15 at 19:12
  • 2
    Note that the textures you've described are 64 MB each, so you may get limited by available VRAM before you hit API limits on the number of textures. 8 textures = 512 MB, so should be fairly safe, but many older cards or mobile cards only have 1 or 2 GB of VRAM, so you won't be able to go much more than 8 of these textures and still have VRAM left over for anything else. – Nathan Reed Sep 7 '15 at 0:01
  • 1
    What do you mean by 256*256*256? what is the third number? – Zich Sep 7 '15 at 9:44
  • @Iman it's a 3d texture rather than a 2d texture - if you want more info you could ask a separate question if you like. – trichoplax Sep 8 '15 at 20:44
  • I never heard such a thing, I thought textures are 2D (u,v) raster map that draped on 3d objects, however I take a look at tutorials and I become familiar with the concept. Thanks for your tip Terry – Zich Sep 9 '15 at 13:19
up vote 6 down vote accepted

As gllampert pointed out in the comments the value is hardware dependent. You can retrieve it with glGet, using GL_MAX_COMBINED_TEXTURE_IMAGE_UNIT. You can find how different hardware performs here.

However, in OpenGL 3 there is a lower bound of at least 48 simultaneously used textures, no matter which type. [source]

  • Also as glampert hinted, you want to find the minimum that must be supported, because that is the amount you can actually rely on, on all hardware. – Alan Wolfe Sep 6 '15 at 20:43
  • Well, OpenGL3 enforces 48 as I have mentioned. There might be a higher minimum in practice of course. Or did I misunderstand you? – Wumpf Sep 6 '15 at 20:45

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.