Archived

This topic is now archived and is closed to further replies.

ArnoAtWork

Apply materials(shaders)

Recommended Posts

To apply shaders on polygons, a good approach is to index a shader per polygon. This shader is defined with a VS, a texture, a PS. Using vertex or pixel shader, it''s really easy to map a file(.txt or compiled file) at each shader. When program loads, it just have to load each file and apply them on different material. But in my case, I have a GeForce2 and I can''t using PS, so I have to call "normal" functions to map texture, ... How can I implement a structure of material able to support vertex shader, opengl functions, d3d functions and maybe one day, pixel shader. Thanks a lot.

Share this post


Link to post
Share on other sites
quote:
Original post by ArnoAtWork
How can I implement a structure of material able to support vertex shader, opengl functions, d3d functions and maybe one day, pixel shader.



Take a look at Nvidia''s CgFX and/or DirectX''s HLSL+effects.
Don''t roll your own.

Do you _really_ need to be cross-API compatible? It will cost you major PITA all along the way, with very little (frankly, I can see none) real advantage. Just make up your mind, pick one of the APIs and get working. There are numerous evidences that both are good enough :-)

Share this post


Link to post
Share on other sites