Skip to content
Browse files

Updated to handle array name changes. Fixed default shader. Fixed vid…

…eosphere shader. Temporary fix added for videosphere video texture updates
  • Loading branch information...
1 parent 150bc10 commit 8a8457fb09569e88afec4f76941c4ed795b2a117 Benjamin DeLillo committed Sep 27, 2010
Showing with 26 additions and 13 deletions.
  1. +4 −0 examples/videosphere/texture.frag
  2. +1 −0 examples/videosphere/videosphere.html
  3. +2 −1 shaders/default.frag
  4. +3 −1 shaders/default.vert
  5. +3 −3 src/Texture.js
  6. +13 −8 src/webglu.js
View
4 examples/videosphere/texture.frag
@@ -1,3 +1,7 @@
+#ifdef GL_ES
+precision highp float;
+#endif
+
uniform sampler2D wglu_mat_texture0;
varying vec2 vTexCoord;
View
1 examples/videosphere/videosphere.html
@@ -110,6 +110,7 @@
document.getElementById('overlay').innerHTML = $W.FPS;
if ($W.textures.video.video.readyState === 2)
$W.textures.video.video.play();
+ $W.textures.video.update();
$W.update();
};
$W.start();
View
3 shaders/default.frag
@@ -1,6 +1,7 @@
#ifdef GL_ES
precision highp float;
#endif
+varying vec4 frontColor;
void main(void) {
- gl_FragColor = gl_Color;
+ gl_FragColor = frontColor;
}
View
4 shaders/default.vert
@@ -4,8 +4,10 @@ attribute vec3 color;
uniform mat4 ProjectionMatrix;
uniform mat4 ModelViewMatrix;
+varying vec4 frontColor;
+
void main(void) {
- gl_FrontColor = vec4(color,1.0);
+ frontColor = vec4(color,1.0);
gl_Position = ProjectionMatrix * ModelViewMatrix * vec4(vertex, 1.0);
}
View
6 src/Texture.js
@@ -68,11 +68,11 @@ $W.VideoTexture = function(name, src) {
this.update = function() {
var gl = $W.GL;
- this.texture.bind();
+ this.bind();
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA,
gl.UNSIGNED_BYTE, this.video);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
+ //gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
+ //gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
//gl.generateMipmap(gl.TEXTURE_2D);
//gl.bindTexture(gl.TEXTURE_2D, null); // clean up after ourselves
}
View
21 src/webglu.js
@@ -579,10 +579,16 @@ $W = {
* Pass `false` to skip init of WebGL subsystem.
*/
initialize:function $W_initialize(canvasNode) {
+
+ // Some hacks for running in both the shell and browser,
+ // and for supporting F32 and WebGLFloat arrays
+
$W.initLogging();
$W.log("Initializing WebGLU");
$W.util.include($W.paths.libsrc + 'Util.js');
+ try { WebGLFloatArray; } catch (x) { WebGLFloatArray = Float32Array; }
+ try { WebGLUnsignedShortArray; } catch (x) { WebGLUnsignedShortArray = Uint16Array; }
$W.util.extendArray();
$W.util.loadSylvester();
@@ -690,6 +696,13 @@ $W = {
}
};
+$W.LL = {
+DEBUG :0,
+ INFO :1,
+ NOTE :2,
+ WARN :3
+};
+$W.loglevel = $W.LL.NOTE;
$W.initLogging = function() {
if (window.console === undefined) {
console = {};
@@ -698,12 +711,6 @@ $W.initLogging = function() {
if (console.log === undefined) {
console.log = function(){};
}else {
- $W.LL = {
- DEBUG :0,
- INFO :1,
- NOTE :2,
- WARN :3
- };
$W.logPrefix = '\t';
$W.logIndentAmount = 0;
$W.getLogPrefix = function() {
@@ -716,8 +723,6 @@ $W.initLogging = function() {
$W.indentLog = function(){$W.logIndentAmount++;};
$W.dedentLog = function(){$W.logIndentAmount--;};
-
- $W.loglevel = $W.LL.NOTE;
$W.log = function(message, level) {
if (typeof(level) === 'undefined') {level = $W.LL.NOTE;}

0 comments on commit 8a8457f

Please sign in to comment.
Something went wrong with that request. Please try again.