Jump to content

  • Log In with Google      Sign In   
  • Create Account


OpenGL using data outside texture coordinates range when enabling filtering


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 ProtectedMode   Members   -  Reputation: 1165

Like
0Likes
Like

Posted 06 April 2014 - 04:29 AM

I couldn't find anything about my issue online, maybe because I don't know how to express my question.

 

I'm using a tilemap to use different textures during the same draw call. But when I enable for example linear filtering instead of using nearest, my textures start to look weird. The filtering seems to take pixels from outside the specified area (using texture coordinates)...

 

Is there an easy solution for this that doesn't involve hacking? Maybe an option to specify that it will use the texels from the other side of the specified region instead of the texel outside of the specified texture "range"?



Sponsor:

#2 Chris_F   Members   -  Reputation: 2232

Like
1Likes
Like

Posted 06 April 2014 - 05:44 AM


Is there an easy solution for this that doesn't involve hacking?

 

Absolutely. Use an array texture. They've been available since OpenGL 3.0.



#3 ProtectedMode   Members   -  Reputation: 1165

Like
0Likes
Like

Posted 06 April 2014 - 06:01 AM

 


Is there an easy solution for this that doesn't involve hacking?

 

Absolutely. Use an array texture. They've been available since OpenGL 3.0.

 

 

Thanks for your reply. smile.png I haven't heard of array textures before, I'm pretty new to OpenGL.

 

 

but be aware that if you are limited by the number of hardware texture units, you may still be better off using atlases (perhaps even in conjunction with array textures).

This quote from the page you linked suggests however that you're still limited by the number of hardware texture units. I want to have the possibility of more than a hundred different textures but as most GPU's only support 32 or so (according to some pages I found), I doubt if this is a solution... Am I wrong?



#4 haegarr   Crossbones+   -  Reputation: 4172

Like
0Likes
Like

Posted 06 April 2014 - 09:27 AM


This quote from the page you linked suggests however that you're still limited by the number of hardware texture units. I want to have the possibility of more than a hundred different textures but as most GPU's only support 32 or so (according to some pages I found), I doubt if this is a solution... Am I wrong?

A single array texture (GL_TEXTURE_2D_ARRAY in your case) is bound to a single texture unit / sampler. It is not so that you allocate more than a single unit because the array texture has more than 1 slice.

 

But notice that 1D /2D array textures have (may have, at least) another maximal size compared to "ordinary" 1D / 2D textures. On my computer, for example, an array texture can be as big as 2k by 2k texels by 2k slices, while a 2D texture can be as big as 8k by 8k texels. Use the following getters to be informed about the respective texture sizes:

   ::glGetIntegerv(GL_MAX_TEXTURE_SIZE, &intValue);
   ::glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE, &intValue);
   ::glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &intValue);

Edited by haegarr, 06 April 2014 - 09:29 AM.


#5 ProtectedMode   Members   -  Reputation: 1165

Like
0Likes
Like

Posted 06 April 2014 - 09:56 AM

Thank you both! I think this wil work. My textures will generally only be 32 by 32 so that's definitely enough. smile.png






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS