Jump to content

  • Log In with Google      Sign In   
  • Create Account


Textures and sampler states


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
3 replies to this topic

#1 doesnotcompute   Members   -  Reputation: 252

Like
0Likes
Like

Posted 08 April 2011 - 02:04 PM

Since texture parameters are bound to a particular texture object in OpenGL, if you want to use the same texture in two places with different sampler settings (assuming pre-3.0 so no sampler objects) you have to create two different texture objects. Does anyone know if there's a way to at least let these two objects share the same underlying data or do you have to physically duplicate *all* data?

Sponsor:

#2 Danny02   Members   -  Reputation: 275

Like
1Likes
Like

Posted 08 April 2011 - 02:14 PM

no I think only with Opengl4 this is possible atm
u just have to create some data structures in your engine/renderer in which u can save texture parameters and then before using a texture enable all these saved parameters

#3 V-man   Members   -  Reputation: 797

Like
0Likes
Like

Posted 08 April 2011 - 02:40 PM

You need at least GL 3.3. Look up page 137 of the spec file. It is about Sampler Objects.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

#4 doesnotcompute   Members   -  Reputation: 252

Like
0Likes
Like

Posted 08 April 2011 - 02:48 PM

no I think only with Opengl4 this is possible atm
u just have to create some data structures in your engine/renderer in which u can save texture parameters and then before using a texture enable all these saved parameters


Yeah that occurred to me. I just wonder what kind of overhead there is (if any) to constantly changing the texture parameters for a texture. If it's trivial (say, as much as for any other state change) this would work perfectly.




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