-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add UniformMatrix4fv, DrawArrays, ValidateProgram, GetError to OpenGL 2.1 backend. #2
Conversation
… 2.1 backend. Use count value of 1 for gl.UniformMatrix4fv.
// Perhaps it should be len(value) / 16 or something else? | ||
// In OpenGL 2.1 it is a manually supplied parameter, but WebGL does not have it. | ||
// Not sure if WebGL automatically deduces it and supports count values greater than 1, or if 1 is always assumed. | ||
gl.UniformMatrix4fv(location.int32, 1, transpose, &value[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment above.
I think this is fine for now (and it works for a single matrix), but suggestions/review are welcome.
I didn't want to try to support values of greater than 1 without actually testing that it works (and works well).
Depends on ajhager/webgl#2 being merged.
Hah, experimental indeed. As I'm trying this now, I'm realizing that wrapping all the original |
I will address all of your questions and comments, but I will start with the philosophy of this fork first. I created this so that I could more easily develop github.com/ajhager/engi. The original idea was to create a 'webgl' style interface with many backends, which works well enough, at least for engi. What I realized after a while is that it would make more sense to create an opengl es2 interface with webgl, opengl 2.1, and opengl es2 (android and ios) backends. That change will be a bit of work, and I just haven't had the time or energy to push it through. I absolutely think that gopherjs/webgl should be just for webgl. A lot of the work I have done here should really be merged into that, minus the desktop opengl stuff of course. I will definitely add you as a collaborator. Feel free to make the changes you think are needed, and I will just make the needed changes to engi as you go. Just keep me in the loop about your vision for the project. |
Hmm, I think that makes sense.
Great! I'm glad to hear that, I think that's the right way to go.
Which work have you done here that is webgl-specific? It's hard to see because of the change to have 2 backends instead of one. Do you mean a711b14? Anyway, it sounds like the high-level vision for this repo is to undo the multiple backends work and apply webgl-specific improvements to gopherjs/webgl, right? So it would make more sense to fork/create another repo that solves this other high-level vision: "an opengl es2 interface with webgl, opengl 2.1, and opengl es2 (android and ios) backends." Am I understanding you correctly? If so, I'd like to fork this repo (you are welcome to have push rights of course) and use it in its current state to address this short-term vision that is good enough for my initial experiments:
But I agree that OpenGL ES 2 interface would be better. But I won't start all that work until there's a clear need for it; until then the WebGL interface will suffice for me. If we're on the same page, feel free to close this PR, since as I understand it won't be needed (it only adds to the OpenGL 2.1 backend). |
That's basically the same situation as I'm in. But I think we need a differently-named repo to indicate the intent is not to merge upstream to gopherjs/webgl pure WebGL bindings. Aside from that, I think your needs for engi and mine for Hover should be compatible for now. |
I just had an idea, perhaps it would be viable to modify and use |
I'll merge this PR for closure (since it's purely additive and quite short), but later on let's discuss and settle on a repo organization that covers all needs going forward. My thoughts so far:
Suggestions for names are welcome. :D |
Add UniformMatrix4fv, DrawArrays, ValidateProgram, GetError to OpenGL 2.1 backend.
Added support for RGBA.
This is needed for shurcooL/play@6398c5a to work correctly. I added the missing OpenGL 2.1 backend funcs that I needed.
Joseph, I have three comments about this package:
I see this is currently a fork of
github.com/gopherjs/webgl
, which is a set of pure bindings for WebGL. This package, by now, is a higher level package that exposes a unified API with 2 backends: WebGL and OpenGL 2.1.Based on the current README, it seems that this is an experimental attempt to eventually merge into the
github.com/gopherjs/webgl
package. I think it might make sense not do that, but instead have a package that is a pure binding for WebGL, and this package that has a unified API for WebGL and OpenGL 2.1.There are many reasons. Someone might want to just use the pure WebGL API and not bother with anything else. They might not want any compromises that might have to be done for this unified version. Also, this one targets OpenGL 2.1, but another version could target WebGL and non-2.1.
I'm planning to try (experimentally) a similar package that exposes a unified API for glfw package. It will also have two backends, glfw for desktop, and html/canvas/etc. backend for browsers. It will import glfw and reuse it, rather than trying to become a part of glfw.
Related to above, if you agree to keep this package separate from pure WebGL bindings, I think a different name is better. I would suggest
gogl
. I an planning to name my glfw unified packagegoglfw
.Would you like to add me as a collaborator to this repo? I can make PRs and avoid pushing to master if you wish, or I can push to master since this package is quite immature and experimental. Or I can fork it and work on my version (where you're welcome to have push rights hehe).