Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualrevaldo666

Posted 27 July 2012 - 05:01 AM

Hello all. How load 3ds file with texture in opengl window.
Object i loaded successfull, but i dont know how load texture.
code model load
void display()
{
	Gl::glEnable(Gl::GL_DEPTH_TEST);
	Gl::glDepthFunc(Gl::GL_LEQUAL);
	Gl::glClear(Gl::GL_COLOR_BUFFER_BIT|Gl::GL_DEPTH_BITS);
Gl::glClearColor(235, 242, 250, 1);
	Gl::glLoadIdentity();
	lightup();
	Gl::glScalef(0.5,0.5,0.5);
	Gl::glTranslatef(0.0,-1200.0,-1500.0);
Gl::glRotatef(280, 1, 0, 0);
Gl::glRotatef(rotat, 0, 0, 1);
Gl::glColor3f(50.0,100.0,0.0);
	 long meshcount;
	for(meshcount=0;meshcount<model->meshes->Count;meshcount++)
	{
  for(int fd=0;fd<mesh[meshcount]->faces->Count;fd++)
   face.Add(mesh[meshcount]->faces[fd]);
		for(long i=0;i<mesh[meshcount]->nfaces;i++)
		{
			Gl::glMaterialfv(Gl::GL_FRONT,Gl::GL_DIFFUSE,material[face[i]->material]->diffuse);
			Gl::glMaterialfv(Gl::GL_FRONT,Gl::GL_AMBIENT,material[face[i]->material]->ambient);
			Gl::glMaterialfv(Gl::GL_FRONT,Gl::GL_SPECULAR,material[face[i]->material]->specular);
   // progressBar1->Maximum=mesh[meshcount]->nfaces;
   // progressBar1->Value=i;
			Gl::glBegin(Gl::GL_TRIANGLES);
   Gl::glColor3f(50.0,100.0,0.0);
			Gl::glVertex3fv(mesh[meshcount]->vertices[face[i]->index[0]]->ToArray());
			Gl::glVertex3fv(mesh[meshcount]->vertices[face[i]->index[1]]->ToArray());
			Gl::glVertex3fv(mesh[meshcount]->vertices[face[i]->index[2]]->ToArray());
			Gl::glEnd();
   Gl::glFlush();
		}
  face.Clear();
	}
}

#1revaldo666

Posted 27 July 2012 - 05:00 AM

Hello all. How load 3ds file with texture in opengl window.
Object i loaded successfull, but i dont now how loaded texture.
code model loaded
void display()
{
    Gl::glEnable(Gl::GL_DEPTH_TEST);
    Gl::glDepthFunc(Gl::GL_LEQUAL);
    Gl::glClear(Gl::GL_COLOR_BUFFER_BIT|Gl::GL_DEPTH_BITS);
Gl::glClearColor(235, 242, 250, 1);
    Gl::glLoadIdentity();
    lightup();
    Gl::glScalef(0.5,0.5,0.5);
    Gl::glTranslatef(0.0,-1200.0,-1500.0);
Gl::glRotatef(280, 1, 0, 0);
Gl::glRotatef(rotat, 0, 0, 1);
Gl::glColor3f(50.0,100.0,0.0);
	 long meshcount;
    for(meshcount=0;meshcount<model->meshes->Count;meshcount++)
    {
  for(int fd=0;fd<mesh[meshcount]->faces->Count;fd++)
   face.Add(mesh[meshcount]->faces[fd]);
	    for(long i=0;i<mesh[meshcount]->nfaces;i++)
	    {
		    Gl::glMaterialfv(Gl::GL_FRONT,Gl::GL_DIFFUSE,material[face[i]->material]->diffuse);
		    Gl::glMaterialfv(Gl::GL_FRONT,Gl::GL_AMBIENT,material[face[i]->material]->ambient);
		    Gl::glMaterialfv(Gl::GL_FRONT,Gl::GL_SPECULAR,material[face[i]->material]->specular);
   // progressBar1->Maximum=mesh[meshcount]->nfaces;
   // progressBar1->Value=i;
		    Gl::glBegin(Gl::GL_TRIANGLES);
   Gl::glColor3f(50.0,100.0,0.0);
		    Gl::glVertex3fv(mesh[meshcount]->vertices[face[i]->index[0]]->ToArray());
		    Gl::glVertex3fv(mesh[meshcount]->vertices[face[i]->index[1]]->ToArray());
		    Gl::glVertex3fv(mesh[meshcount]->vertices[face[i]->index[2]]->ToArray());
		    Gl::glEnd();
   Gl::glFlush();
	    }
  face.Clear();
    }
}

PARTNERS