coreh / gl-matrix.c Goto Github PK
View Code? Open in Web Editor NEWC Matrix library for OpenGL apps. A port of the gl-matrix JavaScript library.
License: zlib License
C Matrix library for OpenGL apps. A port of the gl-matrix JavaScript library.
License: zlib License
Hi, not sure if you're still working on this or not, but I was reading through your code and noticed that your arguments to calloc are reversed in every call. It should be calloc(count, size).
The code is compiled with -std=c99
flag, but the C99 standard dropped M_PI and all other mathc defines of the same type. When compiling a compiler that strictly respects ISO like gcc
, it generates a M_PI undefined error.
You should probably define your own PI, or compile with -std=gnu99
flag, for instance.
make
cc -c vec3.c -Wall -Werror -pedantic-errors -std=c99 -o vec3.o
cc -c mat3.c -Wall -Werror -pedantic-errors -std=c99 -o mat3.o
cc -c mat4.c -Wall -Werror -pedantic-errors -std=c99 -o mat4.o
cc -c quat.c -Wall -Werror -pedantic-errors -std=c99 -o quat.o
quat.c:32:25: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
quat[3] = -sqrt(abs(1.0 - x * x - y * y - z * z));
^
quat.c:32:25: note: use function 'fabs' instead
quat[3] = -sqrt(abs(1.0 - x * x - y * y - z * z));
^~~
fabs
quat.c:38:21: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
dest[3] = -sqrt(abs(1.0 - x * x - y * y - z * z));
^
quat.c:38:21: note: use function 'fabs' instead
dest[3] = -sqrt(abs(1.0 - x * x - y * y - z * z));
^~~
fabs
quat.c:220:9: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
if (abs(cosHalfTheta) >= 1.0) {
^
quat.c:220:9: note: use function 'fabs' instead
if (abs(cosHalfTheta) >= 1.0) {
^~~
fabs
quat.c:233:9: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
if (abs(sinHalfTheta) < 0.001) {
^
quat.c:233:9: note: use function 'fabs' instead
if (abs(sinHalfTheta) < 0.001) {
^~~
fabs
4 errors generated.
make: *** [quat] Error 1
replaced all occasions of abs with fabs and compile went through.
Latest version of OSX (10.11.1)
cc -v
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
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.