Archived

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

wolf_10

Milkshapemodel Problem with Colors

Recommended Posts

Hi, why color my Milshapemodel (no Texture) any other Models (md2)???? from MSModel: . . . int materialIndex = m_pMeshes.m_materialIndex; if ( materialIndex >= 0 ) { glMaterialfv( GL_FRONT, GL_AMBIENT, m_pMaterials[materialIndex].m_ambient ); glMaterialfv( GL_FRONT, GL_DIFFUSE, m_pMaterials[materialIndex].m_diffuse ); glMaterialfv( GL_FRONT, GL_SPECULAR, m_pMaterials[materialIndex].m_specular ); glMaterialfv( GL_FRONT, GL_EMISSION, m_pMaterials[materialIndex].m_emissive ); glMaterialf( GL_FRONT, GL_SHININESS, m_pMaterials[materialIndex].m_shininess ); if ( m_pMaterials[materialIndex].m_texture > 0 ) { glBindTexture( GL_TEXTURE_2D, m_pMaterials[materialIndex].m_texture ); glEnable( GL_TEXTURE_2D ); } else glDisable( GL_TEXTURE_2D ); } else { // Material properties? glDisable( GL_TEXTURE_2D ); } . . . . i disable glTexture before i render the MSModel and enable it before i render any others.

Share this post


Link to post
Share on other sites
cant really understand the question. Are you having trouble getting materials from milkshape models to show up? If so, then as long as your loader loads everything from the file right (and it should if its off nehe''s tuts, a la Molofee?) and you draw the object immediately after that code snippet you posted, it should show up just fine. Make sure lighting is enabled and you have some light source in the scene, or materials might not work (they need light to show up).

Share this post


Link to post
Share on other sites
I try to explain

My Milkshapemodel define a blue Material (for Example) without a Texture.
Than i render the Milkshapemodel, no Problem.
After that, i render a different Model (Quake2 Model with Texture), not a Milkshapemodel !!! this Model is completely blue.

I think, i must disable any State, but i dont no witch.

Light is enable, with a Lightsource (this is not the Problem)



p.s. sorry for my poor english

[edited by - Wolf_10 on October 23, 2003 3:35:52 AM]

Share this post


Link to post
Share on other sites
Any material properties that are set will carry over to the next model as well. You''ll need to set (or reset) the material properties for the second model as well.

---
K-1 Productions: Come visit us here.

Share this post


Link to post
Share on other sites
OpenGL is a state machine. When you set a state, that state is still in effect until you set it to something else.

So if you do glMaterial(BLUE) then the current state for materials is BLUE until you tell it to be something else.

I advise some reading of the redbook, via the fish. The concept of OpenGL as a state machine is a very important one if you don't want it to confuse you every five seconds.

good luck

[edited by - mrbastard on October 23, 2003 12:02:15 PM]

Share this post


Link to post
Share on other sites