This time I had a problem with the actual rendering of my model. I can load all this through the loadGb () function of Libgdx and render it with GL10_Triangles, however I continue to get the missing triangles in my model (it seems that only half of the models render). I tried the old ObjLoad function (commented out) and also different rendering styles, but nothing works.
And yes, I checked the model in Blender and the model is completed without missing persons.
See print screen below and code below. Any help would be fantastic, it is very frustrating since I am so close to making it work.
And here is the code.
public class LifeCycle implements ApplicationListener {
Mesh model;
private PerspectiveCamera camera;
public void create() {
InputStream stream = null;
camera = new PerspectiveCamera(45, 4, 4);
try
{
stream = Gdx.files.internal("Hammer/test_hammer.obj").read();
model = ObjLoader.loadObj(stream,true);
stream.close();
}
catch (IOException e) {
e.printStackTrace();
}
Gdx.gl.glEnable(GL10.GL_DEPTH_TEST);
Gdx.gl10.glTranslatef(0.0f, 0.0f, -3.0f);
}
protected float rotateZ = 0.1f;
protected float increment = 0.1f;
public void render()
{
Gdx.app.log("LifeCycle", "render()");
Gdx.gl.glClearColor(0.0f, 0.0f, 0.5f, 1.0f);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
camera.update();
camera.apply(Gdx.gl10);
Gdx.gl10.glTranslatef(0.0f, 0.0f, -3.0f);
Gdx.gl10.glRotatef(rotateZ, rotateZ, 5.0f, rotateZ);
model.render(GL10.GL_TRIANGLES);
rotateZ += increment;
System.out.println(""+rotateZ);
}
}
source
share