manixrock

11-02-2010, 07:04 PM

There are several tutorials which use the J3DI.js and J3DIMath.js libraries, for example: http://www.khronos.org/webgl/wiki/Tutorial

There are problems I found (with some help) with this library. I'm not sure where I should be posting these bugs so I'll put them here:

In J3DIMath.js in J3DIMatrix4.prototype.lookat() the following code:

matrix.$matrix.m11 = xx;

matrix.$matrix.m12 = xy;

matrix.$matrix.m13 = xz;

matrix.$matrix.m14 = 0;

matrix.$matrix.m21 = yx;

matrix.$matrix.m22 = yy;

matrix.$matrix.m23 = yz;

matrix.$matrix.m24 = 0;

matrix.$matrix.m31 = zx;

matrix.$matrix.m32 = zy;

matrix.$matrix.m33 = zz;

matrix.$matrix.m34 = 0;

must be changed to:

matrix.$matrix.m11 = xx;

matrix.$matrix.m12 = yx;

matrix.$matrix.m13 = zx;

matrix.$matrix.m14 = 0;

matrix.$matrix.m21 = xy;

matrix.$matrix.m22 = yy;

matrix.$matrix.m23 = zy;

matrix.$matrix.m24 = 0;

matrix.$matrix.m31 = xz;

matrix.$matrix.m32 = yz;

matrix.$matrix.m33 = zz;

matrix.$matrix.m34 = 0;

In J3DIVector3.prototype.cross(), J3DIVector3.prototype.combine() and probably others, variables are used after they are changed when temporary values should be used to store the original values.

I'm posting this here because it has wasted a lot of my time trying to find the problem. If anyone knows where these should go, let me know. Hope it helps someone.

There are problems I found (with some help) with this library. I'm not sure where I should be posting these bugs so I'll put them here:

In J3DIMath.js in J3DIMatrix4.prototype.lookat() the following code:

matrix.$matrix.m11 = xx;

matrix.$matrix.m12 = xy;

matrix.$matrix.m13 = xz;

matrix.$matrix.m14 = 0;

matrix.$matrix.m21 = yx;

matrix.$matrix.m22 = yy;

matrix.$matrix.m23 = yz;

matrix.$matrix.m24 = 0;

matrix.$matrix.m31 = zx;

matrix.$matrix.m32 = zy;

matrix.$matrix.m33 = zz;

matrix.$matrix.m34 = 0;

must be changed to:

matrix.$matrix.m11 = xx;

matrix.$matrix.m12 = yx;

matrix.$matrix.m13 = zx;

matrix.$matrix.m14 = 0;

matrix.$matrix.m21 = xy;

matrix.$matrix.m22 = yy;

matrix.$matrix.m23 = zy;

matrix.$matrix.m24 = 0;

matrix.$matrix.m31 = xz;

matrix.$matrix.m32 = yz;

matrix.$matrix.m33 = zz;

matrix.$matrix.m34 = 0;

In J3DIVector3.prototype.cross(), J3DIVector3.prototype.combine() and probably others, variables are used after they are changed when temporary values should be used to store the original values.

I'm posting this here because it has wasted a lot of my time trying to find the problem. If anyone knows where these should go, let me know. Hope it helps someone.