www.jpct.net
jPCT - a 3d engine for Java => Support => Topic started by: elhoce on March 06, 2012, 07:58:19 pm
-
Hi,
I have a problem with shaders, my model don't move (bones animation) when I activate a shader
my code
GLSLShader shader = new GLSLShader(Loader.loadTextFile("./vertexshader_body.glsl"),Loader.loadTextFile("./fragmentshader_body.glsl"));
for (Animated3D o : animatedGroup) {
o.getName();
o.setTexture("corps");
o.setRenderHook(shader);
o.compile();
o.build();
o.discardMeshData();
}
if I comment o.compile() my model moves but without shader :-[
Can you please tell me why ?
Thanks
-
Replace o.compile() vy o.compile(true); and add a call to Object3D.touch() right after calling the animation method.
-
Thanks now it works fine !
I have another question, I have a model composed of several parts, How can I disable the normal auto computing during the loading model ?
I have already comment the Object.build() call.
Thanks
-
Why do you want to do this? Without normals, no lighting will work properly.
-
because my file already contains precalculated normal data, and because my model looks bad between the parts in jpct
-
jPCT doesn't load normal data from the file. It fully relies on its own calculations. What's the problem "between the parts" (screen shot)?
-
(http://img11.hostingpics.net/thumbs/mini_50411526ss.png) (http://www.hostingpics.net/viewer.php?id=50411526ss.png)
the problem is I see the edge of each part, so I think the normals must be calculated on the whole model not in each part (part == one object3D)
-
And it's not an option to merge these parts into one Object3D?
-
Yes I can, How can I merge them in jpct ?
-
By either using this
)]http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html#mergeAll(com.threed.jpct.Object3D[]) (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html#mergeAll(com.threed.jpct.Object3D[)
or this
http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html#mergeObjects(com.threed.jpct.Object3D, com.threed.jpct.Object3D) (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html#mergeObjects(com.threed.jpct.Object3D, com.threed.jpct.Object3D))
Edit: Maybe the first link doesn't work as it should...the bloody forum software can't handle brackets inside others.