I want to create a texture at run time, such that the RGBA values of pixels of my texture depends on the surface normals of a triangular mesh.
I already have a triangular mesh, and its moving like a sine wave. I want to texture it based on its orientation in space.
I have been through some tutorials but my prob;em is that, I am unable to decide and dont have much understanding about what texture parameters should I pass to make this texture. (in function glTexParameterX() and TexEnvX ())
Can you please direct me to related tutorial to give some sudo code to start with.
GL_CLAMP, GL_CLAMP_TO_EDGE should be good. Also GL_NEAREST for minification and magnification (no mipmap values for the latest).
What should be the parameter in
GL_MODULATE or GL_REPLACE probably, depending on whether you want lighting to have an effect on the textured surface - this is not different for a generated texture than for one loaded from an image file though.
pixels of my texture depends on the surface normals of a triangular mesh
why not use vertex colors for this (it sounds as if you are updating the vertex positions/normals every frame, you might as well update vertex colors while you are at it)? If you happen to use shaders you don’t even need those, but you can compute the color from the normal direction on the fly.
Yes, I am updating the vertex positions every frame, and yes I want lighting to have effect on textured surface, but I am not updating the vertex colors(might be this is right thing to do but I don’t know other way around) because I have textured the mesh with an image of water surface and now I want to blend reflections when the wave moves.
So , I want create new texture of wave movement updated at each frame and blend it with the first texture.
Also, how do I get new boxes for Quote: and code: while writing a post,I looked for the tool but couldn’t find around.