Coder Social home page Coder Social logo

humbletim / glm-js Goto Github PK

View Code? Open in Web Editor NEW
41.0 41.0 5.0 1.38 MB

JavaScript adaptation of the OpenGL Mathematics (GLM) C++ library interfaces. JavaScript adaptation of the OpenGL Mathematics (GLM) C++ library interfaces. (project currently inactive)

Home Page: http://humbletim.github.io/glm-js/

License: Other

JavaScript 97.40% C++ 1.25% CSS 0.37% Shell 0.02% Makefile 0.41% HTML 0.55%

glm-js's People

Contributors

beuc avatar humbletim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

glm-js's Issues

glm types always use JS Float32Arrays under the hood.

Hi there. Awesome work. Thanks very much for working this out.

Noticed that no matter the type of vector built, FloatArray32 JS type is what is used under the hood.

const glmIvec = glm.ivec3(-3, 0, 0);
const glmUvec = glm.uvec3(-3, 0, 0);
const glmVec = glm.vec3(-3, 0, 0);

console.log('glmIvec', glmIvec);
console.log('glmUvec', glmUvec);
console.log('glmVec', glmVec);

image

I would expect that once the library takes care of the glm type specifics on the semantic side, the closest JS type array match would be used. This would be for memory efficiency also, but mainly to avoid misunderstandings/bugs when memory strides are passed into the graphics API functions.

Taking the chance to ask if PRs are welcome, maybe to fix this or for example to add typescript types to the library.
Thanks.

Errors being thrown in IE11

Using the library on a page in IE11 and the following errors are showing int he dev console:

'glm_vec3_Error' is undefined

Also If I type our glm in the console. it is showing as null, in other browsers it shows the full glm object.
Typing GLM in the console in IE11 shows an object but it does not have the function vec3() that I need.
Screen Shot 2019-05-28 at 11 48 25 AM

dvec & dmat data types

For more precision calculation it would be nice to have access to dvec and dmat datatypes.

glm.mat2 is not implemented

I previously mentioned this here but figured it would be more appropriate to write a new issue for it. I've been using this library pretty heavily to build a 2d graphics application, but I've been hurting from a lack of mat2s. I expect a lot of people might have similar use cases since 2d graphics application are pretty common in web browsers, likely even moreso than 3d applications, and people could benefit from having a common frame of mind for both 2d and 3d problems.

Document/test how to run a full, minified command-line build.

rough notes:

  • document which versions and dependencies are needed (and where to put them)
  • add example to readme of how to run a command line build and the tests
  • maybe wire into package.json so 'npm test' can be used
  • integrate the native GLM comparison tests into main build/test process
  • maybe get git hooks / one of the automated CI services going to run tests automatically on commits

note: comments below brought forward from resolved issue #2

@Beuc

Note: I wanted to test my changes but I cannot run 'make test' or 'make build' from nodejs (tested with v4.7.2 and 6.9.2), I get various errors:

  • looks at closure-compiler somewhere in /tmp
  • requires build/VA_ARGS.js which needs to be build manually (missing make dependency)
  • uses the non-standard 'load' keyword
  • errors related to "ES5 strict mode"
    I'm not sure how I'm supposed to run all this :)

@humbletim

And yeah... my hacked-together build system needs some TLC. Fortunately, you can also bootstrap glm-js from source (ie: without any build system or minification); here's a quick snippet to demonstrate:

extremely slow. Possibly I'm using it wrong

I might be using this wrong but I just found out about it today and so added to these benchmarks

http://greggman.github.io/webgl-matrix-benchmarks/matrix_benchmark.html?tests=glmatrix,twgl,glm-js,glm-js-gl-matrix

Also it's possible rotate is buggy. I benchmark both glm-js and glm-gl-matrix. They're exactly the same except for which library is included but glm-js returns different results for rotate then glm-gl-matrix

The code to test glm-js is here

https://github.com/greggman/webgl-matrix-benchmarks/blob/master/libs/glm-js/glm-js.html

lookAt returns a vector instead of a matrix

Hi,

Thanks for writing a JS library compatible with GLM!
Much appreciated to try and port my https://en.wikibooks.org/wiki/OpenGL_Programming#The_basics_arc tutorials :)

I found a bug: glm.lookAt returns a quat rather than a matrix.
Cf. http://glm.g-truc.net/0.9.8/glm-0.9.8.pdf §5.2.
At first glance, stripping "glm.quat" in the various implementation of 'lookAt' in source code fixes the issue.

Note: I wanted to test my changes but I cannot run 'make test' or 'make build' from nodejs (tested with v4.7.2 and 6.9.2), I get various errors:

  • looks at closure-compiler somewhere in /tmp
  • requires build/VA_ARGS.js which needs to be build manually (missing make dependency)
  • uses the non-standard 'load' keyword
  • errors related to "ES5 strict mode"
    I'm not sure how I'm supposed to run all this :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.