Giter Site home page Giter Site logo

elm-community / elm-webgl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from johnpmayer/elm-webgl

95.0 95.0 22.0 446 KB

Moved to elm-explorations/webgl

Home Page: http://package.elm-lang.org/packages/elm-explorations/webgl/latest

License: BSD 3-Clause "New" or "Revised" License

JavaScript 49.55% Elm 48.86% Shell 1.59%

elm-webgl's People

Contributors

aforemny avatar deadfoxygrandpa avatar eeue56 avatar emptyflash avatar evancz avatar fredcy avatar glendc avatar jaspertron avatar jdavidberger avatar johnpmayer avatar jtojnar avatar jvoigtlaender avatar mgold avatar nacmartin avatar nphollon avatar process-bot avatar ryan1729 avatar w0rm 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

elm-webgl's Issues

Nothing gets rendered until the program receives it's first message

As we've discussed on Slack with @w0rm , it seems that elm-webgl doesn't render anything until after the program receives it's first message. I've made a gist that exhibits this behaviour. The conditions in lines https://gist.github.com/szabba/13a90267523f122d259a16fe9c5954be#file-main-elm-L18-L23 can be used to make it work immediately or after a five second delay.

To poke at the code locally, you can clone the gist

$ git clone https://gist.github.com/13a90267523f122d259a16fe9c5954be.git

Host examples on gh-pages?

The example links on the README frontpage are dead (404). I think it would make sense to move them to GitHub (or reactivate them on elm-lang.org) or remove them.

Is is possible to add constants to the vertex array data?

I can see how you create streams of information like vertex and normal position but how do you apply constant data like using a constant vertex attribute. Maybe the intension is that you would use a uniform here?

I cant see any complex examples in this API that sheds any light on this, hence this question.

Interactivity: Picking

I would like to display additional information and change the mouse pointer type when the user hovers over rendered objects and create a new window when an entity is clicked. It would be nice, to be able to efficiently detect the rendered object that's under the user's mouse pointer.

The default way to do this seems to be picking. Examples:

In JS this seems to be hassle-free. But I can't see how this is possible with elm-webgl. This is really sad because the modern web is defined by interactivity which includes not just rendering but also reacting on user input.

Google-ing this topic reveals that there has been a discussion about this topic which ended nowhere:
https://groups.google.com/forum/#!topic/elm-discuss/PvVxDq0K8M8

In this thread there are further references to discussions where users ask for this feature:

So there is definitely some demand.

Are there any plans to support this?

If I would try to implement this (I have no idea how hard this will be or whether it's possible at all with the current architecture), does it have any chance to be merged?

Edit: The most important missing functionality seems to be WebGLRenderingContext.readPixels()(Docs)

Edit1: Currently, I'm mostly interested in the 2D case (map overlay) where depth information is not relevant.

Examples lead to 404

The examples currently linked to from the repository README.md lead to a 404. Do these exist somewhere else now?

screen shot 2016-06-05 at 10 24 12 pm

Repository field in elm-package.json affects correctness of generated Javascript

I tried copying /examples/elm-package.json and /examples/first-person.elm to a new project, setting the repository in elm-package.json to

"repository": "https://github.com/genthaler/first-person-elm-start-app-simple.git",

and adding

"elm-community/elm-webgl": "2.0.0 <= v < 3.0.0"

This failed to load in Chrome, with the errors:

first-person.elm:4573 Uncaught TypeError: Cannot read property 'createNode' of undefined(anonymous function) @ first-person.elm:4573(anonymous function) @ first-person.elm:5096(anonymous function) @ first-person.elm:12681
first-person.elm:10 Uncaught TypeError: runElmProgram is not a function(anonymous function) @ first-person.elm:10

If I set the repository to

"repository": "https://github.com/aenthaler/first-person-elm-start-app-simple.git",

(i.e. genthaler -> aenthaler) then it runs.

I suspect it only works if the repository field is lexicographically earlier than "https://github.com/elm-community/elm-webgl.git".

Feel free to clone the project at https://github.com/genthaler/first-person-elm-start-app-simple

Provide the ability to load a texture without an implicit UNPACK_FLIP_Y_WEBGL

Currently the option UNPACK_FLIP_Y_WEBGL true is always implicit, it would be ice if that an other options could be applied with a version of loadtTextureWithConfig function or similar:

  • gl.PACK_ALIGNMENT
    Affects packing of pixel data into memory. The initial param value is 4, but it can be set to 1,2,4, or 8.
  • gl.UNPACK_ALIGNMENT
    Affects unpacking of pixel data from memory. The initial param value is 4, but can be set to 1,2,4, or 8.
  • gl.UNPACK_FLIP_Y_WEBGL
    Flips the source data along its vertical axis when texImage2D or texSubImage2D are called when param is true. The initial value for param is false.
  • gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL
    Multiplies the alpha channel, if it exists, into the other color channels during the data transfer when texImage2D or texSubImage2D are called when param is true. The initial value for param is false.
  • gl.UNPACK_COLORSPACE_CONVERSION_WEBGL
    The browser's default colorspace conversion is applied when texImage2D or texSubImage2D are called with an HTMLImageElement texture data source. The initial value for param is BROWSER_DEFAULT_WEBGL. No colorspace conversion is applied when set to NONE.

JS Interop: Direct Access to "draw()"?

I'm currently experimenting using elm-webgl to power a canvas on a Leaflet.js map to render geo data. Basically, this is working great! I think Elm could be a good fit to render big amounts of live geo data.

Unfortunately, the JS Ports feature of Elm seems to be asynchronous which leads to a laggy view. I've created an example to show the behavior: https://github.com/felixguendling/elm-map/tree/master

The rendering works fine, but when you drag/move the map, the canvas contents get displayed at the wrong position for perhaps a few milliseconds. I assume this glitch originates from the ports not being synchronous. There are some plain JS examples that do the same with the slight difference, that the canvas update happens at the same time as the CSS update of the map.

Problem in the code (https://github.com/felixguendling/elm-map/blob/master/index.html):

app.ports.mapUpdate.send

and

var pos = this._map.containerPointToLayerPoint([0, 0]);
L.DomUtil.setPosition(this._el, pos);

are not synchronized.

So, my question is: is there a way to instantly render the changes or are there some kind of "synchronous ports" in Elm? Or is there a totally different solution to this problem?

Edit: The model needs to be updated before the synchronous redraw.

Package hardwired to elm-lang/core 4.0.0

This means the package cannot be used together with the latest, bug-fixed, release of core. Probably the bounds should be changed to "elm-lang/core": "4.0.0 <= v < 5.0.0" and a patch release of this package here be made.

Unify code formatting in the Native module

I'm not sure if there is a preferred way to format JavaScript, I am happy with any coding style but it has to be consistent.

Perhaps we can as well add an eslint config or something.

Adding Elm 0.18

Elm 0.18 is now in beta phase but this package has not been published for it.

Is anybody working on it?

Thanks.

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.