Loading...
Logo
Processing Forum
Hello Processing Community ,

I can load the 3D model by SAITO OBJLoader library.

And related to the problem of applying the textures I switch to this post , and now I have been able to load the 3D model as GLMODEL .

But again I have faced the same problem..
With the 3D model (i.e .obj and .mtl file) there are 2 texture files(.bmp files).

and by running the code I got error that : "OutOFMemoryError: You may need to increase the memory settings in Preferences." I increase the memory from the Preference but again got the same error.

The code of setting the Textures on the model is :


Copy code
  1.       // Enabling the use of texturing
  2.       glmodel.initTextures(2);
  3.       img1=new GLTexture(this,"dlc4_blake_head_diff.bmp");
  4.       img2=new GLTexture(this,"dlc4_blake_Body_diff.bmp");
  5.       glmodel.setTexture(0,img1);
  6.       glmodel.setTexture(1,img2);

  7.       glmodel.beginUpdateTexCoords(2);
  8.       index=0;

  9.       for(int s=0;s<model.getSegmentCount();s++){
  10.         Segment segment=model.getSegment(s);
  11.         Face[] faces=segment.getFaces();

  12.         for(int u=0;u<faces.length;u++){
  13.           PVector[] vs=faces[u].getVertices();
  14.           PVector[] ns=faces[u].getUvs();

  15.           for(int k=0;k<vs.length;k++){
  16.             glmodel.updateTexCoord(index++,ns[k].x,ns[k].y);
  17.       }
  18.    }
  19. }
  20.       glmodel.endUpdateTexCoords();

Your Precious help must be appreciated ...

Regards ...

Replies(1)

Hello EveryOne ,

The code posted above give this result :


But the correct result should be this:



The Model downloaded from here.

Need your HELP


Regards ...