7
$\begingroup$

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!

$\endgroup$
5
  • 1
    $\begingroup$ 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. $\endgroup$
    – glampert
    Commented Sep 6, 2015 at 19:12
  • 2
    $\begingroup$ 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. $\endgroup$ Commented Sep 7, 2015 at 0:01
  • 1
    $\begingroup$ What do you mean by 256*256*256? what is the third number? $\endgroup$ Commented Sep 7, 2015 at 9:44
  • $\begingroup$ @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. $\endgroup$ Commented Sep 8, 2015 at 20:44
  • $\begingroup$ 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 $\endgroup$ Commented Sep 9, 2015 at 13:19

1 Answer 1

6
$\begingroup$

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]

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$
    – Alan Wolfe
    Commented Sep 6, 2015 at 20:43
  • $\begingroup$ Well, OpenGL3 enforces 48 as I have mentioned. There might be a higher minimum in practice of course. Or did I misunderstand you? $\endgroup$
    – Wumpf
    Commented Sep 6, 2015 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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