Jump to content
  • Advertisement
Sign in to follow this  
cutovoi

OpenGL Blending problems in 3DS files

This topic is 4274 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi fellows I'm developing an app that loads 3ds models. The code works fine. I added transparency in my models. This code is for my OpenGL initialization:
void InitializeGL()
{
   glCullFace(GL_BACK);
   glEnable(GL_CULL_FACE);
   glEnable(GL_DEPTH_TEST);
   glShadeModel(GL_SMOOTH);
   glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
   glClearColor(0.0, 0.0, 0.0, 0.0);
   glClearDepth(1.0f);
   glDepthFunc(GL_LEQUAL);
   glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
   glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
   glLightfv(GL_LIGHT1, GL_AMBIENT, fAmbientLight);
   glLightfv(GL_LIGHT1, GL_DIFFUSE, fDiffuseLight);
   glLightfv(GL_LIGHT1, GL_POSITION, fPositionLight);
   glEnable(GL_LIGHT1);
   glEnable(GL_LIGHTING);
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_COLOR);
   glColor4f(1.0, 1.0, 1.0, fAlphaFactor);
}

this code is for my 3DS drawing:
void Object3DS::DrawObject3DS()
{
   glPushMatrix();
	  glPushAttrib(GL_CURRENT_BIT|GL_ENABLE_BIT);
	     glEnable(GL_BLEND);
		 if(m_bTranslate)
		 {
		    TranslationMatrix(&this->model.Objects[0].TranslationMatrix, fTransX, fTransY, fTransZ);
		    glMultMatrixf(&this->model.Objects[0].TranslationMatrix.theMatrix[0][0]);
			fTransX = fTransY = fTransZ = 0.0f;
		 }
		 if(m_bRotate)
		 {
		    RotationMatrix(&this->model.Objects[0].RotationMatrix, fRotX, fRotY, fRotZ);
            glMultMatrixf(&this->model.Objects[0].RotationMatrix.theMatrix[0][0]);
			fRotX =fRotY = fRotZ = 0.0f;
		 }
		 glDisable(GL_DEPTH_TEST);
         glCallList(m_uiIDDisplayList);
	     glDisable(GL_BLEND);
      glPopAttrib();
   glPopMatrix();
}


With this code I getting some abnormal results. In my 3ds models there are some "lighting parts". In the model they appearing in the ears, armpits and other parts. See the picture below: Image Hosted by ImageShack.us The exactly thing that I want is this: Image Hosted by ImageShack.us If I use GL_ONE_MINUS_SRC_ALPHA(like the 2nd parameter of the glBlendFunc) with any other parameter I don't get the results that I want. What I want to know is HOW CAN I ADD AN HOMOGENEOUS TRANSPARENCY IN MY ENTIRE 3DS MODEL? Please help me in this. I'm getting crazy. Thanks for the support

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!