PDA

View Full Version : Sending texture to a shader



Mctittles
09-27-2011, 01:39 PM
I would like to use a noise texture as a reference to modify the colors of an existing texture with a fragment shader.

Is the only way to send the noise texture to the shader is by creating a multi-textured object and accessing gl_MultiTexCoord0, and gl_MultiTexCoord1 or can I somehow send the noise texture through a variable?

mhagain
09-27-2011, 01:49 PM
There's a built-in noise function but that may or may not be implemented in hardware. Otherwise - what's wrong with the multitextured approach anyway?

Mctittles
09-27-2011, 02:05 PM
I suppose not much wrong with it. Just wasn't sure if that's the only way to do it. Would be a little less code to only send the textureID instead of doing the setup for multi-texture.

carsten neumann
09-27-2011, 03:34 PM
You don't need multiple texture coordinate sets to access multiple textures in a shader, i.e. you can use gl_MultTexCoord0 to access all active textures of the shader.