Skip to main content
gamedev.net
🔒 Locked

Apply materials(shaders)

Started by ArnoAtWork 0 replies 350+ views
Original Post
ArnoAtWork
ArnoAtWork
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.
assen
assen
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 :-)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.