Rendering a texture with material properties


I have a triangle mesh with previously assigned texture coordinates.I want to assign the texture with material properties of the surface.I can do rendering a model to a texture but not material properties.Thanks in advance.

Hmm… What you need to read about are the combiner functions in OpenGL.

Here’s a page about lighting and textures, which should explain some of the problems I think you are seeing / trying to overcome.

Depending on what version of OpenGL you are using (you don’t say) there are various texture combiner functions that allow you to mix primary colours, and apply certain affects to one or more texture and then mix the result in the final output. This can be used with a normal texture and it’s corresponding normal map to produce bump mapping, for example.

Here is a wiki that has some info (do be aware that if you are on GL3.x then this has all changed / been deprecated), but from your question I am assuming you are using the fixed function pipeline still, so must be pre 3.x, or running a compatibility layer.

sorry for not giving much information.I m using shaders and i want to encode the material properties into a texture.

Your best bet is to check out either the LightHouse3D OpenGL site, or the Orange Book companion site ( Even better, buy The Orange Book! :slight_smile:

On those sites there are examples of how to do similar functions to the Fixed Function Combiners, which is what you need. :slight_smile: