Well currently I only try to set the texture of every single vertex to the half of my loaded texture. the texture is .
However where ever I use the method shown below the object is just plain black.
private static void GenerateSingleLightmap(TriMesh togenerate){
TextureState texstate = (TextureState) togenerate.getRenderState(StateType.Texture);
if(texstate == null){
texstate = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
}
int nextunit = texstate.getNumberOfSetTextures();
texstate.setTexture(shadtex,nextunit);
Triangle[] triangles = togenerate.getMeshAsTriangles(new Triangle[togenerate.getTriangleCount()]);
ByteBuffer bytebuffer = ByteBuffer.allocateDirect(6*triangles.length*4);
TexCoords texcords = new TexCoords(bytebuffer.asFloatBuffer(),2);
int index = 0;
int triangleindex = 0;
texcords.coords.rewind();
while(index < texcords.coords.limit()){
Triangle triangle = triangles[triangleindex];
texcords.coords.put(1f);
texcords.coords.put(0f);
texcords.coords.put(1f);
texcords.coords.put(0f);
texcords.coords.put(1f);
texcords.coords.put(0f);
triangleindex++;
index += 6;
}
togenerate.setRenderState(texstate);
togenerate.setTextureCoords(texcords,nextunit);
togenerate.updateRenderState();
DisplaySystem.getDisplaySystem().getRenderer().checkCardError();
}