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

Opera WebGL #672

Closed
ralfnap opened this issue Oct 21, 2011 · 5 comments
Closed

Opera WebGL #672

ralfnap opened this issue Oct 21, 2011 · 5 comments
Labels

Comments

@ralfnap
Copy link

ralfnap commented Oct 21, 2011

three.js WebGl - Rendering with Opera does not work.
Other samples work well: http://www.khronos.org/webgl/wiki/Demo_Repository

@mrdoob
Copy link
Owner

mrdoob commented Oct 21, 2011

Any error on the console?

@ralfnap
Copy link
Author

ralfnap commented Oct 22, 2011

Thank you for your quick answer.

Look at this sample: http://mrdoob.github.com/three.js/examples/webgl_materials.html

I use Opera: Version
11.50 labs

Build
24661

Platform
Win32

System
Windows NT 6.1

Vega backend
OpenGL

Console log:

JavaScript - http://mrdoob.github.com/three.js/examples/webgl_materials.html
Inline script thread
Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.99 Version/11.50 | WebGL 1.0 | Opera Software | Vega | WebGL GLSL ES 1.0
JavaScript - http://mrdoob.github.com/three.js/examples/webgl_materials.html
WebGL shader validation
60: P0003: Unknown CPP identifier: MAX_DIR_LIGHTS
JavaScript - http://mrdoob.github.com/three.js/examples/webgl_materials.html
WebGL shader validation
107: P0003: Unknown CPP identifier: MAX_DIR_LIGHTS
JavaScript - http://mrdoob.github.com/three.js/examples/webgl_materials.html
Inline script thread
60: P0003: Unknown CPP identifier: MAX_DIR_LIGHTS
107: P0003: Unknown CPP identifier: MAX_DIR_LIGHTS
JavaScript - http://mrdoob.github.com/three.js/examples/webgl_materials.html
Inline script thread
#define VERTEX_TEXTURES
#define MAX_DIR_LIGHTS 1
#define MAX_POINT_LIGHTS 1
#define MAX_SHADOWS 0
#define MAX_BONES 50
#define USE_MAP
#define SHADOWMAP_SOFT
uniform mat4 objectMatrix;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat3 normalMatrix;
uniform vec3 cameraPosition;
uniform mat4 cameraInverseMatrix;
attribute vec3 position;
attribute vec3 normal;
attribute vec2 uv;
attribute vec2 uv2;
#ifdef USE_COLOR
attribute vec3 color;
#endif
#ifdef USE_MORPHTARGETS
attribute vec3 morphTarget0;
attribute vec3 morphTarget1;
attribute vec3 morphTarget2;
attribute vec3 morphTarget3;
attribute vec3 morphTarget4;
attribute vec3 morphTarget5;
attribute vec3 morphTarget6;
attribute vec3 morphTarget7;
#endif
#ifdef USE_SKINNING
attribute vec4 skinVertexA;
attribute vec4 skinVertexB;
attribute vec4 skinIndex;
attribute vec4 skinWeight;
#endif
varying vec3 vLightWeighting;
#ifdef USE_MAP
varying vec2 vUv;
uniform vec4 offsetRepeat;
#endif
#ifdef USE_LIGHTMAP
varying vec2 vUv2;
#endif
#ifdef USE_ENVMAP
varying vec3 vReflect;
uniform float refractionRatio;
uniform bool useRefract;
#endif
uniform bool enableLighting;
uniform vec3 ambientLightColor;
#if MAX_DIR_LIGHTS > 0
uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];
uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];
#endif
#if MAX_POINT_LIGHTS > 0
uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];
uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];
uniform float pointLightDistance[ MAX_POINT_LIGHTS ];
#endif
#ifdef USE_COLOR
varying vec3 vColor;
#endif
#ifdef USE_SKINNING
uniform mat4 boneGlobalMatrices[ MAX_BONES ];
#endif
#ifdef USE_MORPHTARGETS
uniform float morphTargetInfluences[ 8 ];
#endif
#ifdef USE_SHADOWMAP
varying vec4 vShadowCoord[ MAX_SHADOWS ];
uniform mat4 shadowMatrix[ MAX_SHADOWS ];
#endif
void main() {
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
#ifdef USE_MAP
vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
#endif
#ifdef USE_LIGHTMAP
vUv2 = uv2;
#endif
#ifdef USE_ENVMAP
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
vec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;
if ( useRefract ) {
vReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );
} else {
vReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );
}
#endif
#ifdef USE_COLOR
vColor = color;
#endif
vec3 transformedNormal = normalize( normalMatrix * normal );
if ( !enableLighting ) {
vLightWeighting = vec3( 1.0 );
} else {
vLightWeighting = ambientLightColor;
#if MAX_DIR_LIGHTS > 0
for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {
vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );
float directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );
vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;
}
#endif
#if MAX_POINT_LIGHTS > 0
for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {
vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );
vec3 lVector = lPosition.xyz - mvPosition.xyz;
float lDistance = 1.0;
if ( pointLightDistance[ i ] > 0.0 )
lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );
lVector = normalize( lVector );
float pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );
vLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;
}
#endif
}
#ifdef USE_SKINNING
gl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;
gl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;
gl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;
#endif
#ifdef USE_MORPHTARGETS
vec3 morphed = vec3( 0.0, 0.0, 0.0 );
morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
morphed += position;
gl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );
#endif
#ifndef USE_MORPHTARGETS
#ifndef USE_SKINNING
gl_Position = projectionMatrix * mvPosition;
#endif
#endif
#ifdef USE_SHADOWMAP
for( int i = 0; i < MAX_SHADOWS; i ++ ) {
vShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );
}
#endif
}
JavaScript - http://mrdoob.github.com/three.js/examples/webgl_materials.html
Inline script thread
Could not initialise shader
VALIDATE_STATUS: false, gl error [1281]
JavaScript - http://mrdoob.github.com/three.js/examples/webgl_materials.html
WebGL shader validation
60: P0003: Unknown CPP identifier: MAX_DIR_LIGHTS
JavaScript - http://mrdoob.github.com/three.js/examples/webgl_materials.html
WebGL shader validation
107: P0003: Unknown CPP identifier: MAX_DIR_LIGHTS
JavaScript - http://mrdoob.github.com/three.js/examples/webgl_materials.html
Inline script thread
60: P0003: Unknown CPP identifier: MAX_DIR_LIGHTS
107: P0003: Unknown CPP identifier: MAX_DIR_LIGHTS
JavaScript - http://mrdoob.github.com/three.js/examples/webgl_materials.html
Inline script thread
#define VERTEX_TEXTURES
#define MAX_DIR_LIGHTS 1
#define MAX_POINT_LIGHTS 1
#define MAX_SHADOWS 0
#define MAX_BONES 50
#define SHADOWMAP_SOFT
uniform mat4 objectMatrix;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat3 normalMatrix;
uniform vec3 cameraPosition;
uniform mat4 cameraInverseMatrix;
attribute vec3 position;
attribute vec3 normal;
attribute vec2 uv;
attribute vec2 uv2;
#ifdef USE_COLOR
attribute vec3 color;
#endif
#ifdef USE_MORPHTARGETS
attribute vec3 morphTarget0;
attribute vec3 morphTarget1;
attribute vec3 morphTarget2;
attribute vec3 morphTarget3;
attribute vec3 morphTarget4;
attribute vec3 morphTarget5;
attribute vec3 morphTarget6;
attribute vec3 morphTarget7;
#endif
#ifdef USE_SKINNING
attribute vec4 skinVertexA;
attribute vec4 skinVertexB;
attribute vec4 skinIndex;
attribute vec4 skinWeight;
#endif
varying vec3 vLightWeighting;
#ifdef USE_MAP
varying vec2 vUv;
uniform vec4 offsetRepeat;
#endif
#ifdef USE_LIGHTMAP
varying vec2 vUv2;
#endif
#ifdef USE_ENVMAP
varying vec3 vReflect;
uniform float refractionRatio;
uniform bool useRefract;
#endif
uniform bool enableLighting;
uniform vec3 ambientLightColor;
#if MAX_DIR_LIGHTS > 0
uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];
uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];
#endif
#if MAX_POINT_LIGHTS > 0
uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];
uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];
uniform float pointLightDistance[ MAX_POINT_LIGHTS ];
#endif
#ifdef USE_COLOR
varying vec3 vColor;
#endif
#ifdef USE_SKINNING
uniform mat4 boneGlobalMatrices[ MAX_BONES ];
#endif
#ifdef USE_MORPHTARGETS
uniform float morphTargetInfluences[ 8 ];
#endif
#ifdef USE_SHADOWMAP
varying vec4 vShadowCoord[ MAX_SHADOWS ];
uniform mat4 shadowMatrix[ MAX_SHADOWS ];
#endif
void main() {
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
#ifdef USE_MAP
vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
#endif
#ifdef USE_LIGHTMAP
vUv2 = uv2;
#endif
#ifdef USE_ENVMAP
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
vec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;
if ( useRefract ) {
vReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );
} else {
vReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );
}
#endif
#ifdef USE_COLOR
vColor = color;
#endif
vec3 transformedNormal = normalize( normalMatrix * normal );
if ( !enableLighting ) {
vLightWeighting = vec3( 1.0 );
} else {
vLightWeighting = ambientLightColor;
#if MAX_DIR_LIGHTS > 0
for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {
vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );
float directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );
vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;
}
#endif
#if MAX_POINT_LIGHTS > 0
for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {
vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );
vec3 lVector = lPosition.xyz - mvPosition.xyz;
float lDistance = 1.0;
if ( pointLightDistance[ i ] > 0.0 )
lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );
lVector = normalize( lVector );
float pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );
vLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;
}
#endif
}
#ifdef USE_SKINNING
gl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;
gl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;
gl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;
#endif
#ifdef USE_MORPHTARGETS
vec3 morphed = vec3( 0.0, 0.0, 0.0 );
morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
morphed += position;
gl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );
#endif
#ifndef USE_MORPHTARGETS
#ifndef USE_SKINNING
gl_Position = projectionMatrix * mvPosition;
#endif
#endif
#ifdef USE_SHADOWMAP
for( int i = 0; i < MAX_SHADOWS; i ++ ) {
vShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );
}
#endif
}
JavaScript - http://mrdoob.github.com/three.js/examples/webgl_materials.html
Inline script thread
Could not initialise shader
VALIDATE_STATUS: false, gl error [1281]

@ralfnap ralfnap closed this as completed Oct 22, 2011
@alteredq
Copy link
Contributor

Looks like Opera's GLSL shader parser has troubles digesting some preprocessor instructions.

My Opera 12 just updated to build 1116 and this example works ok, though I do get different problems elsewhere.

It's still just alpha version, bugs are expected. Three.js will probably be hit by them more as we use a lot of WebGL features (used to happen with Chrome too).

@ralfnap
Copy link
Author

ralfnap commented Oct 22, 2011

thank you.

@ralfnap
Copy link
Author

ralfnap commented Oct 22, 2011

Just tested Opera 12 alpha. Works fine. Thank you.
Thank you mrdoob for three.js
We have a online artgallery (www.artfolio.de) (Sorry, still all in German)
And we plan to build a 3D-gallery. Here ist our alpha Version: http://www.artfolio.de/galerie3d.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants