Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Texture Atlas Indexing with Texture

This topic is 2121 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm looking for any tips, pointers, resources, etc. concerning the use of a sort of atlas indexing texture, representing a scene for example, where each texel indicates a particular texture in an atlas texture... and doing this in OpenGL, using GLSL. I'm very familiar with GL itself, and have done a few neat things in GLSL, but consider my experience rather limited.


There are two ways that I see going about this. The index texture could either simply index the atlas one-dimensionally, with only one color component (unsigned byte), minimizing the index texture's size, which is ideal if it needs refreshing for animation or any sort of dynamic features. Translating the texel index byte into UV coordinates would be a simple affair carried out on the GPU. I'm unclear as to the method by which I could even access a texture (via sampler2/3D) as an unsigned integer value, as opposed to a floating point value from 0.0 to 1.0.. Sure I could multiply by 255, but is this necessary?


The other option would be to store the actual UV coordinates to the origin of an indexed texture contained in the atlas, which is (in my mind) a more CPU based approach. More bandwidth would be used transferring the atlas-indexing texture to the GPU for dynamic scene purposes, having more data, etc..


I'm just trying to figure a balance between simplicity and efficiency, and my lacking know-how with GLSL is limiting me to mere trial-and-error, but I figured I may as well try to look for any advice from more experienced GPU programmers on this.


Just a side note, the index texture itself would not be very large, smaller than a single 'tile' in the atlas. I was also wondering about utilizing a buffer texture object (http://www.opengl.org/wiki/Buffer_Texture), which seems to be better suited for what I'd like to accomplish here. The primary goal is minimizing the actual geometry being drawn to, ideally, a simple primitive with the index texture mapped to that the GPU utilizes to plot the various texture tiles from the atlas onto the primitive. So, each index texture texel would be a texture tile from the atlas.


Any advice, pointers, tips, links, etc.. are much appreciated. It may seem like I have it all figured out, but I really just have the jist of it down and would like some more detailed technical information about doing this sort of thing. Thanks.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!