Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is texture data accessed on the GPU in OpenGL?

I don't fully understand the way texture data is accessed on the GPU. If possible - could anyone explain these?

  1. When the number of texture units is limited, does this limit the number of textures I can generate using glGenTextures() and upload to the GPU using glTexImage2D()? Or does it only limit the number of texture units which can be bound using glBindTexture()?

  2. What I'd really like to do is to be able to upload all my textures to the GPU - even if there are more than the number of available texture units. When a texture is needed I would just bind it to the texture unit using glBindTexture(). Is this possible?

like image 963
user1081465 Avatar asked Oct 08 '22 08:10

user1081465


1 Answers

Ad. 1. Texturing units is equal to the number of textures you can bind simultaneously.

Ad. 2. That is precisely the way to go - you upload as many textures as you like and bind only the ones needed for your current draw call. It's one of the jobs of the GPU driver to automatically page the required data (i.e. the texels of the textures currently bound) to and from the GPU's and the system's RAM.

like image 140
IneQuation Avatar answered Oct 13 '22 12:10

IneQuation