Git Product home page Git Product logo

webgl-texture-utils's Introduction

webgl-texture-utils

Utilities for working with WebGL textures with an emphasis on loading compressed formats.

NOTE: This code is pretty old by now, and I don't intend to do further development on it. You may want to try using webgl-texture-util.js from my texture-tester project instead.

Usage

The quickest way to get up and running is to include texture-util.js from the build folder, which will add a TextureUtil object to the global scope. Once included, construct a TextureLoader by passing the desired WebGL context to it.

var textureLoader = new TextureUtil.TextureLoader(gl);

The texture loader can be used to easily load textures of many different formats with the load function.

var texture = textureLoader.load("path/to/texture.png", function(texture) {
    // Optional callback
});

Supported formats are those natively supported by the browser (JPG, PNG, BMP, GIF), TGA, DDS, and CRN (Crunch). Format is typically determined by the file extension on the path provided, but can be overridden by passing in an explicit type.

var texture = textureLoader.load("textureGenerator.php", callback, "DDS");

If you use require.js in your project you can use the un-minified source files directly. Copy the texture-util folder into your project and include "texture-util/loader".

Further documentation is forthcoming, sorry for the brevity!

Credits

Thank you to Rich Geldreich for developing the Crunch texture compression library and Evan Parker for porting it to Javscript via Emscripten

webgl-texture-utils's People

Contributors

floooh avatar mattdesl avatar toji avatar wolfwings avatar zeh 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  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webgl-texture-utils's Issues

Could uploadDDSLevels take a view instead of a buffer?

Great tools! I've only tried out the DDS loader so far and I'm already a fan. If I were to make a suggestion, could uploadDDSLevels() take as its data input, a typed-array view instead of an ArrayBuffer?

I am pulling my DDS'es from a big blob of binary data and need to give uploadDDS a subsection of my full ArrayBuffer. Views are easy to slice and dice on the go but ArrayBuffer slicing copies data around (afaik). I've stopped passing around ArrayBuffers all together for this very reason. Feels kind of like using void*, you know?

Decompress Crunch textures in a worker

Should be pretty straightforward to implement, though I'll want to include an option for keeping it in the main thread as well. Should make use of transferrables where available.

Alternative to this library

Hi, I see that you are not maintaining this library anymore.

I made a similar library, that can encode and decode compressed textures (including BC7) https://github.com/photopea/UTEX.js (and is only 25 kB). Could you please put the link to it into readme.md , so if somebody is looking for such thing, they can see it? :) Thanks!

DXT3/5 decoders

I am not sure if this repository has any relevance anymore, but it was a great help for me to get me started on DDS DXT images.

I added DXT3/5 decoders, so in case you want them, I am uploading them here.
I also added the color0 <= color1 condition in DXT1 decoding that you didn't put for some reason.

https://gist.github.com/flowtsohg/11306221

Optimizations are welcome :)

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.