Hi all, I am trying to test OSG (2.9.8) on N900 with OpenGL ES2. However, ShaderGen.cpp seems to be not fully compatible with OpenGL ES2 standard.
For instance, gl_LightSource is not defined in ES2 and precision attribute (mediump / highp / lowp) has been missing. The later one can be easily fixed while the first one using undefined variables is more difficult to work around. Here is the GLSL code generated from ShaderGen.cpp: Nokia-N900:/home/user/osg-data# /opt/osg/bin/osgviewer cessna.osg GraphicsWindowX11::init() - eglInitialize() succeded eglMajorVersion=1 iMinorVersion=4 GraphicsWindowX11::init() - window created =1 State::convertShaderSourceToOsgBuiltIns() ++Before Converted source varying vec3 normalDir; varying vec3 lightDir; varying vec3 viewDir; void main() { gl_Position = ftransform(); normalDir = gl_NormalMatrix * gl_Normal; vec3 dir = -vec3(gl_ModelViewMatrix * gl_Vertex); viewDir = dir; vec4 lpos = gl_LightSource[0].position; if (lpos.w == 0.0) lightDir = lpos.xyz; else lightDir = lpos.xyz + dir; } ++++++++ -------- Converted source uniform mat3 osg_NormalMatrix; uniform mat4 osg_ModelViewProjectionMatrix; uniform mat4 osg_ModelViewMatrix; attribute vec4 osg_Vertex; attribute vec3 osg_Normal; varying vec3 normalDir; varying vec3 lightDir; varying vec3 viewDir; void main() { gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex; normalDir = osg_NormalMatrix * osg_Normal; vec3 dir = -vec3(osg_ModelViewMatrix * osg_Vertex); viewDir = dir; vec4 lpos = gl_LightSource[0].position; if (lpos.w == 0.0) lightDir = lpos.xyz; else lightDir = lpos.xyz + dir; } ---------------- VERTEX glCompileShader "" FAILED VERTEX Shader "" infolog: Compile failed. ERROR: 0:16: 'gl_LightSource' : undeclared identifer ERROR: 0:16: 'gl_LightSource' : left of '[' is not of type array, matrix, or vector ERROR: 0:16: 'position' : illegal vector field selection ERROR: 0:16: 'assign' : cannot convert from 'float' to '4-component vector of float' ERROR: 4 compilation errors. No code generated. FRAGMENT glCompileShader "" FAILED FRAGMENT Shader "" infolog: Compile failed. ERROR: 0:1: 'vec3' : No precision defined for this type ERROR: 0:2: 'vec3' : No precision defined for this type ERROR: 0:3: 'vec3' : No precision defined for this type ERROR: 0:7: 'vec4' : No precision defined for this type ERROR: 0:8: 'vec3' : No precision defined for this type ERROR: 0:9: 'vec3' : No precision defined for this type ERROR: 0:10: 'vec3' : No precision defined for this type ERROR: 0:11: 'vec4' : No precision defined for this type ERROR: 0:11: 'gl_FrontLightModelProduct' : undeclared identifer .... Any suggestion? Thanks. Best Regards, Yun-Ta _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org