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


Multiple coloured layers / textures

Recommended Posts

This should be a simple question to all those DirectX guru''s out there. I''m in the midst of creating my directx based backend for my engine, and I have already completed my Opengl one. It is all based on a simple surface scripting language (aka shaders), and it supports layers - which are loosely deemed to be rendering passes. In these layers you can assign colour values from the surface, internal engine colour array, a constant colour, or some other function that generates a colour. Now in opengl this was simple to render, just make an array of the necessary size and pass it to the rendering API through the glColorPointer function. But in directX I can only seem to be able to specify only one colour array or one colour value per point / vertex. And thus my rendering loop would have to assign colour values replcing the existing one''s in the Vertex buffer each iteration through the main rendering loop (i.e. where I used to put glColorPointer). Now one way that I see to do this in DX is to omit the color info from the Vertexbuffer, and instead specify a material each time. So the loop would be: (OpenGL) for each layer in surface setcolour[layer] settexture[layer] setvertecies setnormals ... etc drawelements (directx) setstream settexture setmaterial is this the only way? or does anyone know a funkier way of doing more than one colour in the whole surface by say using either pixel or vertex shaders? Dæmin (Dominik Grabiec)

Share this post

Link to post
Share on other sites