summaryrefslogtreecommitdiffstats
path: root/o3d/samples/o3djs
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 23:41:11 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 23:41:11 +0000
commit760761bbccb2b6915a33551f4812b09e2ef9316c (patch)
tree6bd700729deab017aa008a7489bc09e4a6f65143 /o3d/samples/o3djs
parentd1e110ee14a03f8774e57d275033d1d532a89134 (diff)
downloadchromium_src-760761bbccb2b6915a33551f4812b09e2ef9316c.zip
chromium_src-760761bbccb2b6915a33551f4812b09e2ef9316c.tar.gz
chromium_src-760761bbccb2b6915a33551f4812b09e2ef9316c.tar.bz2
This change removes CG from O3D and uses GLSL
instead of HLSL. The current "hack" for shaders is that the shader string you supply to Effect::LoadFromFXString requires the lines // #o3d SplitMarker \n" Above which is the vertex shader and below which is the fragment shader. Since GLSL has no semantics the names are used for semantics so to get an automatically supplied worldViewProjection you must name the uniform worldViewProjection as in uniform mat4 worldViewProjection Similarly for attributes (vertex streams) you must name them to match O3D semantics as in attribute vec4 texcoord1 attribute vec3 normal etc. Included in this is one working sample in o3d/samples/hellocube-glsl.html Other things: Added a glsl field to clientInfo so that a program can check if it needs to supply GLSL or HLSL. eg client.clientInfo.glsl == true Updated the O3D libraries to store that info in o3djs.base.glsl so that the libaries can be modified to supply GLSL if we want. Note: To run this on windows you must copy glew32.dll and glut32.dll to <AppData>...\Mozilla\plugins To get this to actually work in GLES2 will require (*) renaming a few functions (*) telling O3D there is no NPOT support or if possible no NPOT support unless the texture has only 1 level. (*) removing LargeGeometry and FloatingPointTexture support. (*) Making it link with the GLES2 code Review URL: http://codereview.chromium.org/527028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35845 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3djs')
-rw-r--r--o3d/samples/o3djs/base.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/o3d/samples/o3djs/base.js b/o3d/samples/o3djs/base.js
index e7765c4..281f5bc 100644
--- a/o3d/samples/o3djs/base.js
+++ b/o3d/samples/o3djs/base.js
@@ -533,6 +533,12 @@ o3djs.base = o3djs.base || {};
o3djs.base.o3d = null;
/**
+ * Whether or not we need to use GLSL instead of HLSL.
+ * @type {boolean}
+ */
+o3djs.base.glsl = false;
+
+/**
* Snapshots the current state of all provided namespaces. This state will be
* used to initialize future V8 instances. It is automatically
* called by o3djs.util.makeClients.
@@ -577,6 +583,9 @@ o3djs.base.initV8 = function(clientObject) {
// Make sure this points to the o3d namespace for this particular
// instance of the plugin.
o3djs.base.o3d = plugin.o3d;
+
+ // Save off if we need GLSL.
+ o3djs.base.glsl = plugin.client.clientInfo.glsl;
};
clientObject.eval(v8Init.toString())(o3djs.v8Initializer_,
@@ -616,6 +625,8 @@ o3djs.base.init = function(clientObject) {
// the properties of an NPObject.
// Chrome bug: http://code.google.com/p/chromium/issues/detail?id=5743
o3djs.base.o3d = o3djs.base.o3d || clientObject.o3d;
+ // Save off if we need GLSL.
+ o3djs.base.glsl = clientObject.client.clientInfo.glsl;
};
/**