PDA

View Full Version : MPxHwShaderNode flat white render


luizeliasvfx
11-27-2012, 04:38 PM
hello,

I've been trying to write a simple shader that draws the mesh on top of everything else in the scene. like 3d coat and topogun does, its quite hand for modelling purposes.
that part is working fine but my problem is that it shows up white and flat like a constant shader.
I've been trying and test a lot of examples but I can't figure out why it doesn't cast any light.

this is the relevant part i guess:

MStatus retopoShader::glGeometry( const MDagPath&,
int prim,
unsigned int writable,
int indexCount,
const unsigned int * indexArray,
int vertexCount,
const int * vertexIDs,
const float * vertexArray,
int normalCount,
const float ** normalArrays,
int colorCount,
const float ** colorArrays,
int texCoordCount,
const float ** texCoordArrays)
{
float Ambient[] = {0.3f, 0.3f, 0.3f,1.0f};
float Diffuse[] = {0.7f, 0.7f, 0.7f,1.0f};
float Specular[] = {1.0f, 1.0f, 1.0f,1.0f};
float Emission[] = {0.0f, 0.0f, 0.0f,0.0f};
float Shininess = 10.0f;
GetColour(m_aAmbientColor, Ambient);
GetColour(m_aDiffuseColor, Diffuse);
GetColour(m_aSpecularColor, Specular);
GetColour(m_aEmissionColor, Emission);
GetFloat(m_aShininess, Shininess);
glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,Ambient);
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse);
glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,Specular);
glMaterialfv(GL_FRONT_AND_BACK,GL_EMISSION,Emission);
glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,Shininess);
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
if(normalCount>0)
{
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer( GL_FLOAT, 0, normalArrays[0] );
}
if(texCoordCount>0)
{
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer( 2, GL_FLOAT, 0, texCoordArrays[0] );
}
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer( 3, GL_FLOAT, 0, vertexArray );
glClearDepth(0.0);
glDepthFunc(GL_ALWAYS);

glDrawElements( prim, indexCount, GL_UNSIGNED_INT, indexArray );

glPopClientAttrib();
glPopAttrib();
return MS::kSuccess;
}

any help would be much appreciated!!

CGTalk Moderation
11-27-2012, 04:38 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.