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

Webgl2 3d textures #150

Merged
merged 53 commits into from
Feb 21, 2017
Merged

Webgl2 3d textures #150

merged 53 commits into from
Feb 21, 2017

Conversation

greggman
Copy link
Contributor

This one adds previews for 3d textures and 2d texture arrays. I just draw every slice in whatever size preview is shown. Can try to think of something better later but at least it seems to work.

I realized it's going to be a big tedious PITA to support all the texture stuff like PBOs, all the new pixelStore UNPACK_XXX settings, etc.. 😭 Updated the list in #142

BTW: The spec changed. Chrome 55 supports the old spec, Chrome 57 supports the new spec. I haven't checked 56. Works in FirefoxNightly

Should I be checking in my samples in?

AFAIK if you're not uploading any data then there's no reason to call generateMipmap?
This commit switches to AMD for the module system and uses webpack/babel
to build lib/gli.all.js. This means you can use ES6 code in the source
and it should be converted to ES5. It also means there's no need to
add files to both the loaded and the buildscript as webpack can
figure out the files.

The chrome extension works in both release and debug mode
and embed.js seems to work in both release and debug mode.
Also tested firefox in release. Safari I can't test
as the extension no longer works even without these changes.

A few caveats: Because the debug mode uses require.js
there *may* be issues with using debug mode on pages
that use require.js themselves. Non-debug mode should
not have that issue.

Another issue is in debug mode things are finicky
in that it's possible window.onload could fire
before `getContext` has been wrapped. At the moment
it seems to be working but just in case, for those
cases you can (debug mode with embed.js only) you
can wait for `gliready` instead of load. In other words
assuming you have some code like this

    window.onload = runMyApp;

You'd change it to

    window.addEventListener('gliready', runMyApp);

Again, only when using embed.js in debug mode.
I started adding these because I thought I was going to need more shaders to render textures.
It turns out I didn't need to do that but still it seems like a good idea to share some code.
note: still to todo is supporting texImage3D etc... for uploading data
We need this because in WebGL2 samplers are format dependent
This way you can see small images
Probably some major refactoring need to support 3d and 2d array textures
First off how did this ever work. But secondly why did this suddenly start being an issue. What did I change/break

Also note that if I debug http://twgljs.org/examples/textures.html and pick to browse all textures I see the live updated texture update live in the preview. Really? Is that's suppose to happen?
@benvanik benvanik merged commit c0906c7 into benvanik:master Feb 21, 2017
@greggman greggman deleted the webgl2-3d-textures branch March 29, 2017 09:18
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