Hi,
I have a scene containing a 3d texture cube and a few basic primitives (lines, squares…). I have no problem in rendering each primitive individually. What is the best way to render all the primitive in the scene in shaders? Is the following fragment shader possible?
uniform float Primitive_Id;
varying float LightIntensity;
void main()
{
if (Primitive_Id == 0)
{
vec4 color = texture1D(oPalette3d, texture3D(oTexture3d, gl_TexCoord[0].xyz));
gl_FragColor = vec4(vec3(color) * (LightIntensity),color[3]);
}
else
gl_FragColor = (1.0,0.0,0.0,1.0);
Where the Primitive_ID is passed before drawing each primitive.