Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Learningwebgl #4

Open
rm-hull opened this issue Mar 14, 2014 · 9 comments
Open

Learningwebgl #4

rm-hull opened this issue Mar 14, 2014 · 9 comments
Assignees

Comments

@rm-hull
Copy link
Collaborator

rm-hull commented Mar 14, 2014

Going to try and port some lessons from http://learningwebgl.com/ to see how it well it works with the codebase. I will commit changes on a branch called feature/learningwebgl, and probably push into master after each lesson is reasonably complete.

@rm-hull rm-hull self-assigned this Mar 14, 2014
@rm-hull
Copy link
Collaborator Author

rm-hull commented Mar 24, 2014

Hey @asakeron, I've implemented the code behind the first two lessons on the feature/learningwebgl branch... and made a few small changes to the source on the way - just want to check you're ok with the commits so far ?

@asakeron
Copy link
Owner

Yes, I have been reading your commits and I'm okay with all the changes so far. I do belive the code is getting more readable. The examples look great. Thank you! 👍

One thing I noticed, though, is that you were forced to call a few WebGL methods directly from the js object, such as glEnable and glViewPort. I believe they should ideally be parameters to the draw!function.

With that being said, I also believe the draw! function should receive one map object instead of multiple parameters - as in your big-bang library - , this way the calls will be easier to read considering the number of parameters will probably grow a lot as soon as we implement textures, framebuffers, etc...

Any thoughts?

@rm-hull
Copy link
Collaborator Author

rm-hull commented Mar 25, 2014

I was just thinking the same about the draw function, if the method signature is something like:

(defn draw! 
  [gl & {:keys [shader-program draw-mode first count 
                attributes uniforms element-array] :as opts}]
  ...)

then we can still thread the gl-context, but all other parameters are named, and some might be defaultable. The only downside with using & opts is that it is not so easy to compose functions, but I don't think this matters much here as:

  1. the gl-context is outside the opts map, so threading should still work
  2. draw! is, by its nature, an imperative operation with side-effects

Also, I agree about the javascript methods and attributes - they should be wrapped - I was/am still getting a handle on what's best to encapsulate and what's not

@rm-hull
Copy link
Collaborator Author

rm-hull commented Mar 27, 2014

Ok, so that's lessons 3 (simple animation), 4 (3d shapes), 5 (texture mapping) implemented. I've made a rough start on a textures namespace and :textures parameter to draw! - see what you think & make changes where you see fit !

@accidentally-altoid
Copy link

I'm enjoying these so far, thanks to the both of you.

@rm-hull
Copy link
Collaborator Author

rm-hull commented Apr 4, 2014

I've added a gh-pages branch, and copied the learningwebgl examples in there, so you can view at http://asakeron.github.io/cljs-webgl/examples/learningwebgl/lesson_01.html

@asakeron
Copy link
Owner

asakeron commented Apr 5, 2014

Yay! Thanks. :)

@rm-hull
Copy link
Collaborator Author

rm-hull commented May 8, 2014

Was wondering about pushing this branch into master as-is?

I would've liked to have implemented a few more lessons, but have been stacked out at work so this has been a little neglected lately... hopefully I should be able to pick it up again nearer the end of this month.

@asakeron
Copy link
Owner

asakeron commented May 8, 2014

I'm okay with that, @rm-hull. We ended up making massive changes to the API as needed while you implemented the examples, so to push them into master now, makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants