OpenGL compared with DX Materials

Started by
5 comments, last by the_cyberlord 19 years, 5 months ago
So in DirectX, the "preferred" way to do color of primitives is to set a material. Is there an equivalent to this in OpenGL? The reason I'm asking is my friends and I are designing an engine, and we want to support both OpenGL and D3D. Thanks. -Nick
Advertisement
There are materials in OpenGL too, just like the DirectX ones I suppose.
google for glMaterial();
And you'd better buy yourself a book if you want to know all the things possible, especially those needed for a DirectX/OpenGL choosable Graphics library.
a book is a very good idea, The Red Book is a fantasic guide and depending on your level of knowledge you might want to get Beginning OpenGL Game Programming by our very own Dave Astle and Kevin Hawkins [grin]
Sweet. So with OpenGL materials, do you not specify a color for each vertex like in DX?
Quote:Original post by nickwinters
Sweet. So with OpenGL materials, do you not specify a color for each vertex like in DX?

That depends, OpenGL materials offer a lot of possibilities. They were initially designed to work with OpenGL's hardware lighting, you can use glColorMaterial to specify material properties per vertex.

Please keep in mind that the whole notion of OpenGL and Direct3D materials has become obsolete with the introduction of vertex and fragment shaders, where surface properties are defined in terms of shaders and custom shader parameters.
Beware, 'Beginning OpenGL Game Programming' doesn't explain all the functions very good, but it brings structure in what you could have learned from tutorials. The autors preceding book, 'OpenGL Game Programming' is much more complete, but much bigger and a bit more expensive.

EDIT: I think you need special hardware support for these, or isn't it?

This topic is closed to new replies.

Advertisement