Re: [osg-users] Timers for OSG Application
Hi Jeremy, Things worked out quite well. It also saved on extra thread for timer management :). Thanks a lot for your kind help! Cheers, Ankur -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42095#42095 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Timers for OSG Application
Dear All, I am making a scene graph in OSG and things are going great. Extensive support is available in forums and tutorials of OSG. Thanks a lot for that. I have one doubt. It may not be related to OSG but may be related general application development based on OSG. To update my scenegraph periodically, I want to use timer. I want a particular function to be called every few seconds or so. In GTK, I used to use g_timeout_add() function. However I believe OSG doesn't use g_main_loop() inside its render API. is it correct? Can some one tell me equivalent API for g_timeout_add() for OSG based application? or is there any other way to implement timer callback in OSG? Thanks in advance! Cheers, Ankur -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41972#41972 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Get pivot point information from ive/osg/3ds file.
Hi, I have made a machine object in 3D MAX. It has many parts which I would like to rotate on particular axes. For the same purpose, I have set pivot point for each objects in 3ds max and it works well for us. I want to use this object in OSG. Hence I exported it as ive file. Now I am confused how to get pivot point information from the file. when I read the file, it returns node which doesn't contain pivot information. if I just add the node to PAT and get pivot point, it return 0,0,0. I would like to know if there is any way by which I can get pivot point values present in 3dmax file into OSG. Thank you! Cheers, Ankur PS: I am using OSGExp1.0.0 and 3DS MAX 2012. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41540#41540 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and OpenGL ES 2.0
Hi Jorge, You are right. both are quire different. I ported OSG over OpenGL ES 2.0 and everything is behaving in different way. I guess I almost need to rewrite my OpenGL application. Also i think i need to go through ShaderGen to understand how well the OpenGL application gets converted to GLSL language. Cheers, Ankur -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38519#38519 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ShaderGen and OpenGL ES2
Hi Robert, I am using OSG 2.9.11 dev release. recently I have started working on OSG over GLES2. Although my OSG based code is working fine on OpenGL based system, i face similar issues that of Yun-Ta on GLES2. My test application is importing a plain 3ds max object onto screen along with light source. when i run the program, i get following output. libEGL warning: failed to create DRM screen libEGL warning: use software fallback GraphicsWindowX11::init() - eglInitialize() succeded eglMajorVersion=1 iMinorVersion=4 GraphicsWindowX11::init() - window created =1 VERTEX glCompileShader FAILED VERTEX Shader infolog: 0:0(0): error: `osg_Normal' redeclared 0:19(34): error: `gl_LightSource' undeclared 0:19(46): error: type mismatch FRAGMENT glCompileShader FAILED FRAGMENT Shader infolog: 0:20(20): error: syntax error, unexpected NEW_IDENTIFIER, expecting ',' or ';' glLinkProgram FAILED Program infolog: linking with uncompiled shaderlinking with uncompiled shader Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..) Warning: detected OpenGL error 'invalid enumerant' at end of SceneView::draw() Warning: detected OpenGL error 'invalid enumerant' after applying GLMode 0xb50 Warning: detected OpenGL error 'invalid enumerant' after applying GLMode 0xb50 Warning: detected OpenGL error 'invalid enumerant' after applying GLMode 0xb50 Warning: detected OpenGL error 'invalid enumerant' after applying GLMode 0xb50 Warning: detected OpenGL error 'invalid enumerant' after applying GLMode 0xb50 Warning: detected OpenGL error 'invalid enumerant' after applying GLMode 0xb50 I was just wondering if work on ShaderGen is going on in some other branch or something? or am i doing anything wrong here to run 3ds max object over GLES2? any help would be appreciated. Thanking you in anticipation. Regards, Ankur robertosfield wrote: Hi Yun-Ta, ShaderGen assumes OpenGL 2 feature set, so items like the built in gl_* uniforms and vertex attributes are used. osg::State does map automatically a number of these uniforms for GLE2 but doing a search and replace of them, this isn't exhaustive though. The work I'm just starting now on shader composition will make ShaderGen completely redundant and will properly support GLES 2, GL3 and GL4, so the issues you are seeing should disappear completely. Robert. On Wed, Jun 30, 2010 at 6:08 PM, wrote: 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
Re: [osg-users] OSG and OpenGL ES 2.0
Hi Christian, Thanks for your input and source code that you shared. I had tried your program however my application crashes with segmentation fault. when i check backtrace, it shows crashing point at the drivers (i am using intel i915 display). actually I am pretty new to OpenGL OpenGL ES too. so concept of Shader is new to me. So i think i need to go through shader first! :-) Also, i used OpenGL emulation for OSG build. now i think i will try by installing OpenGL ES library and perform build for actual GLES2. I will update you soon regarding my activities. Thanks again for help! Regards/Ankur Christian wrote: Hi, just one addition to my previous post: Normally you wouldn't define an extra vertex attribute array for the vertex color/normal as I did in this test code. Just use void Geometry::setColorArray(Array* array); void Geometry::setNormalArray(Array* array); and access the vertex color/normal in the vertex shader via osg_Color and osg_Normal (OSG will do the mapping for you). Cheers, Christian -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38291#38291 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG and OpenGL ES 2.0
Hi, I am a new member of OSG. I am using 2.9.11 (latest developer release) version of OSG. In last few weeks, I used OSG over OpenGL. All the examples and Tutorials that are posted on the site have been very useful in learning OSG. Now, I want to use OSG over OpenGL ES 2.0. For this, I have modified cmake variables accordingly to emulate OpenGL ES on my ubuntu system. However I can't seem to get any example work. I get many different kinds of errors as below. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Segmentation fault After going through old posts, i found that these examples won't work directly over OpenGL es. I would like to know if there are any examples available which i can use over OpenGL ES. It would really help me in figuring out if my OSG recompilation is successful and it will enable me to learn OSG over opengl ES. Thank you! Cheers, Ankur -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38244#38244 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org