mcnopper / glus Goto Github PK
View Code? Open in Web Editor NEWGLUS for OpenGL, OpenGL ES and OpenVG
Home Page: http://nopper.tv
GLUS for OpenGL, OpenGL ES and OpenVG
Home Page: http://nopper.tv
Hi,
I am very impressed with your library, but unfortunately for several uses and distribution channels its viral license makes it unusable. Could you please relicense it to something non-viral, such as Apache-2, BSD, or MIT?
Thanks for your time,
Colin
Hello, I have encountered a problem in glusMatrix4x4Inversef. When a matrix value is very low, the results are incorrect. I am not an expert in linear algebra, so please forgive me if this issue is naive.
Code example for reproducing the issue:
void dumpMatrix(float* mat)
{
printf("%16g %16g %16g %16g\n", mat[ 0], mat[ 1], mat[ 2], mat[ 3]);
printf("%16g %16g %16g %16g\n", mat[ 4], mat[ 5], mat[ 6], mat[ 7]);
printf("%16g %16g %16g %16g\n", mat[ 8], mat[ 9], mat[10], mat[11]);
printf("%16g %16g %16g %16g\n", mat[12], mat[13], mat[14], mat[15]);
}
void testMatrixInversion()
{
float mat1[16];
glusMatrix4x4Identityf(mat1);
mat1[12] = 2.8f;
mat1[13] = 3.9f;
printf("**********************************************************************\n");
printf("matrix 1 before inversion\n");
dumpMatrix(mat1);
glusMatrix4x4Inversef(mat1);
printf("matrix 1 after inversion\n");
dumpMatrix(mat1);
printf("**********************************************************************\n");
float mat2[16];
glusMatrix4x4Identityf(mat2);
mat2[12] = 2.8f;
mat2[13] = 3.9f;
mat2[1] = -5.55111512e-017;
printf("**********************************************************************\n");
printf("matrix 2 before inversion\n");
dumpMatrix(mat2);
glusMatrix4x4Inversef(mat2);
printf("matrix 2 after inversion\n");
dumpMatrix(mat2);
printf("**********************************************************************\n");
}
void main()
{
testMatrixInversion();
}
result of the execution of previous code:
**********************************************************************
matrix 1 before inversion
1 0 0 0
0 1 0 0
0 0 1 0
2.8 3.9 0 1
matrix 1 after inversion
1 0 0 0
0 1 0 0
0 0 1 0
-2.8 -3.9 0 1
**********************************************************************
**********************************************************************
matrix 2 before inversion
1 -5.55112e-017 0 0
0 1 0 0
0 0 1 0
2.8 3.9 0 1
matrix 2 after inversion
1 5.55112e-017 0 0
0 1 0 0
0 0 1 0
0 -3.9 0 1
**********************************************************************
Note that the -2.8 value is lost in second matrix inversion.
Currently I am avoiding this problem by trimming very low values (abs(value < 1e-9) to zero before inverting, but I don't know if that fix is correct.
Thanks for this great library, it is saving me a lot of work.
Hi,Maybe I am doing wrong smth but here is the case.
In GLUS glusShapeCreateCubef() numberVertices = 24; .
However if I draw it using
glDrawElements(GL_TRIANGLES, numberVertices, GL_UNSIGNED_INT, 0);
Two last faces are not being drawn.
I tried also drawing with GL_TRIANGLE_STRIP.
In that case the faces are not drawn in correct winding order at all.
Only when I set numberVertices = 36 the cube is being drawn fine.
So is it a bug ,or I am using wrong draw mode?
UPDATE:
Ok,ok,that's as I supposed is my confusion.I should put into second param the number of indicies and not vertices in indexed drawing.Now it is fine.
nlerp, it is less accurate but is much faster, only needing a single sqrt instead of 4 transcendal trig functions. (FYI you can get the slerp using a half dozen nlerps by binary searching into the range using slerp(q1, q2, 0.5) == nlerp(q1, q2, 0.5)
)
slerp should fall back to nlerp when cosAlpha > 0.95
to avoid instability. The error between nlerp and slerp will decrease as cosAlpha
goes to 1.
Getting a quaternion representing the rotation between 2 vectors can be calculated using the cross and dot product directly instead of having to go through glusQuaternionRotatef.
//assumes v0 and v1 were normalized
GLUSfloat cross[3];
glusVector3Crossf(cross, v0, v1);
result[0] = cross[0];
result[1] = cross[1];
result[2] = cross[2];
result[3] = dotf(v0, v1)+1;
glusQuaternionNormalizef(result);
Can you write in README what is GLUS and why I need it?
Thanks
EGLSurface eglCreateWindowSurface(
EGLDisplay display,
EGLConfig config,
NativeWindowType native_window,
EGLint const * attrib_list);
Under EGL, just pass through. With GLFW, parse input.
Hi. I am not sure if that is 100% bug.I used a function from your lib to generate sphere mesh. And I noticed that when I set numSlices more than 22 .A little gap appears at the bottom of the mesh. It looks like that number of parallels is not sufficient to generate triangles at the south pole region. try with radius 50 amd numSlices = 23. Here is how it looks on my side:
We're restructuring the website and trying to eliminate the hosted content. Do you still need to host GLUS there, or will a link to this project suffice?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.