コード例 #1
0
void Mesh :: drawOpenGL()
{ 
  tellMaterialsGL(); 	
  glPushMatrix();
  glMultMatrixf(transf.m);

  switch (mode) {
  case MODE_WIRE:
    drawEdges();
    break;
  case MODE_SOLID:
    drawFaces();	
    break;
  default:
    drawFaces();	
    drawEdges();
    break;
  }

  glPopMatrix();
} 
コード例 #2
0
ファイル: Mesh.cpp プロジェクト: Solarnum/openGLProject
void Mesh::drawOpenGL()
{
	tellMaterialsGL();
	glPushMatrix();
	if (usesTexture)
	{
		if (!textureLoaded)
		{
			cout << " \n TextureFileName = " << texturefile << endl;
		setTexture(loadTexture(texturefile));
		}
			
		glBindTexture(GL_TEXTURE_2D, texture);
		glEnable(GL_TEXTURE_2D);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
	}
	glMultMatrixf(transf.m);
	switch (mode) {
	case MODE_WIRE:
		drawEdges();
		break;
	case MODE_SOLID:
		drawFaces();
		break;
	default:
		drawFaces();
		drawEdges();
		break;
	}
	
	glPopMatrix();
}