Problem with set the Textures on glmodel
in
Contributed Library Questions
•
8 months ago
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 :
Your Precious help must be appreciated ...
Regards ...
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 :
- // Enabling the use of texturing
- glmodel.initTextures(2);
- img1=new GLTexture(this,"dlc4_blake_head_diff.bmp");
- img2=new GLTexture(this,"dlc4_blake_Body_diff.bmp");
- glmodel.setTexture(0,img1);
- glmodel.setTexture(1,img2);
- glmodel.beginUpdateTexCoords(2);
- index=0;
- for(int s=0;s<model.getSegmentCount();s++){
- Segment segment=model.getSegment(s);
- Face[] faces=segment.getFaces();
- for(int u=0;u<faces.length;u++){
- PVector[] vs=faces[u].getVertices();
- PVector[] ns=faces[u].getUvs();
- for(int k=0;k<vs.length;k++){
- glmodel.updateTexCoord(index++,ns[k].x,ns[k].y);
- }
- }
- }
- glmodel.endUpdateTexCoords();
Your Precious help must be appreciated ...
Regards ...
1