Loading .Obj file- only a section of texture appears?
in
Contributed Library Questions
•
6 months ago
I am trying to load a .obj file, however only a small section of the texture appears at the back of the head. Sketch folder includes the .obj file and .mtl and a corresponding image file. Not sure why this is happening?
I know that the Pshape function works in processing 2.0 but for compatibility with the nyartoolkit library i need it to be in 1.5 so i am using the original simple example code from OBJloader library. Any ideas or suggestions please?
Here's the code:
import saito.objloader.*;
OBJModel model ;
float rotX, rotY;
void setup()
{
size(800, 600, P3D);
frameRate(30);
model = new OBJModel(this, "Untitled.obj", "absolute", TRIANGLES);
model.enableDebug();
model.scale(1,1,1);
model.translateToCenter();
stroke(255);
noStroke();
}
void draw()
{
background(129);
lights();
pushMatrix();
translate(width/2, height/2, 0);
rotateX(rotY);
rotateY(rotX);
model.draw();
popMatrix();
}
boolean bTexture = true;
boolean bStroke = false;
void keyPressed()
{
if(key == 't') {
if(!bTexture) {
model.enableTexture();
bTexture = true;
}
else {
model.disableTexture();
bTexture = false;
}
}
if(key == 's') {
if(!bStroke) {
stroke(255);
bStroke = true;
}
else {
noStroke();
bStroke = false;
}
}
else if(key=='1')
model.shapeMode(POINTS);
else if(key=='2')
model.shapeMode(LINES);
else if(key=='3')
model.shapeMode(TRIANGLES);
}
void mouseDragged()
{
rotX += (mouseX - pmouseX) * 0.01;
rotY -= (mouseY - pmouseY) * 0.01;
}
The obj loader should not have an issue with loading a single texture?
Hoping anyone with some advice can help here.
1