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

Add UniformMatrix4fv, DrawArrays, ValidateProgram, GetError to OpenGL 2.1 backend. #2

Merged
merged 1 commit into from
Dec 28, 2014

Conversation

dmitshur
Copy link
Collaborator

  • Use count value of 1 for gl.UniformMatrix4fv.

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:

  1. 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.

  2. 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 package goglfw.

    • Also, you'd need to enable issues on this repo.
  3. 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).

… 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])
Copy link
Collaborator Author

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).

dmitshur added a commit to shurcooL/play that referenced this pull request Dec 26, 2014
@dmitshur
Copy link
Collaborator Author

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.

Hah, experimental indeed. As I'm trying this now, I'm realizing that wrapping all the original glfw types is a major pain, so actually doing it inside the original package would be much easier with less overhead. I'll continue to try the wrapper approach for now, just to get something running and see how it works.

@ajhager
Copy link
Owner

ajhager commented Dec 26, 2014

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.

@dmitshur
Copy link
Collaborator Author

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.

Hmm, I think that makes sense.

I absolutely think that gopherjs/webgl should be just for webgl.

Great! I'm glad to hear that, I think that's the right way to go.

A lot of the work I have done here should really be merged into that, minus the desktop opengl stuff of course.

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:

a webgl interface with webgl, opengl 2.1 backends

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).

@dmitshur
Copy link
Collaborator Author

The original idea was to create a 'webgl' style interface with many backends, which works well enough, at least for engi.

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.

@dmitshur
Copy link
Collaborator Author

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 just had an idea, perhaps it would be viable to modify and use glow to assist with that task. I'll open an issue and ask @errcw for his thoughts. Edit: Opened issue here.

@dmitshur
Copy link
Collaborator Author

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:

  • gopherjs/webgl - remains a pure WebGL binding, with webgl-specific improvements (only) from ajhager/webgl eventually merged in.
  • ???/??? - a temporary WebGL-like interface with webgl and OpenGL 2.1 backends for engi and my current code; this is the current state of ajhager/webgl but I think the name should be changed from webgl to avoid confusion.
  • ???/??? - a potential future proper OpenGL ES 2 interface with WebGL OpenGL 2.1, potentially more backends, possibly generated via glow, possibly will never happen unless there's a strong need for it.

Suggestions for names are welcome. :D

dmitshur added a commit that referenced this pull request Dec 28, 2014
Add UniformMatrix4fv, DrawArrays, ValidateProgram, GetError to OpenGL 2.1 backend.
@dmitshur dmitshur merged commit f8108b1 into ajhager:master Dec 28, 2014
EtienneBruines pushed a commit to EtienneBruines/webgl that referenced this pull request Feb 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants