Jump to content
  • Advertisement
Sign in to follow this  
shodanjr_gr

GLSL: Stupid question about emulating fixed pipeline

This topic is 3893 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

Im getting into GLSL, and i want to write a pair of shaders for emulating the fixed pipeline functionality. Im kinda stuck at the point when the texture coordinates are transformed inside the vertex shader. gl_TexCoord = gl_TextureMatrix * gl_MultiTextureCoordi; This is supposed to happen for every set of texture coordinates up to gl_MaxTextureCoords, right? (which i would assume varies from app to app). How am i supposed to iterate the set of gl_MultiTextureCoords from 0 to gl_MaxTextureCoords, if they arent in an array? I guess this is more of a C/C++ question than a GLSL question, but it might be that i am missing something really obvious. Thanks in advance! PS: Is there a mirror for the ShaderGen framework? 3dLabs seems to have made it disappear from their website.

Share this post


Link to post
Share on other sites
Advertisement
You should only be manipulating the data that you actually need. So if your primary shader has two textures, then only manipulate the first two texture coordinates and make sure they are initialized properly in the app.

You shouldn't try to make one size fits all shaders, just make the few exclusively different shaders that you will actually need.

So the array isn't accesed via a variable and a loop. It's accessed with constants.

gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTextureCoord0;
gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTextureCoord1;

Most of your shaders will expect the texture matrix to be identity, so typically this computation can be excluded.

Share this post


Link to post
Share on other sites
Quote:
Original post by bzroom
You should only be manipulating the data that you actually need. So if your primary shader has two textures, then only manipulate the first two texture coordinates and make sure they are initialized properly in the app.

You shouldn't try to make one size fits all shaders, just make the few exclusively different shaders that you will actually need.


Thanks for the speedy reply :)

I understand your reasoning, and that's what i will be doing in shaders related to my actual work. But im trying to get as generic as possible in emulating fixed functionality.

Is it just not possible to do it? Or is it just considered bad coding?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!