[osg-users] Segmentation fault -- resizeGLObjectBuffers
Hello, I want to render a Group in a pre render step and my camera is a child of this group. So I created a loop (maybe it is a little bit dirty). Group -- Camera (pre-render) -- ^| || When I want to run my application, I got this error: [Thread debugging using libthread_db enabled] Using host libthread_db library /lib64/libthread_db.so.1. Program received signal SIGSEGV, Segmentation fault. 0x0030215bcdd3 in osg::Node::resizeGLObjectBuffers(unsigned int) () from /usr/lib64/libosg.so.80 Is the loop the problem? Was that to be expected? Or is this maybe a untested situation? Thanks Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Render depth into texture with 32 bits
Hello, how many bits are used by the GL_DEPTH_COMPONENT? I want to render the depth buffer value into a texture and use the internal texture format GL_DEPTH_COMPONENT. I would like use 24 or 32 bits for this value so I try GL_DEPTH_COMPONENT24 and GL_DEPTH_COMPONENT32 as internal format, but the rendering doesn't work. Only the GL_DEPTH_COMPONENT works, but I don't know how many bits are used. Is the number of bits depending on the Z-Buffer? My Z-Buffer use 24 bits. Following the error message of GL_DEPTH_COMPONENT24: - Using host libthread_db library /lib64/libthread_db.so.1. RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cd6 Warning: FrameBufferObject: could not create the FBO RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x0 Warning: FrameBufferObject: could not create the FBO RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x0 FRAGMENT glCompileShader FAILED FRAGMENT glCompileShader FAILED glLinkProgram FAILED Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render depth into texture with 32 bits
Hello Sergey, thanks, it works! :-) Should I change the number of depth buffer bits? GL_DEPTH_BITS is 24, so I think it doesn't make sense to save this into 32 bit. Or is this independent if the GL_DEPTH_BITS? Cheers Martin Original-Nachricht Datum: Wed, 04 Jul 2012 14:13:11 +0400 Von: Sergey Polischuk pol...@yandex.ru An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Render depth into texture with 32 bits Hi, Martin try this: texture2D-setSourceFormat(GL_DEPTH_COMPONENT); texture2D-setInternalFormat(GL_DEPTH_COMPONENT32); texture2D-setSourceType(GL_UNSIGNED_INT); Cheers, Sergey. 04.07.2012, 14:06, Martin Groer grosser.mar...@gmx.de: Hello, how many bits are used by the GL_DEPTH_COMPONENT? I want to render the depth buffer value into a texture and use the internal texture format GL_DEPTH_COMPONENT. I would like use 24 or 32 bits for this value so I try GL_DEPTH_COMPONENT24 and GL_DEPTH_COMPONENT32 as internal format, but the rendering doesn't work. Only the GL_DEPTH_COMPONENT works, but I don't know how many bits are used. Is the number of bits depending on the Z-Buffer? My Z-Buffer use 24 bits. Following the error message of GL_DEPTH_COMPONENT24: - Using host libthread_db library /lib64/libthread_db.so.1. RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cd6 Warning: FrameBufferObject: could not create the FBO RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x0 Warning: FrameBufferObject: could not create the FBO RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x0 FRAGMENT glCompileShader FAILED FRAGMENT glCompileShader FAILED glLinkProgram FAILED Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] TransformFeedbackBufferBinding
Hello, there are anyone who has experience with the osg::TransformFeedbackBufferBinding class? How can I use it? Have someone a little example? Thanks Martin -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] transform feedback implementation
Hello, today I want to share my experiment with transform feedback. I implemented an example from the book OpenGL Superbible, Fifth Edition. In Chapter 11 there is a spring mass system example. The aim is the calculation of the physics into the vertex shader. The result should have to transfer with transform feedback into a second buffer (ping pong) and this buffer have to rendered. I was a little bit overextended with this in osg, because there was no support for this. Also I implemented this in OpenGL and after this I do the same in a osg::Drawable (drawImplementation function) in my osg example. A positive fact is I see something in my osg example, but it doesn't do the same like the opengl example. It looks strange and I don't have any idea what's wrong. :-( I attached the two examples to this e-mail. I someone want to test the examples, I use cmake an I wrote a shell script, which creates a build and a release directory and execute cmake in the build directory. The osgDemo and the shader file are moved to the release directory when you do 'make install'. Following a short overview of the examples: opengl_transform_feedback.7z - main.cpp -- main function - mycallbacks(.cpp/.h) -- glut callback functions - springmasssystem(.cpp/.h) -- spring mass object (init and draw function) - spring_mass.vert -- vertex shader (spring mass physics) osg_transform_feedback.7z - main.cpp -- main function (osgviewer) - myextensions.h -- extension class (base class is osg::GL2Extensions) - springmasssystem(.cpp/.h) -- drawable class (spring mass system) - spring_mass.vert I hope some osg users are interested in this topic and have some ideas. Thanks! Martin -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a opengl_transform_feedback.7z Description: application/7z-compressed osg_transform_feedback.7z Description: application/7z-compressed ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Drawable and OpenGL Extensions
Hello, I have tried to implement transform feedback in openscenegraph. I posted this few weeks ago. Now I have a nice OpenGL example and want to transfer this to an osg implementation. In a first (more simple) example, I want to create a vertex array object and a vertex buffer object. I create a OpenGL version and a OpenSceneGraph version. But my OSG version doesn't work. In the OSG version I create my own extension class with the VAO and VBO stuff. After this I create my own drawable type, which should draw four vertices, but I see nothing. :-( What is my mistake? Cheers Martin PS: Here is the OpenGL code: -- #include GL/glew.h #include GL/gl.h #include GL/glut.h // Buffers GLuint myVAO; GLuint myVBO; // Vertex Data unsigned int m,n,numVerts; // number of horizontal verts float* pm_data; // data pointer void myInit(void) { // Vertex Data m = 2; // number of horizontal verts n = 2; // number of vertical verts numVerts = m*n; pm_data = new float[numVerts*4]; // generate position mass data float x = 0.0; float y = 0.0; float dx = 1.0/(m-1); float dy = 1.0/(n-1); for(unsigned int i=0; i numVerts; i++) { pm_data[i*4] = x; // x pm_data[i*4+1] = y; // y pm_data[i*4+2] = 0.0; // z pm_data[i*4+3] = 1.0; // mass x += dx; if(!((i+1)%m)) { y += dy; x = 0.0; } } // position data are finished // init VAO glGenVertexArrays(1,myVAO); // init VBO glGenBuffers(1,myVBO); // bind VAO and push data into VBO glBindVertexArray(myVAO); glBindBuffer(GL_ARRAY_BUFFER,myVBO); glBufferData(GL_ARRAY_BUFFER, numVerts*sizeof(float)*4, (pm_data[0]), GL_DYNAMIC_COPY); glEnableVertexAttribArray(0); glVertexAttribPointer(0,4,GL_FLOAT,GL_FALSE,0,0); glBindVertexArray(0); } void myDrawImplementation(void) { glPointSize(5); glBindVertexArray(myVAO); glDrawArrays(GL_POINTS,0,numVerts); glBindVertexArray(0); } void RenderScene(void) { // Draw myVBO myDrawImplementation(); // Flush drawing commands (and swap) glutSwapBuffers(); } int main (int argc, char* argv[]) { // initialise glut glutInit(argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutInitWindowSize(512,512); glutCreateWindow(Simple (Hello World)); glutDisplayFunc(RenderScene); // initialise glew glewInit(); // initialise VAO myInit(); // execution loop glutMainLoop(); return 0; } Here is my osg code: #include osgViewer/Viewer #include osg/Geode #include osg/Drawable #include osg/GLExtensions #include GL/gl.h class MyExtensions { public: MyExtensions() { // Generate Vertex Array Object if(!osg::setGLExtensionFuncPtr(_glGenVertexArrays,glGenVertexArrays)) osg::setGLExtensionFuncPtr(_glGenVertexArrays,glGenVertexArrays); // Bind Vertex Array Object if(!osg::setGLExtensionFuncPtr(_glBindVertexArray,glBindVertexArray)) osg::setGLExtensionFuncPtr(_glBindVertexArray,glBindVertexArray); // Generate Buffer Object if(!osg::setGLExtensionFuncPtr(_glGenBuffers,glGenBuffers)) osg::setGLExtensionFuncPtr(_glGenBuffers,glGenBuffers); // Bind Buffer Object if(!osg::setGLExtensionFuncPtr(_glBindBuffer,glBindBuffer)) osg::setGLExtensionFuncPtr(_glBindBuffer,glBindBuffer); // Buffer Data if(!osg::setGLExtensionFuncPtr(_glBufferData,glBufferData)) osg::setGLExtensionFuncPtr(_glBufferData,glBufferData); // Enable Vertex Attribute Array if(!osg::setGLExtensionFuncPtr(_glEnableVertexAttribArray,glEnableVertexAttribArray)) osg::setGLExtensionFuncPtr(_glEnableVertexAttribArray,glEnableVertexAttribArray); // Vertex Attribute Pointer if(!osg::setGLExtensionFuncPtr(_glVertexAttribPointer,glVertexAttribPointer)) osg::setGLExtensionFuncPtr(_glVertexAttribPointer,glVertexAttribPointer); } // Vertex Array generate function void glGenVertexArrays(GLsizei n, GLuint* arrays) const { _glGenVertexArrays(n,arrays); } // Vertex Array bind function void glBindVertexArray(GLuint array) const { _glBindVertexArray(array); } // Enable Vertex Attribute Array void glEnableVertexAttribArray(GLuint index) const { _glEnableVertexAttribArray(index); } // define an array of generic vertex attribute data void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized,GLsizei stride, const GLvoid* pointer) const { _glVertexAttribPointer(index,size,type,normalized,stride,pointer); } // Buffer generate function void glGenBuffers(GLsizei n, GLuint* buffers) const { _glGenBuffers(n,buffers); } // Buffer bind function void glBindBuffer(GLenum target, GLuint buffer) const { _glBindBuffer(target,buffer); } // Buffer data function void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) const {
Re: [osg-users] Drawable and OpenGL Extensions
Hello, I've got it! I initialise all in the first draw implementation call and then all works fine. I have to set all members to mutable, that was the tricky part! Cheers Martin Original-Nachricht Datum: Tue, 24 Apr 2012 15:48:53 +0200 Von: Martin Großer grosser.mar...@gmx.de An: osg-users@lists.openscenegraph.org Betreff: [osg-users] Drawable and OpenGL Extensions Hello, I have tried to implement transform feedback in openscenegraph. I posted this few weeks ago. Now I have a nice OpenGL example and want to transfer this to an osg implementation. In a first (more simple) example, I want to create a vertex array object and a vertex buffer object. I create a OpenGL version and a OpenSceneGraph version. But my OSG version doesn't work. In the OSG version I create my own extension class with the VAO and VBO stuff. After this I create my own drawable type, which should draw four vertices, but I see nothing. :-( What is my mistake? Cheers Martin PS: Here is the OpenGL code: -- #include GL/glew.h #include GL/gl.h #include GL/glut.h // Buffers GLuint myVAO; GLuint myVBO; // Vertex Data unsigned int m,n,numVerts; // number of horizontal verts float* pm_data; // data pointer void myInit(void) { // Vertex Data m = 2; // number of horizontal verts n = 2; // number of vertical verts numVerts = m*n; pm_data = new float[numVerts*4]; // generate position mass data float x = 0.0; float y = 0.0; float dx = 1.0/(m-1); float dy = 1.0/(n-1); for(unsigned int i=0; i numVerts; i++) { pm_data[i*4] = x; // x pm_data[i*4+1] = y; // y pm_data[i*4+2] = 0.0; // z pm_data[i*4+3] = 1.0; // mass x += dx; if(!((i+1)%m)) { y += dy; x = 0.0; } } // position data are finished // init VAO glGenVertexArrays(1,myVAO); // init VBO glGenBuffers(1,myVBO); // bind VAO and push data into VBO glBindVertexArray(myVAO); glBindBuffer(GL_ARRAY_BUFFER,myVBO); glBufferData(GL_ARRAY_BUFFER, numVerts*sizeof(float)*4, (pm_data[0]), GL_DYNAMIC_COPY); glEnableVertexAttribArray(0); glVertexAttribPointer(0,4,GL_FLOAT,GL_FALSE,0,0); glBindVertexArray(0); } void myDrawImplementation(void) { glPointSize(5); glBindVertexArray(myVAO); glDrawArrays(GL_POINTS,0,numVerts); glBindVertexArray(0); } void RenderScene(void) { // Draw myVBO myDrawImplementation(); // Flush drawing commands (and swap) glutSwapBuffers(); } int main (int argc, char* argv[]) { // initialise glut glutInit(argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutInitWindowSize(512,512); glutCreateWindow(Simple (Hello World)); glutDisplayFunc(RenderScene); // initialise glew glewInit(); // initialise VAO myInit(); // execution loop glutMainLoop(); return 0; } Here is my osg code: #include osgViewer/Viewer #include osg/Geode #include osg/Drawable #include osg/GLExtensions #include GL/gl.h class MyExtensions { public: MyExtensions() { // Generate Vertex Array Object if(!osg::setGLExtensionFuncPtr(_glGenVertexArrays,glGenVertexArrays)) osg::setGLExtensionFuncPtr(_glGenVertexArrays,glGenVertexArrays); // Bind Vertex Array Object if(!osg::setGLExtensionFuncPtr(_glBindVertexArray,glBindVertexArray)) osg::setGLExtensionFuncPtr(_glBindVertexArray,glBindVertexArray); // Generate Buffer Object if(!osg::setGLExtensionFuncPtr(_glGenBuffers,glGenBuffers)) osg::setGLExtensionFuncPtr(_glGenBuffers,glGenBuffers); // Bind Buffer Object if(!osg::setGLExtensionFuncPtr(_glBindBuffer,glBindBuffer)) osg::setGLExtensionFuncPtr(_glBindBuffer,glBindBuffer); // Buffer Data if(!osg::setGLExtensionFuncPtr(_glBufferData,glBufferData)) osg::setGLExtensionFuncPtr(_glBufferData,glBufferData); // Enable Vertex Attribute Array if(!osg::setGLExtensionFuncPtr(_glEnableVertexAttribArray,glEnableVertexAttribArray)) osg::setGLExtensionFuncPtr(_glEnableVertexAttribArray,glEnableVertexAttribArray); // Vertex Attribute Pointer if(!osg::setGLExtensionFuncPtr(_glVertexAttribPointer,glVertexAttribPointer)) osg::setGLExtensionFuncPtr(_glVertexAttribPointer,glVertexAttribPointer); } // Vertex Array generate function void glGenVertexArrays(GLsizei n, GLuint* arrays) const { _glGenVertexArrays(n,arrays); } // Vertex Array bind function void glBindVertexArray(GLuint array) const { _glBindVertexArray(array); } // Enable Vertex Attribute Array void glEnableVertexAttribArray(GLuint index) const { _glEnableVertexAttribArray(index); } // define an array of generic vertex attribute data void glVertexAttribPointer(GLuint index, GLint size, GLenum type
Re: [osg-users] Help compiling example program
Hello James, what do you use? Linux or Windows? Did you build osg or did you use the binaries? I use Linux and osg from the repository. I don't need any extra setup, because /usr/lib64/ is in the search path. By the way, I use the gcc-c++. If I build osg, I export environment variables: export OSG301_LIB=pathToOSG/lib64 export OSG301_INC=pathToOSG/include And I use these in cmake: NCLUDE_DIRECTORIES($ENV{OSG301_INC}) LINK_DIRECTORIES($ENV{OSG301_LIB}) Cheers, Martin Original-Nachricht Datum: Fri, 2 Mar 2012 12:42:52 - Von: Martin Naylor martinnay...@virginmedia.com An: osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Help compiling example program Hi James, Looks like it's an easy one to answer, so I will give it a go: It looks like the path to OSG is not set correctly or it doesn’t know where to find your include/lib files. The paths to OSG will need to added to your development environment, not sure what you are using. Regards Martin -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of James Morgan Sent: 02 March 2012 11:56 To: osg-users@lists.openscenegraph.org Subject: [osg-users] Help compiling example program Hi, Code: # g++ BasicGeometry.cpp Code: BasicGeometry.cpp:1:20: error: osg/Node: No such file or directory BasicGeometry.cpp:2:21: error: osg/Group: No such file or directory BasicGeometry.cpp:3:21: error: osg/Geode: No such file or directory BasicGeometry.cpp:4:24: error: osg/Geometry: No such file or directory BasicGeometry.cpp:5:25: error: osg/Texture2D: No such file or directory BasicGeometry.cpp:6:27: error: osgDB/ReadFile: No such file or directory BasicGeometry.cpp:7:28: error: osgViewer/Viewer: No such file or directory BasicGeometry.cpp:8:41: error: osg/PositionAttitudeTransform: No such file or directory BasicGeometry.cpp:9:38: error: osgGA/TrackballManipulator: No such file or directory BasicGeometry.cpp: In function ‘int main()’: BasicGeometry.cpp:12: error: ‘osgViewer’ has not been declared BasicGeometry.cpp:12: error: expected ‘;’ before ‘viewer’ BasicGeometry.cpp:13: error: ‘osg’ has not been declared . . . I figure I need to set up some environment variable, but I can find nothing on the documentation page about how to do this. Help please, thanks. Cheers, James -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45982#45982 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG
Hello Sergey, thank you, it is good to know. I am a little bit frustrated. I read about OpenGL 4.2 and transform feedback and was so happy about this. That sounds so easy to use. By now it is hard to implement a simple first example. :-( I found this thread: http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg46962.html You made this example, right? So far, I don't understand all the stuff. Is this all necessary for transform feedback? I only need the follow functions, don't I? 1. glTransformFeedbackVaryings 2. glBindBufferBase 3. glBeginTransformFeedback 4. glEndTransformFeedback For example, is a loadShaderFromFile function necessary? Is this only necessary, because the glTransformFeedbackVaryings have to be between the compiling and linking of the shader? I think my first problem is I don't have any experience with OpenGL code embedded into osg code. Are there any examples, tutorials or articles about this? I will keep on trying! Cheers, Martin Original-Nachricht Datum: Thu, 01 Mar 2012 19:34:42 +0400 Von: Sergey Polischuk pol...@yandex.ru An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG Generally you should use interfaces provided by osg to get to opengl functions, as they can have different pointers in different graphics contexts. so it goes like typedef void (APIENTRY * TransformFeedbackVaryings)(GLuint, GLsizei, const GLchar **, GLenum); TransformFeedbackVaryings _glTransformFeedbackVaryingsPtr; if (!osg::setGLExtensionFuncPtr(_glTransformFeedbackVaryingsPtr, glTransformFeedbackVaryings )) if (!osg::setGLExtensionFuncPtr(_glTransformFeedbackVaryingsPtr, glTransformFeedbackVaryingsEXT )) //not supported :( // so now you can use this pointer in this gc also if you need some opengl functions, first check osg::GL2Extensions, it may be already wrapped and initialized there. All of this should be called with active graphics context Cheers 29.02.2012, 18:22, Martin Groer grosser.mar...@gmx.de: Hello, I tried this in my camera draw callback: virtual void operator()(const osg::Camera camera) const { // GL-Context-ID GLuint gcID = _gc-getState()-getContextID(); // GL-Program-Handle osg::Program::PerContextProgram* pcp = _program-getPCP(gcID); GLuint prID=pcp-getHandle(); const char* varyings[1] = { vPosition }; glTransformFeedbackVaryings(prID, 1, varyings, GL_SEPARATE_ATTRIBS); } But when I want to compile this, I get the error glTransformFeedbackVaryings isn't defined. I searched in my includes and it is in the glext.h and glew.h defined. What is wrong? Cheers, Martin Original-Nachricht Datum: Tue, 28 Feb 2012 10:45:16 -0700 Von: Paul Martz pma...@skew-matrix.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG On 2/28/2012 9:10 AM, Martin Großer wrote: Hello Paul, In OpenGL I have to define the varying variables for the transform feedback between the compiling and linking of the shader program. glTransformFeedbackVaryings(programHandle, 1, varyings, GL_SEPARATE_ATTRIBS); How can I do this in OSG? The same way. You can issue an OpenGL call any time you have a current context (Camera pre draw callback, Drawable draw callback, etc). A quick glance at the Program header file reveals that you can get the program ID with a call to: osg::Program::getPCP(contextID)-getHandle(); Additinally I use osg 2.8.4 from the Fedora repository. Cheers, Martin Original-Nachricht Datum: Mon, 27 Feb 2012 09:51:15 -0700 Von: Paul Martzpma...@skew-matrix.com An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG Yes, it's possible, but there are no examples that I know of. You might try binding a buffer object in a Camera pre-draw callback, for an example of one strategy. -Paul On 2/27/2012 8:21 AM, Martin Großer wrote: Hello, Is it possible to use GL_TRANSFORM_FEEDBACK_BUFFER_NV extension in osg? I would like write back my vertex position data into a new Vertex Buffer Object. Is there any example about this? Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
Re: [osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG
Hello, I tried this in my camera draw callback: virtual void operator()(const osg::Camera camera) const { // GL-Context-ID GLuint gcID = _gc-getState()-getContextID(); // GL-Program-Handle osg::Program::PerContextProgram* pcp = _program-getPCP(gcID); GLuint prID=pcp-getHandle(); const char* varyings[1] = { vPosition }; glTransformFeedbackVaryings(prID, 1, varyings, GL_SEPARATE_ATTRIBS); } But when I want to compile this, I get the error glTransformFeedbackVaryings isn't defined. I searched in my includes and it is in the glext.h and glew.h defined. What is wrong? Cheers, Martin Original-Nachricht Datum: Tue, 28 Feb 2012 10:45:16 -0700 Von: Paul Martz pma...@skew-matrix.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG On 2/28/2012 9:10 AM, Martin Großer wrote: Hello Paul, In OpenGL I have to define the varying variables for the transform feedback between the compiling and linking of the shader program. glTransformFeedbackVaryings(programHandle, 1, varyings, GL_SEPARATE_ATTRIBS); How can I do this in OSG? The same way. You can issue an OpenGL call any time you have a current context (Camera pre draw callback, Drawable draw callback, etc). A quick glance at the Program header file reveals that you can get the program ID with a call to: osg::Program::getPCP(contextID)-getHandle(); Additinally I use osg 2.8.4 from the Fedora repository. Cheers, Martin Original-Nachricht Datum: Mon, 27 Feb 2012 09:51:15 -0700 Von: Paul Martzpma...@skew-matrix.com An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG Yes, it's possible, but there are no examples that I know of. You might try binding a buffer object in a Camera pre-draw callback, for an example of one strategy. -Paul On 2/27/2012 8:21 AM, Martin Großer wrote: Hello, Is it possible to use GL_TRANSFORM_FEEDBACK_BUFFER_NV extension in osg? I would like write back my vertex position data into a new Vertex Buffer Object. Is there any example about this? Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] CompositeViewer and RTT-SceneGraph
Hello, I tried to render a scene into a texture and use a frame buffer object render target for the view master camera. I want to chance the camera with a CameraManipulator. It works fine if I only use one view, but it doesn't work if I use more views. The CameraManipulator get the wrong information from the EventAdapter (that is my theory). I guess the problem is, that the camera has a viewport with (0,0,TexWidht,TexHeight). I have attached a drawing about my konfiguration. I hope it is easier to understand with the picture. It is interesting to note that the getXnormalize() method of EventAdapter didn't get a normalized value. Cheers, Martin -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a attachment: osg_konfiguration.png___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Slow rendering with displaylist.
Hello, I am surprised about my little test program. I would like compare displaylists with frame buffer objects. Because, I suppose that the displaylists have to be faster than the vbo, because the displaylists are precompiled. But in my example I get another result: VBO: 225 FPS DL: 88 FPS Is that possible? Following a part of my code: // Geometry (Grid-Plane) ::osg::Geometry* geom = new osg::Geometry; // Vertex Array (Grid with 1000 x 1000 quads) ::osg::ref_ptr ::osg::Vec3Array v = new ::osg::Vec3Array(); for(unsigned int x=0; x 1000; x++) { for(unsigned int y=0; y 1000; y++) { // create points } } geom-setVertexArray(v); #ifdef ENABLE_VBO // Vertex Buffer Object osg::VertexBufferObject* vbo = geom-getOrCreateVertexBufferObject(); vbo-setArray(0,v); vbo-setUsage(GL_STATIC_DRAW); geom-setUseVertexBufferObjects(true); geom-setSupportsDisplayList(false); geom-setUseDisplayList(false); #else geom-setSupportsDisplayList(true); geom-setUseDisplayList(true); #endif // Primitive ::osg::DrawArrays* da = new ::osg::DrawArrays(::osg::PrimitiveSet::QUADS,0,v-size()); geom-addPrimitiveSet(da); // Geometry Node ::osg::Geode* geode = new osg::Geode; geode-addDrawable(geom); Thanks Martin -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Slow rendering with displaylist.
Hello Daniel, That is basically true. I want to get a feeling about DisplayLists and VBOs. I know that the display list is a precompiled sequence of OpenGL commands. That is the reason that I tought the display lists should be faster. But the question isn't the comparison, but the slow render performance when I want to use display lists. I think everything is wrong in my implementation. But I don't know what. Cheers Martin Original-Nachricht Datum: Tue, 28 Feb 2012 11:37:36 +0100 Von: Daniel Trstenjak daniel.trsten...@science-computing.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Slow rendering with displaylist. Hi Martin, I am surprised about my little test program. I would like compare displaylists with frame buffer objects. Because, I suppose that the displaylists have to be faster than the vbo, because the displaylists are precompiled. But in my example I get another result: I think what you're testing is the performance difference between vertex data on system memory and vertex data on graphics card memory. It doesn't makes that much sense to compare displaylists with fbos, because displaylists are about opengl commands and fbos about opengl data. Greetings, Daniel -- Daniel Trstenjak Tel : +49 (0)7071-9457-264 science + computing ag FAX : +49 (0)7071-9457-511 Hagellocher Weg 73 mailto: daniel.trsten...@science-computing.de D-72070 Tübingen WWW : http://www.science-computing.de/ -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Michael Heinrichs, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Philippe Miltin Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Slow rendering with displaylist.
Hello, thanks to you, it was very helpful. Now I will only use VBOs. Greetings, Martin Original-Nachricht Datum: Tue, 28 Feb 2012 12:44:15 +0100 Von: Daniel Trstenjak daniel.trsten...@science-computing.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Slow rendering with displaylist. Hi Martin, That is basically true. I want to get a feeling about DisplayLists and VBOs. I know that the display list is a precompiled sequence of OpenGL commands. That is the reason that I tought the display lists should be faster. But the question isn't the comparison, but the slow render performance when I want to use display lists. I think everything is wrong in my implementation. But I don't know what. My point about system/graphics card memory is wrong. I thought about glVertexPointer, but this call isn't even compiled into a display list and shouldn't be used with one. So OSG will most likely use glBegin/glEnd to put the vertex data into the display list. It boils down to what Mathias ;) said, it's an implementation issue, dirty corner cases and driver developers don't optimize the display lists anymore, because they're deprecated and just not used that much anymore. Greetings, Daniel -- Daniel Trstenjak Tel : +49 (0)7071-9457-264 science + computing ag FAX : +49 (0)7071-9457-511 Hagellocher Weg 73 mailto: daniel.trsten...@science-computing.de D-72070 Tübingen WWW : http://www.science-computing.de/ -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Michael Heinrichs, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Philippe Miltin Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG
Hello Paul, In OpenGL I have to define the varying variables for the transform feedback between the compiling and linking of the shader program. glTransformFeedbackVaryings(programHandle, 1, varyings, GL_SEPARATE_ATTRIBS); How can I do this in OSG? Additinally I use osg 2.8.4 from the Fedora repository. Cheers, Martin Original-Nachricht Datum: Mon, 27 Feb 2012 09:51:15 -0700 Von: Paul Martz pma...@skew-matrix.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG Yes, it's possible, but there are no examples that I know of. You might try binding a buffer object in a Camera pre-draw callback, for an example of one strategy. -Paul On 2/27/2012 8:21 AM, Martin Großer wrote: Hello, Is it possible to use GL_TRANSFORM_FEEDBACK_BUFFER_NV extension in osg? I would like write back my vertex position data into a new Vertex Buffer Object. Is there any example about this? Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG
Hello, Is it possible to use GL_TRANSFORM_FEEDBACK_BUFFER_NV extension in osg? I would like write back my vertex position data into a new Vertex Buffer Object. Is there any example about this? Cheers Martin -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Is a render to texture master camera critical?
Hi, I try the RTT master camera and for one view it works fine, but when I want to use multiple views in a composite viewer my trackball manipulators don't work. Only the first view get a new viewmatrix. There are any experiance about rtt cameras and camera manipulators? Thank you! Cheers, Martin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45682#45682 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Is a render to texture master camera critical?
Hi, Additionally, the manipulator for the first view only works if I move the window at the beginning. It seems to me it only works after the first window redraw event. I am not sure. My RTT camera has a viewport with x = 0, y = 0, width = textureWidth and height = textureHeight. Is that the problem? Thank you! Cheers, Martin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45684#45684 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Is a render to texture master camera critical?
Hello all, I note only my post sent per mail. I tried the forum and this was the first time. Sorry about the confusing mails. However I hope someone understand my problem. I would like to state my question even more clearly. When I define a viewport like setViewport(0,0,800,600) to change the influence range of the trackball manipulator to the right top corner like (400,300,400,300)? I think that could solve my problem. Thanks Cheers, Martin Original-Nachricht Datum: Wed, 22 Feb 2012 15:56:15 +0100 Von: Martin Großer grosser.mar...@gmx.de An: osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Is a render to texture master camera critical? Hi, Additionally, the manipulator for the first view only works if I move the window at the beginning. It seems to me it only works after the first window redraw event. I am not sure. My RTT camera has a viewport with x = 0, y = 0, width = textureWidth and height = textureHeight. Is that the problem? Thank you! Cheers, Martin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45684#45684 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How do you manage multiple world matrices?
Hello, When I get a scene graph and I want to do something with a geode in world coordinates, I have to use the world matrix of the geode (usually the matrizes of the parents). Now, the difficult part is a node can have several parents. I am not sure how I can manage this fact. How can I decide what the right path to the root node is? What is your experience with this possibility of node compositing. Would you ban multiple node references? I would be very grateful if someone can give me some useful tips. Cheers Martin -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Is a render to texture master camera critical?
Hello all, A few weeks ago, I want to render my scene into a texture, which I want to use in the final rendering on a screen aligned quad. My first problem was I lost the shadows, because view dependent shadow techniques don't work with nested cameras. So I used a RTT slave camera. Now my Callbacks don't work, because they don't work with slave cameras (no update visistors for slave scene graphs). So now my rtt camera is the master camera and my ortho camera for the quad is a nested camera (see the render_to_texture_scene_graph.png). It looks fine, but I am not sure whether it is a good idea. There are any special explanatory notes for me? Is it a good or bad scene graph pattern for my use case? Cheers Martin -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de attachment: render_to_texture_scene_graph.png___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Is a render to texture master camera critical?
Hello Jean-Sébastien, yes, it helps. :-) thank you very much for your feedback. Cheers Martin Am 17.01.2012 18:21, schrieb Jean-Sébastien Guay: Hello Martin, So now my rtt camera is the master camera and my ortho camera for the quad is a nested camera (see the render_to_texture_scene_graph.png). It looks fine, but I am not sure whether it is a good idea. That's always how I've done it too. I think it's fine. For me, the motivation was that I wanted my app to work whether I was doing normal rendering or RTT of the main pass + post effects on a full-screen quad afterwards, so the common factor between the two needed to be that the master camera did the main scene rendering. Then I can switch between the two cases by simply changing the renderTargetImplementation of the main camera, attaching the output texture to the main camera's color buffer, and finally setting the node mask of the child ortho camera (that has the full-screen quad) to non-zero value. Hope this helps, J-S ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] What is a good scene graph setup for post processing?
Hello, I am a little bit frustrated. I want to render my scene into a texture and map this on a plane. After that, I render the plane with an orthogonal camera. My scene use shadows (standard shadow map) and I use callbacks. My current scene graph looks like the follow example: [viewer] -- slave [rttCam] || [rootNode] [MyScene] -- Callbacks doesn't work. | [orthoCam] | [texturedPlane] I tried another setup few days ago: [viewer] /\ [rootNode] [rttCam] -- nested cam | | [orthoCam] [MyScene] -- Shadows doesn't work. | [texturedPlane] I tink this is not a special problem and my be my basic understanding is wrong (or bad) about post process effects in the scene graph. What is a good scene graph structure, if I want to render a scene in a texture and want to do some effects (motion blur, depth of field or tone mapping)? Is there a basic rule or concept? Thank you very much. Martin -- NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Problems with RTT, Shadowmaps and Callbacks
Hello, I am so dissatisfied at the moment. I render my scene into a texture and put it on a quad. I want use shadow maps in my scene, so I have to use a slave camera, because shadowmap technique doesn't work with nested cameras. But my problem is, all my callback function doesn't work now. The only work with nested cameras. It is a big dilemma, isn't it? What can I do? Is there a typical solution for this problem? Thanks Martin -- NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How can I check which GLExtension is supported?
Hello, I would like check the hardware, so which extension is supported. I found the function isGLExtensionSupported(unsigned int contextID, const char *extension). What does the first parameter mean? Is this the graphics context id? And why do I need this? Thanks Martin -- NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I check which GLExtension is supported?
Ok I've got it! See the comment of the class documentation : Note: Must only be called within a valid OpenGL context, undefined behavior may occur otherwise. Thanks Martin Original-Nachricht Datum: Fri, 16 Sep 2011 11:56:17 +0200 Von: Martin Großer grosser.mar...@gmx.de An: osg-users@lists.openscenegraph.org Betreff: [osg-users] How can I check which GLExtension is supported? Hello, I would like check the hardware, so which extension is supported. I found the function isGLExtensionSupported(unsigned int contextID, const char *extension). What does the first parameter mean? Is this the graphics context id? And why do I need this? Thanks Martin -- NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Is the Z-Buffer linear or non-linear?
Hello, I am completely confused about the Z-Buffer. I thought it is non-linear but now I read a lot in forums and now I am not sure about that. The reason about this question is I want render linear depth values into a texture. I think, I can do it with this shader: varying float depth; uniform float near; uniform float far; void main(void) { vec4 viewPos = gl_ModelViewMatrix * gl_Vertex; depth = (-viewPos.z-near)/(far-near); gl_Position = ftransform(); }; varying float depth; void main(void) { gl_FragDepth = depth; } But the poor think is all other shader will be overwritten. Now I use this: _rendertarget-setInternalFormat(GL_DEPTH_COMPONENT); _cam-setClearMask(GL_DEPTH_BUFFER_BIT); _cam-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); _cam-attach(osg::Camera::DEPTH_BUFFER, _rendertarget); _cam-setRenderOrder(::osg::Camera::PRE_RENDER, 0); But this is nonlinear, isn't it? I hope someone can help me about this. Thanke you very much. Martin -- NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Is the Z-Buffer linear or non-linear?
Hello, I think I got it. Correct me if I am wrong, if I use an orthogonal projection I get linear Z-Buffer values. If I use a perspective projection I get non-linear values. The Z-Buffer value (z') of a perspective projection is: z' = (far + near) / (far - near) + 1/z ((-2 * far * near)/(far-near)) The Z-Buffer value (z') of a orthogonal projection is: z' = 2 * ((z-near)/(far-near))-1 So, I use a orthogonal projection therefore I get a linear Z-Buffer. I hope that is right. Cheers Martin Original-Nachricht Datum: Wed, 24 Aug 2011 10:01:23 +0200 Von: Martin Großer grosser.mar...@gmx.de An: osg-users@lists.openscenegraph.org Betreff: [osg-users] Is the Z-Buffer linear or non-linear? Hello, I am completely confused about the Z-Buffer. I thought it is non-linear but now I read a lot in forums and now I am not sure about that. The reason about this question is I want render linear depth values into a texture. I think, I can do it with this shader: varying float depth; uniform float near; uniform float far; void main(void) { vec4 viewPos = gl_ModelViewMatrix * gl_Vertex; depth = (-viewPos.z-near)/(far-near); gl_Position = ftransform(); }; varying float depth; void main(void) { gl_FragDepth = depth; } But the poor think is all other shader will be overwritten. Now I use this: _rendertarget-setInternalFormat(GL_DEPTH_COMPONENT); _cam-setClearMask(GL_DEPTH_BUFFER_BIT); _cam-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); _cam-attach(osg::Camera::DEPTH_BUFFER, _rendertarget); _cam-setRenderOrder(::osg::Camera::PRE_RENDER, 0); But this is nonlinear, isn't it? I hope someone can help me about this. Thanke you very much. Martin -- NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] I cannot render into an 16 or 32 Bit image
Hello Guys, I am a little bit dissatisfied. I want to render into an Image. I need the pixel data on the cpu memory. That is the reason why I don't use a texture as target. Anyway I need a higher precision than 8 bit. So I tried to render into an 16 Bit luminance image. Then I got an OpenGL error: Warning: detected OpenGL error 'invalid enumerant' after RenderBin::draw(,) I tried other internal formats (i.e. GL_RGBA16F_ARB and GL_RGBA32F_ARB), but I got the same message. Here is partial code from me: // init image _sumImg = new ::osg::Image; _sumImg-allocateImage(1, 1, 1, GL_LUMINANCE16, GL_FLOAT); //... // init pre render camera _preCam = new ::osg::Camera; _preCam-setViewport(0,0,1,1); _preCam-setProjectionMatrixAsOrtho2D(0,0.1,0,0.1); _preCam-setClearColor(::osg::Vec4(0,0,0,1)); _preCam-setReferenceFrame(::osg::Transform::ABSOLUTE_RF); _preCam-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); _preCam-setRenderTargetImplementation(::osg::Camera::FRAME_BUFFER_OBJECT); _preCam-attach(::osg::Camera::COLOR_BUFFER0, _sumImg); _preCam-setRenderOrder(::osg::Camera::PRE_RENDER); // get the pixel color at location (0,0) ::osg::Vec4 c = _sumImg-getColor(0,0); Thanks Martin -- NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Render Order
Hello, can everyone explain me what the render order number do? cam1-setRenderOrder(::osg::Camera::PRE_RENDER, 0); cam2-setRenderOrder(::osg::Camera::PRE_RENDER, 1); Is the cam1 ready with the rendering before cam2 begins? Cheers Martin -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Difference between textures and images
Hello, there are a class image and a class texture (texture2D) in OpenSceneGraph. I would like to know what is the generell difference between an image and a texture? Why don't you only provide a texture class? Is the reason the texture is on the graphics card memory and the image on the cpu memory? Cheers Martin -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] GPU Data Access
Hello, thank to all for these nice solutions. I will try these. Cheers Martin Original-Nachricht Datum: Tue, 12 Jul 2011 12:06:45 +0200 Von: Peter Wrobel particlepe...@gmx.de An: osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] GPU Data Access Hi, Couldn't this be done in a fragment shader ? Create a one by one pixel texture, to calculate the result. Give the corresponding fragment shader access to your fbo render, and sum up the values. Of course you would need a scaling factor to not leave float max boundary. The osgPPU HDRI example is doing a similar thing to calculate tone mapping. Cheers, ParticlePeter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41316#41316 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - kostenlos mobil telefonieren! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] GPU Data Access
Hello, I have written a little application, which renders a scene into a texture. I use the frame buffer object, but my problem is, I need the data on the cpu after the rendering. I know that is the bottleneck, but I hope someone can give me a clever tip how I can do this without big delay. Maybe, is it possible to get access to the texture via a cuda program. Then I can do my procedure on the gpu and then I only transport the result back to the cpu? My procedure is quite simple. I have a depth map and I want to get the sum over all pixel values. There are some ideas about my problem? Cheers Martin -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] glCopyTexImage2D or Frame Buffer Object
Ok thank you. And what do you think about osg::Texture2D::copyTexImage2D(...)? Is this a worse solution than the FBO? Thank you very much. Best regards Martin Original-Nachricht Datum: Tue, 19 Apr 2011 16:03:03 +0100 Von: Robert Osfield robert.osfi...@gmail.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] glCopyTexImage2D or Frame Buffer Object Hi Martin, FBO's do support multi-sampling - but the setup is different from the frame buffer set up of multi-sampling, instead you you provide the settings when you call Camera::attach(). The relevant methods are: /** Attach a Texture to specified buffer component. * The level parameter controls the mip map level of the texture that is attached. * The face parameter controls the face of texture cube map or z level of 3d texture. * The mipMapGeneration flag controls whether mipmap generation should be done for texture.*/ void attach(BufferComponent buffer, osg::Texture* texture, unsigned int level = 0, unsigned int face=0, bool mipMapGeneration=false, unsigned int multisampleSamples = 0, unsigned int multisampleColorSamples = 0); /** Attach a Image to specified buffer component.*/ void attach(BufferComponent buffer, osg::Image* image, unsigned int multisampleSamples = 0, unsigned int multisampleColorSamples = 0); As for anaglyphic stereo, this is managed currently by osgUtil::SceneView for frame buffers where it sets up two traversals one for each eye, and sets up the color write mask to render the cyan and red for the left and right eye traverals. A straight render to texture Camera won't use this higher level feature, if you want to implement stereo within a render to texture camera you'll need to manage the left/right eye passes as a subgraph of the Camera, or have two Camera and share the same FBO. Robert. 2011/4/19 Martin Großer grosser.mar...@gmx.de: Hello, Few month ago, I got an application, which realized a render to texture with glCopyTexImage2D(GL_TEXTURE_2D,0,...) and the antialiasing and the anaglyphic works well. Today I tried the render-to-texture with the frame buffer object as render target for the osg::Camera and in this case the antialiasing doesn't work. Also the anaglyphic view doesn't work. Why did antialiasing and anaglyphic work with glCopyTexImage2D? I have read that the frame buffer object doesn't support antialiasing, is it true? Thanks Martin -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] glCopyTexImage2D or Frame Buffer Object
Hello, Few month ago, I got an application, which realized a render to texture with glCopyTexImage2D(GL_TEXTURE_2D,0,...) and the antialiasing and the anaglyphic works well. Today I tried the render-to-texture with the frame buffer object as render target for the osg::Camera and in this case the antialiasing doesn't work. Also the anaglyphic view doesn't work. Why did antialiasing and anaglyphic work with glCopyTexImage2D? I have read that the frame buffer object doesn't support antialiasing, is it true? Thanks Martin -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] glCopyTexImage2D or Frame Buffer Object
Hello, I have the answer of the question what is different. Frame Buffer Object is render to texture. So the texture use the frame buffer and you render on it directly. Copy to texture means that the frame buffer is copy to the texture buffer after the rendering. I hope this is true. And if I copy it after the rendering I get the antialiasing and anagyphic features. Another question. What is better? Is the copy too slow with a texture resolution of 1400x1050? Thanks Martin Original-Nachricht Datum: Tue, 19 Apr 2011 16:30:19 +0200 Von: Martin Großer grosser.mar...@gmx.de An: osg-users@lists.openscenegraph.org Betreff: [osg-users] glCopyTexImage2D or Frame Buffer Object Hello, Few month ago, I got an application, which realized a render to texture with glCopyTexImage2D(GL_TEXTURE_2D,0,...) and the antialiasing and the anaglyphic works well. Today I tried the render-to-texture with the frame buffer object as render target for the osg::Camera and in this case the antialiasing doesn't work. Also the anaglyphic view doesn't work. Why did antialiasing and anaglyphic work with glCopyTexImage2D? I have read that the frame buffer object doesn't support antialiasing, is it true? Thanks Martin -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] 16 Bit Image
Hello Ulrich, yes, the depth = 4 for RGBA, that's right. After the writing I want a 16 bit image (tiff or something linke this). I want to load this in another application and 8 bit per channel (red, green, blue and alpha) is too imprecise. So I need a 16 bit image. I didn't get errors but the values are false in the image. It looks wrong. If I set all data values to 1.0f then I get a half transparent bluish image. You see my problem? Or isn't it clear? Thank you Martin Original-Nachricht Datum: Fri, 04 Mar 2011 09:06:13 +1100 Von: Ulrich Hertlein u.hertl...@sandbox.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] 16 Bit Image Hi Martin, On 4/03/11 1:32 , Martin Großer wrote: I would like write a 16 bit image. I tried the follow: // image Data float* data = new float[width * height * depth]; (float != 16-bit, but float seems to be what you're after? 'depth' == 4? For RGBA?) // set data to image img-setImage(width, height, 1, GL_RGBA16F_ARB, GL_RGBA, GL_FLOAT, (unsigned char*) data, Image::USE_NEW_DELETE); osgDB::writeImageFile(*img, test_image.tiff); How can I do this? My divining rod seems to be broken. What is the problem again? Do you get an error? Does it crash? Does it look wrong? Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 16 Bit Image
Hello, I would like write a 16 bit image. I tried the follow: // image Data float* data = new float[width * height * depth]; // set image data [...] // create Image ref_ptrImage img = new Image; // image internal format img-setInternalTextureFormat(GL_RGBA16F_ARB); // pixel format img-setPixelFormat(GL_RGB); // set data type img-setDataType(GL_FLOAT); // set origion img-setOrigin(Image::BOTTOM_LEFT); // set data to image img-setImage(width, height, 1, GL_RGBA16F_ARB, GL_RGBA, GL_FLOAT, (unsigned char*) data, Image::USE_NEW_DELETE); osgDB::writeImageFile(*img, test_image.tiff); How can I do this? Cheers Martin -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can I increment the gl_FragData?
Hello Juan, I am pleased to say that the ping pong version works very good. Really! It is fast (on a plane with a 1024x1024 texture I have around 4300 FPS) and it looks well. So, this is a complete success. I think that is all what I need. However, I will try the EXT_shader_image_load_store version, because I want to help you to integrate this in OSG and I want to evaluate this (compare ping pong and the extension). Best regards, Martin Original-Nachricht Datum: Wed, 23 Feb 2011 12:03:38 +0100 Von: Juan Hernando jherna...@fi.upm.es An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? On 23/02/11 11:54, Martin Großer wrote: Ok, I didn't understood that. So, either way I need the ping pong process. I am writing the ping pong version at the moment. I hope this works but more about that later. :-) In the blending case you don't need ping-pong if you use NV_texture_barrier http://developer.download.nvidia.com/opengl/specs/GL_NV_texture_barrier.txt as Sergey pointed out. I forgot about that. Cheers, Juan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Difference TextureRectangle and Texture2D
Hello, I have been seeing that the TextureRectangle is a OpenGL standard. I didn't know that so far. Here is the documentation: http://www.opengl.org/registry/specs/ARB/texture_rectangle.txt Best regards, Martin Original-Nachricht Datum: Wed, 23 Feb 2011 10:38:17 +0100 Von: Martin Großer grosser.mar...@gmx.de An: osg-users@lists.openscenegraph.org Betreff: [osg-users] Difference TextureRectangle and Texture2D Hello, can everyone explain me what the difference between a osg::Texture2D and a osg::TextureRectangle? Regards, Martin -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can I increment the gl_FragData?
Hello, that is bad. :-( So, I want to blend (for example add) textures iterative. Here in pseudo code: while(1) { Tex0 = Tex0 + Tex1; // Tex0 + Tex1 is calculate in a glsl shader } Thanks for your tips. Cheers Martin Original-Nachricht Datum: Tue, 22 Feb 2011 08:58:05 +0200 Von: J.P. Delport jpdelp...@csir.co.za An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hi, On 21/02/11 17:29, Martin Großer wrote: Hello, thank you very much for the three fast answers. I think the ping pong processing looks interesting. I only want to render a texture by RTT and in the next run I render the texture again, but I don't want to replace the old texture. I would like blend the new rendering into the texture. Is this understandable so far? unfortunately there is no way to get the old framebuffer contents from a shader. So, you are stuck with OpenGL blending (that operates on the framebuffer and your new data) or reading the old data from a texture (but then you can't write to that same texture). What effect/processing are you trying to achieve? jp Cheers Martin Original-Nachricht Datum: Mon, 21 Feb 2011 17:07:41 +0200 Von: J.P. Delportjpdelp...@csir.co.za An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hi, you'll have to use ping-pong if you want to update a texture from a current state. Have a look at the osggameoflife example. cheers jp On 21/02/11 16:52, Martin Großer wrote: Hello, Have everyone experience with the gl shading language? I would like to do something like that on my texture (I use render to texture): gl_FragData[0] += vec(0.01,0,0,1); Is that possible? I want to increment the color in my texture in every render pass (in this case the red channel). I don't want to copy back to the cpu memory. And I use the FRAME_BUFFER_OBJECT. I guess the gl_FragData[0] is in every render pass zero (black). Is it possible to change that? Cheers Martin -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can I increment the gl_FragData?
Hello, Additionally, I do this with rtt into a image, but it is to slow. And now I want to do this into a texture and that is my motivation. Cheers Martin Original-Nachricht Datum: Tue, 22 Feb 2011 11:06:03 +0100 Von: Martin Großer grosser.mar...@gmx.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hello, that is bad. :-( So, I want to blend (for example add) textures iterative. Here in pseudo code: while(1) { Tex0 = Tex0 + Tex1; // Tex0 + Tex1 is calculate in a glsl shader } Thanks for your tips. Cheers Martin Original-Nachricht Datum: Tue, 22 Feb 2011 08:58:05 +0200 Von: J.P. Delport jpdelp...@csir.co.za An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hi, On 21/02/11 17:29, Martin Großer wrote: Hello, thank you very much for the three fast answers. I think the ping pong processing looks interesting. I only want to render a texture by RTT and in the next run I render the texture again, but I don't want to replace the old texture. I would like blend the new rendering into the texture. Is this understandable so far? unfortunately there is no way to get the old framebuffer contents from a shader. So, you are stuck with OpenGL blending (that operates on the framebuffer and your new data) or reading the old data from a texture (but then you can't write to that same texture). What effect/processing are you trying to achieve? jp Cheers Martin Original-Nachricht Datum: Mon, 21 Feb 2011 17:07:41 +0200 Von: J.P. Delportjpdelp...@csir.co.za An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hi, you'll have to use ping-pong if you want to update a texture from a current state. Have a look at the osggameoflife example. cheers jp On 21/02/11 16:52, Martin Großer wrote: Hello, Have everyone experience with the gl shading language? I would like to do something like that on my texture (I use render to texture): gl_FragData[0] += vec(0.01,0,0,1); Is that possible? I want to increment the color in my texture in every render pass (in this case the red channel). I don't want to copy back to the cpu memory. And I use the FRAME_BUFFER_OBJECT. I guess the gl_FragData[0] is in every render pass zero (black). Is it possible to change that? Cheers Martin -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can I increment the gl_FragData?
Hello, I think the GameOfLife example probably can work. Yesterday I implement this, but it doesn't work. Maybe I have a bug in my implementation because now, I changed the output line of the gameoflife fragment shader code. Fromt: gl_FragColor = outval; To: gl_FragColor = texture2DRect(textureIn, texCoord) + 0.0025; Then I start the example and this works. And that is fast. I have a InTexture with a resolution of 2048x2048 and my frame rate was 1600 fps. Are there any objections to this method (disadvantages)? It seems to me that is similar to a double buffer and I like this idea. Cheers Martin Original-Nachricht Datum: Tue, 22 Feb 2011 11:13:18 +0100 Von: Martin Großer grosser.mar...@gmx.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hello, Additionally, I do this with rtt into a image, but it is to slow. And now I want to do this into a texture and that is my motivation. Cheers Martin Original-Nachricht Datum: Tue, 22 Feb 2011 11:06:03 +0100 Von: Martin Großer grosser.mar...@gmx.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hello, that is bad. :-( So, I want to blend (for example add) textures iterative. Here in pseudo code: while(1) { Tex0 = Tex0 + Tex1; // Tex0 + Tex1 is calculate in a glsl shader } Thanks for your tips. Cheers Martin Original-Nachricht Datum: Tue, 22 Feb 2011 08:58:05 +0200 Von: J.P. Delport jpdelp...@csir.co.za An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hi, On 21/02/11 17:29, Martin Großer wrote: Hello, thank you very much for the three fast answers. I think the ping pong processing looks interesting. I only want to render a texture by RTT and in the next run I render the texture again, but I don't want to replace the old texture. I would like blend the new rendering into the texture. Is this understandable so far? unfortunately there is no way to get the old framebuffer contents from a shader. So, you are stuck with OpenGL blending (that operates on the framebuffer and your new data) or reading the old data from a texture (but then you can't write to that same texture). What effect/processing are you trying to achieve? jp Cheers Martin Original-Nachricht Datum: Mon, 21 Feb 2011 17:07:41 +0200 Von: J.P. Delportjpdelp...@csir.co.za An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hi, you'll have to use ping-pong if you want to update a texture from a current state. Have a look at the osggameoflife example. cheers jp On 21/02/11 16:52, Martin Großer wrote: Hello, Have everyone experience with the gl shading language? I would like to do something like that on my texture (I use render to texture): gl_FragData[0] += vec(0.01,0,0,1); Is that possible? I want to increment the color in my texture in every render pass (in this case the red channel). I don't want to copy back to the cpu memory. And I use the FRAME_BUFFER_OBJECT. I guess the gl_FragData[0] is in every render pass zero (black). Is it possible to change that? Cheers Martin -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go
Re: [osg-users] Can I increment the gl_FragData?
Hello Juan, I don't understand the fact that I need a swap per triangle. In the osggameoflife there is one swap per render pass. So my object is for example a wall (plane) and I want to add a texture (brush) to this wall like a airbrush. That is a simple test scenario. Ok first of all I should try the additive blending with osg::TexEnv. After this I can try a example with the extension EXT_shader_image_load_store. I have a NV GTX470, it should work. And then we can talk about a integration in OSG. I can send the example and we can discuss a suitable design. I am very interested in a smoothly integration in OSG. Regards, Martin Original-Nachricht Datum: Tue, 22 Feb 2011 11:38:15 +0100 Von: Juan Hernando jherna...@fi.upm.es An: osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hi Martin, Depending on what you need to do, additive blend (as it has already been suggested) may work fine. Using ping-pong is not an option if you need to accmulate the output in a triangle basis because it requires a buffer swap per triangle to guarantee correct results. Can you be a bit more specific about what type of geometry are you rendering into the target textures and what's the sequence of additions? If you need something more advanced, read/write random access to memory buffers is actually possible, but you need a graphics card that supports EXT_shader_image_load_store (at least NV GTX4xx or AMD HD5xxx). However, OSG does not support that extension at all and there are non-trivial synchronization/performance issues that you need to be aware of when writing your shader code (restricted, volatile and coherent variables; shader level and client level memory barriers; and atomic operations). Indeed, I want to start making some experiments with that extension for order-independent transparency, but proper support from OSG is not straightforward. A new StateAttribute (similar to textures) is needed to handle the binding of texture objects to image buffer units (a new shader concept). Also, some mechanism, such as a post-draw callback or a new scenegraph node, should be provided to execute the memory barriers in the client side. I'd really like to have this extension smoothly integrated in OSG because it is at least as interesting as hardware tessellation support. I can volunteer to do part of the coding, but first I need feedback in order to propose a suitable design. More info here. http://www.opengl.org/registry/specs/EXT/shader_image_load_store.txt Regards, Juan On 22/02/11 11:06, Martin Großer wrote: Hello, that is bad. :-( So, I want to blend (for example add) textures iterative. Here in pseudo code: while(1) { Tex0 = Tex0 + Tex1; // Tex0 + Tex1 is calculate in a glsl shader } Thanks for your tips. Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can I increment the gl_FragData?
Hello Juan, I think in my case the ping-pong is OK, because I want to render a fullscreen quad. I developed a texture painting tool which is hardware accelerated. I can do it very easy with a glsl shader. Only the RTT into the image is the bottle neck. I will try the three versions. 1. OSG: PingPong 2. OSG: Blending 3. OpenGL: EXT_shader_image_load_store I will post my results here in the mailing list. Then we can talk about the osg integration. It seems to me that the discussion was very useful. Thank you very much. Regards, Martin Original-Nachricht Datum: Tue, 22 Feb 2011 13:23:26 +0100 Von: Juan Hernando jherna...@fi.upm.es An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hi Martin, I don't understand the fact that I need a swap per triangle. In the osggameoflife there is one swap per render pass. It depends on what you want to do. If you are rendering a fullscreen quad and performing some pixel level operations, then ping-pong textures are OK. This is the case of the game of life example. However, if you are combining into each target pixel the contribution of all the triangles that hit that pixel, then you can't use ping-pong because you have to swap the read and write textures after each triangle (I assume you are not binding the same texture as input and output for a shader because it has undefined behaviour). For example, this would be the case when you want to count the fragments falling into a pixel. If you can't use blending operations to do your calculations, then EXT_shader_image_load_store may be the last resort. So my object is for example a wall (plane) and I want to add a texture (brush) to this wall like a airbrush. That is a simple test scenario. Assuming your wall is screen aligned, I'd say that this airbrush example falls in the category of blending. However, if your actual intent is to develop a realtime texture painting tool then, it might be easier to do it in completely in the CPU (I'm not an expert in texturing so there might be some clever tricks to take advantange of OpenGL to do it with random access image buffers). Ok first of all I should try the additive blending with osg::TexEnv. After this I can try a example with the extension EXT_shader_image_load_store. I have a NV GTX470, it should work. And then we can talk about a integration in OSG. I can send the example and we can discuss a suitable design. I am very interested in a smoothly integration in OSG. Me too ;) Cheers, Juan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can I increment the gl_FragData?
Hello, My blending version doesn't work. Parts of the code: // 1. create RTT-Texture (Rendertarget) ref_ptrTexture2D baseTex = createRenderTexture(width,height); // 2. Blend Texture ref_ptrTexture2D blendTex = new Texture2D; blendTex-setImage(osgDB::readImageFile(argv[2])); // 3. Quads ref_ptr TexturedQuad texQuad1 = new TexturedQuad(baseTex.get()); ref_ptr TexturedQuad texQuad2 = new TexturedQuad(blendTex.get()); // 4. Stack (Quad stack) ref_ptrGroup stack = new Group; ref_ptrMatrixTransform mt1 = new MatrixTransform; mt1-setMatrix(Matrix::translate(0,0,-1)); mt1-addChild(texQuad1); stack-addChild(mt1); ref_ptrMatrixTransform mt2 = new MatrixTransform; mt2-setMatrix(Matrix::translate(0,0,0)); mt2-addChild(texQuad2); stack-addChild(mt2); // 5. BlendEquation BlendEquation* blendEquation = new BlendEquation(BlendEquation::FUNC_ADD); blendEquation-setDataVariance(Object::DYNAMIC); // 6. BlendFunc ref_ptrBlendFunc blendFunc = new BlendFunc(); blendFunc-setFunction(BlendFunc::ONE,BlendFunc::DST_COLOR ); // 7. StateSet StateSet* stateset = new StateSet; stateset-setDataVariance(Object::DYNAMIC); stateset-setAttributeAndModes(blendEquation,StateAttribute::OVERRIDE|StateAttribute::ON); stateset-setAttributeAndModes(blendFunc, StateAttribute::ON); stateset-setRenderingHint(StateSet::TRANSPARENT_BIN); stateset-setMode(GL_BLEND, StateAttribute::ON); // 8. RTT Camera osg::Camera* rtt_cam = new osg::Camera; rtt_cam-setClearColor(osg::Vec4(0,0,0,0)); //rtt_cam-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); rtt_cam-setViewport(0,0,width,height); rtt_cam-setRenderOrder(osg::Camera::PRE_RENDER, 0); rtt_cam-setRenderTargetImplementation( osg::Camera::FRAME_BUFFER ); rtt_cam-attach(osg::Camera::COLOR_BUFFER0, baseTex, 0, 0); rtt_cam-setReferenceFrame(osg::Transform::ABSOLUTE_RF); rtt_cam-setProjectionMatrixAsOrtho2D(0.0,1.0,0.0,1.0); rtt_cam-setViewMatrix(osg::Matrix::identity()); rtt_cam-addChild(stack); I think that is the important code. It doesn't increment the blend texture. If I change the camera, it looks like a infinite mirror. What is my mistake? I think I don't understand the blendequation in combination with RTT. Regards, Martin Original-Nachricht Datum: Tue, 22 Feb 2011 14:02:30 +0100 Von: Martin Großer grosser.mar...@gmx.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hello Juan, I think in my case the ping-pong is OK, because I want to render a fullscreen quad. I developed a texture painting tool which is hardware accelerated. I can do it very easy with a glsl shader. Only the RTT into the image is the bottle neck. I will try the three versions. 1. OSG: PingPong 2. OSG: Blending 3. OpenGL: EXT_shader_image_load_store I will post my results here in the mailing list. Then we can talk about the osg integration. It seems to me that the discussion was very useful. Thank you very much. Regards, Martin Original-Nachricht Datum: Tue, 22 Feb 2011 13:23:26 +0100 Von: Juan Hernando jherna...@fi.upm.es An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hi Martin, I don't understand the fact that I need a swap per triangle. In the osggameoflife there is one swap per render pass. It depends on what you want to do. If you are rendering a fullscreen quad and performing some pixel level operations, then ping-pong textures are OK. This is the case of the game of life example. However, if you are combining into each target pixel the contribution of all the triangles that hit that pixel, then you can't use ping-pong because you have to swap the read and write textures after each triangle (I assume you are not binding the same texture as input and output for a shader because it has undefined behaviour). For example, this would be the case when you want to count the fragments falling into a pixel. If you can't use blending operations to do your calculations, then EXT_shader_image_load_store may be the last resort. So my object is for example a wall (plane) and I want to add a texture (brush) to this wall like a airbrush. That is a simple test scenario. Assuming your wall is screen aligned, I'd say that this airbrush example falls in the category of blending. However, if your actual intent is to develop a realtime texture painting tool then, it might be easier to do it in completely in the CPU (I'm not an expert in texturing so there might be some clever tricks to take advantange of OpenGL to do it with random access image buffers). Ok first of all I should try the additive blending with osg::TexEnv. After this I can try a example with the extension EXT_shader_image_load_store. I have a NV GTX470, it should work. And then we can talk about a integration in OSG. I can send the example and we can
[osg-users] Can I increment the gl_FragData?
Hello, Have everyone experience with the gl shading language? I would like to do something like that on my texture (I use render to texture): gl_FragData[0] += vec(0.01,0,0,1); Is that possible? I want to increment the color in my texture in every render pass (in this case the red channel). I don't want to copy back to the cpu memory. And I use the FRAME_BUFFER_OBJECT. I guess the gl_FragData[0] is in every render pass zero (black). Is it possible to change that? Cheers Martin -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can I increment the gl_FragData?
Hello, thank you very much for the three fast answers. I think the ping pong processing looks interesting. I only want to render a texture by RTT and in the next run I render the texture again, but I don't want to replace the old texture. I would like blend the new rendering into the texture. Is this understandable so far? Cheers Martin Original-Nachricht Datum: Mon, 21 Feb 2011 17:07:41 +0200 Von: J.P. Delport jpdelp...@csir.co.za An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Can I increment the gl_FragData? Hi, you'll have to use ping-pong if you want to update a texture from a current state. Have a look at the osggameoflife example. cheers jp On 21/02/11 16:52, Martin Großer wrote: Hello, Have everyone experience with the gl shading language? I would like to do something like that on my texture (I use render to texture): gl_FragData[0] += vec(0.01,0,0,1); Is that possible? I want to increment the color in my texture in every render pass (in this case the red channel). I don't want to copy back to the cpu memory. And I use the FRAME_BUFFER_OBJECT. I guess the gl_FragData[0] is in every render pass zero (black). Is it possible to change that? Cheers Martin -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] StandardShadowMap and Render To Texture
Hello Wojtek, it works well! Thank you. Cheers Martin Original-Nachricht Datum: Wed, 16 Feb 2011 18:28:24 +0100 Von: Wojciech Lewandowski lewandow...@ai.com.pl An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] StandardShadowMap and Render To Texture View Dependent Shadow techniques don't work with nested cameras. They work with RTT Slave cameras though. Cheers, Wojtek -Original Message- From: Martin Großer Sent: Wednesday, February 16, 2011 4:44 PM To: OpenSceneGraph Users Subject: Re: [osg-users] StandardShadowMap and Render To Texture OK, you are right, but that is not my problem. I don't want the shadow texture, which need the DEPTH_BUFFER. I want the final rendering in my texture. The basic graph looks like this: ROOT | rtt_cam (the result has no shadows) | shadowedScene (with StandardShadowMap) | camera (is also a render to texture camera) I hope it is better explanation of my problem. Cheers Martin Original-Nachricht Datum: Wed, 16 Feb 2011 16:19:09 +0100 Von: Wojciech Lewandowski lewandow...@ai.com.pl An: osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] StandardShadowMap and Render To Texture Maybe your problem is related to the fact that Shadow maps are usually stored in DEPTH_BUFFER (not COLOR_BUFFER). Wojtek Lewandowski -Original Message- From: Martin Großer Sent: Wednesday, February 16, 2011 3:47 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] StandardShadowMap and Render To Texture Hello, Every day a new problem. :-) Ok, so my Render To Texture works, but my shadows are not visible in the texture (rendertarget). My Settings: rtt_cam-setRenderOrder(::osg::Camera::PRE_RENDER, 0); rtt_cam-setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT ); rtt_cam-attach(::osg::Camera::COLOR_BUFFER, rtt_tex, 0, 0); Is the Problem the pre rendering? Because the standard shadow map has also a pre render camera. I am not sure which camera do the first rendering. Or is it another Problem? Cheers Martin -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problem: CompositeViewer doesn't work with Stereo
Hi, there are no ideas what is wrong with my test programme? I have no idea to fix this problem. Cheers Martin Original-Nachricht Datum: Tue, 15 Feb 2011 10:34:49 +0100 Von: Martin Großer grosser.mar...@gmx.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Problem: CompositeViewer doesn\'t work with Stereo Hello Robert, I tried a simple test programme. I used the composite viewer and two views. If I set up stereo on one view, it works fine. Also with the horizontal interlace. But if I set the stereo to both, I get the message Warning: detected OpenGL error 'invalid value' after RenderBin::draw(,) and only the first view works. It seems to me that my graphics context is not correct for this use case. Here the main lines of my test programme: // DisplaySettings osg::DisplaySettings* ds0 = new osg::DisplaySettings; ds0-setStereo(true); ds0-setStereoMode(osg::DisplaySettings::HORIZONTAL_INTERLACE); osg::DisplaySettings* ds1 = new osg::DisplaySettings; ds1-setStereo(true); ds1-setStereoMode(osg::DisplaySettings::HORIZONTAL_INTERLACE); // Graphics Context osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = 100; traits-y = 100; traits-width = 1000; traits-height = 800; traits-windowDecoration = true; traits-doubleBuffer = true; traits-sharedContext = 0; traits-stencil = 8; traits-useMultiThreadedOpenGLEngine=true; traits-vsync=true; traits-screenNum = 0; osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid()){ [...] } osg::ref_ptr osgViewer::View view0 = new osgViewer::View; view0-setDisplaySettings(ds0); [...] osg::ref_ptr osgViewer::View view1 = new osgViewer::View; view1-setDisplaySettings(ds1); [...] Best regards Martin Original-Nachricht Datum: Mon, 14 Feb 2011 11:36:53 + Von: Robert Osfield robert.osfi...@gmail.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Problem: CompositeViewer doesn\'t work with Stereo Hi Martin, The rendering backend is identical between Viewer and CompositeViewer so both are fully capable of doing stereo. I presume the issue comes from the DisplaySettings hints used to pass in the stereo settings. With CompositeViewer each View can have it's own DisplaySettings object so you can set this up independantly. Robert. 2011/2/14 Martin Großer grosser.mar...@gmx.de: Hello, I use the osg composite viewer and I try to use some stereo mode, i.e. CHECKERBOARD, HORIZONTAL_INTERLACE or the VERTICAL_INTERLACE. But this modes don't work with the composite viewer. I use osg 2.8. I guessed it is a problem in my application, so I tried the osgcompositeviewer example with these stereo modes. Also these didn't work. Any ideas? Cheers Martin -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problem: CompositeViewer doesn't work with Stereo
Hello J.P., both cameras have the same graphics context (gc). Here the complete part of the code with the views: osg::ref_ptr osgViewer::View view0 = new osgViewer::View; view0-setSceneData(root); view0-setDisplaySettings(ds0); view0-getCamera()-setViewport(500,0,500,800); view0-getCamera()-setGraphicsContext(gc); osg::ref_ptr osgViewer::View view1 = new osgViewer::View; view1-setSceneData(root); view1-setDisplaySettings(ds1); view1-getCamera()-setViewport(0,0,500,800); view1-getCamera()-setGraphicsContext(gc); osg::ref_ptr osgViewer::CompositeViewer viewer = new osgViewer::CompositeViewer; viewer-addView(view0); viewer-addView(view1); Cheers Martin Original-Nachricht Datum: Wed, 16 Feb 2011 14:58:19 +0200 Von: J.P. Delport jpdelp...@csir.co.za An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Problem: CompositeViewer doesn\'t work with Stereo have you tried sharing a context between the views? I'm not very familiar with stereo, but my guess would be the context of the second view is not set for stereo. jp On 16/02/11 14:50, Martin Großer wrote: Hi, there are no ideas what is wrong with my test programme? I have no idea to fix this problem. Cheers Martin Original-Nachricht Datum: Tue, 15 Feb 2011 10:34:49 +0100 Von: Martin Großergrosser.mar...@gmx.de An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Problem: CompositeViewer doesn\'t work with Stereo Hello Robert, I tried a simple test programme. I used the composite viewer and two views. If I set up stereo on one view, it works fine. Also with the horizontal interlace. But if I set the stereo to both, I get the message Warning: detected OpenGL error 'invalid value' after RenderBin::draw(,) and only the first view works. It seems to me that my graphics context is not correct for this use case. Here the main lines of my test programme: // DisplaySettings osg::DisplaySettings* ds0 = new osg::DisplaySettings; ds0-setStereo(true); ds0-setStereoMode(osg::DisplaySettings::HORIZONTAL_INTERLACE); osg::DisplaySettings* ds1 = new osg::DisplaySettings; ds1-setStereo(true); ds1-setStereoMode(osg::DisplaySettings::HORIZONTAL_INTERLACE); // Graphics Context osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = 100; traits-y = 100; traits-width = 1000; traits-height = 800; traits-windowDecoration = true; traits-doubleBuffer = true; traits-sharedContext = 0; traits-stencil = 8; traits-useMultiThreadedOpenGLEngine=true; traits-vsync=true; traits-screenNum = 0; osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid()){ [...] } osg::ref_ptr osgViewer::View view0 = new osgViewer::View; view0-setDisplaySettings(ds0); [...] osg::ref_ptr osgViewer::View view1 = new osgViewer::View; view1-setDisplaySettings(ds1); [...] Best regards Martin Original-Nachricht Datum: Mon, 14 Feb 2011 11:36:53 + Von: Robert Osfieldrobert.osfi...@gmail.com An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Problem: CompositeViewer doesn\'t work with Stereo Hi Martin, The rendering backend is identical between Viewer and CompositeViewer so both are fully capable of doing stereo. I presume the issue comes from the DisplaySettings hints used to pass in the stereo settings. With CompositeViewer each View can have it's own DisplaySettings object so you can set this up independantly. Robert. 2011/2/14 Martin Großergrosser.mar...@gmx.de: Hello, I use the osg composite viewer and I try to use some stereo mode, i.e. CHECKERBOARD, HORIZONTAL_INTERLACE or the VERTICAL_INTERLACE. But this modes don't work with the composite viewer. I use osg 2.8. I guessed it is a problem in my application, so I tried the osgcompositeviewer example with these stereo modes. Also these didn't work. Any ideas? Cheers Martin -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users
[osg-users] StandardShadowMap and Render To Texture
Hello, Every day a new problem. :-) Ok, so my Render To Texture works, but my shadows are not visible in the texture (rendertarget). My Settings: rtt_cam-setRenderOrder(::osg::Camera::PRE_RENDER, 0); rtt_cam-setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT ); rtt_cam-attach(::osg::Camera::COLOR_BUFFER, rtt_tex, 0, 0); Is the Problem the pre rendering? Because the standard shadow map has also a pre render camera. I am not sure which camera do the first rendering. Or is it another Problem? Cheers Martin -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] StandardShadowMap and Render To Texture
OK, you are right, but that is not my problem. I don't want the shadow texture, which need the DEPTH_BUFFER. I want the final rendering in my texture. The basic graph looks like this: ROOT | rtt_cam (the result has no shadows) | shadowedScene (with StandardShadowMap) | camera (is also a render to texture camera) I hope it is better explanation of my problem. Cheers Martin Original-Nachricht Datum: Wed, 16 Feb 2011 16:19:09 +0100 Von: Wojciech Lewandowski lewandow...@ai.com.pl An: osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] StandardShadowMap and Render To Texture Maybe your problem is related to the fact that Shadow maps are usually stored in DEPTH_BUFFER (not COLOR_BUFFER). Wojtek Lewandowski -Original Message- From: Martin Großer Sent: Wednesday, February 16, 2011 3:47 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] StandardShadowMap and Render To Texture Hello, Every day a new problem. :-) Ok, so my Render To Texture works, but my shadows are not visible in the texture (rendertarget). My Settings: rtt_cam-setRenderOrder(::osg::Camera::PRE_RENDER, 0); rtt_cam-setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT ); rtt_cam-attach(::osg::Camera::COLOR_BUFFER, rtt_tex, 0, 0); Is the Problem the pre rendering? Because the standard shadow map has also a pre render camera. I am not sure which camera do the first rendering. Or is it another Problem? Cheers Martin -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problem: CompositeViewer doesn't work with Stereo
Hello Robert, I tried a simple test programme. I used the composite viewer and two views. If I set up stereo on one view, it works fine. Also with the horizontal interlace. But if I set the stereo to both, I get the message Warning: detected OpenGL error 'invalid value' after RenderBin::draw(,) and only the first view works. It seems to me that my graphics context is not correct for this use case. Here the main lines of my test programme: // DisplaySettings osg::DisplaySettings* ds0 = new osg::DisplaySettings; ds0-setStereo(true); ds0-setStereoMode(osg::DisplaySettings::HORIZONTAL_INTERLACE); osg::DisplaySettings* ds1 = new osg::DisplaySettings; ds1-setStereo(true); ds1-setStereoMode(osg::DisplaySettings::HORIZONTAL_INTERLACE); // Graphics Context osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = 100; traits-y = 100; traits-width = 1000; traits-height = 800; traits-windowDecoration = true; traits-doubleBuffer = true; traits-sharedContext = 0; traits-stencil = 8; traits-useMultiThreadedOpenGLEngine=true; traits-vsync=true; traits-screenNum = 0; osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid()){ [...] } osg::ref_ptr osgViewer::View view0 = new osgViewer::View; view0-setDisplaySettings(ds0); [...] osg::ref_ptr osgViewer::View view1 = new osgViewer::View; view1-setDisplaySettings(ds1); [...] Best regards Martin Original-Nachricht Datum: Mon, 14 Feb 2011 11:36:53 + Von: Robert Osfield robert.osfi...@gmail.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Problem: CompositeViewer doesn\'t work with Stereo Hi Martin, The rendering backend is identical between Viewer and CompositeViewer so both are fully capable of doing stereo. I presume the issue comes from the DisplaySettings hints used to pass in the stereo settings. With CompositeViewer each View can have it's own DisplaySettings object so you can set this up independantly. Robert. 2011/2/14 Martin Großer grosser.mar...@gmx.de: Hello, I use the osg composite viewer and I try to use some stereo mode, i.e. CHECKERBOARD, HORIZONTAL_INTERLACE or the VERTICAL_INTERLACE. But this modes don't work with the composite viewer. I use osg 2.8. I guessed it is a problem in my application, so I tried the osgcompositeviewer example with these stereo modes. Also these didn't work. Any ideas? Cheers Martin -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] RTT and MatrixManipulator
Hello, I want to render my scene in a texture and after this I want to use that texture on a Plane in the front of a ortho camera. My question is how can I use the matrix manipulator on the rtt camera? Here my idea to do this, but it doesn't work. It is only a short form of the code to show my scene graph structure. // Plane plane-getOrCreateStateSet()-setTextureAttributeAndModes(0,texture,ON | OVERRIDE); // RTT Camera rtt_cam-setRenderTargetImplementation( FRAME_BUFFER_OBJECT ); rtt_cam-attach(COLOR_BUFFER, texture, 0, 0); // Ortho Camera ortho_cam-addChild(plane); ortho_camsetReferenceFrame(::osg::Transform::ABSOLUTE_RF); ortho_cam-setProjectionMatrixAsOrtho2D(0.0,1.0,0.0,1.0); ortho_cam-setViewMatrix(::osg::Matrix::identity()); ortho_cam-setRenderOrder(::osg::Camera::POST_RENDER); // Root Node root-addChild(scene); root-addChild(ortho_cam); // View view-setCamera(rtt_cam); view-setSceneData(root); view-setCameraManipulator(trackball); Any ideas? Thanks and best regards Martin -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT and MatrixManipulator
Ok it works for one view in my composite viewer. The problem was my texture. It didn't have the right size. However, I have 4 views and the render to texture only works for the first view. I get the following message: RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cd9 Is render to texture per view of a composite viewer possible? There are any experience about this? Cheers Martin Original-Nachricht Datum: Tue, 15 Feb 2011 12:50:34 +0100 Von: Martin Großer grosser.mar...@gmx.de An: osg-users@lists.openscenegraph.org Betreff: [osg-users] RTT and MatrixManipulator Hello, I want to render my scene in a texture and after this I want to use that texture on a Plane in the front of a ortho camera. My question is how can I use the matrix manipulator on the rtt camera? Here my idea to do this, but it doesn't work. It is only a short form of the code to show my scene graph structure. // Plane plane-getOrCreateStateSet()-setTextureAttributeAndModes(0,texture,ON | OVERRIDE); // RTT Camera rtt_cam-setRenderTargetImplementation( FRAME_BUFFER_OBJECT ); rtt_cam-attach(COLOR_BUFFER, texture, 0, 0); // Ortho Camera ortho_cam-addChild(plane); ortho_camsetReferenceFrame(::osg::Transform::ABSOLUTE_RF); ortho_cam-setProjectionMatrixAsOrtho2D(0.0,1.0,0.0,1.0); ortho_cam-setViewMatrix(::osg::Matrix::identity()); ortho_cam-setRenderOrder(::osg::Camera::POST_RENDER); // Root Node root-addChild(scene); root-addChild(ortho_cam); // View view-setCamera(rtt_cam); view-setSceneData(root); view-setCameraManipulator(trackball); Any ideas? Thanks and best regards Martin -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT and MatrixManipulator
I think it works now! My problem was in the following line: rtt_cam-setViewport(_x,_y,_width,_height); _x and _y musst be zero in all views. I guess it makes sense, but I am not sure. However, I wrote rtt_cam-setViewport(0,0,_width,_height); and it works fine! Cheers Martin Original-Nachricht Datum: Tue, 15 Feb 2011 14:40:18 +0100 Von: Martin Großer grosser.mar...@gmx.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] RTT and MatrixManipulator Ok it works for one view in my composite viewer. The problem was my texture. It didn't have the right size. However, I have 4 views and the render to texture only works for the first view. I get the following message: RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cd9 Is render to texture per view of a composite viewer possible? There are any experience about this? Cheers Martin Original-Nachricht Datum: Tue, 15 Feb 2011 12:50:34 +0100 Von: Martin Großer grosser.mar...@gmx.de An: osg-users@lists.openscenegraph.org Betreff: [osg-users] RTT and MatrixManipulator Hello, I want to render my scene in a texture and after this I want to use that texture on a Plane in the front of a ortho camera. My question is how can I use the matrix manipulator on the rtt camera? Here my idea to do this, but it doesn't work. It is only a short form of the code to show my scene graph structure. // Plane plane-getOrCreateStateSet()-setTextureAttributeAndModes(0,texture,ON | OVERRIDE); // RTT Camera rtt_cam-setRenderTargetImplementation( FRAME_BUFFER_OBJECT ); rtt_cam-attach(COLOR_BUFFER, texture, 0, 0); // Ortho Camera ortho_cam-addChild(plane); ortho_camsetReferenceFrame(::osg::Transform::ABSOLUTE_RF); ortho_cam-setProjectionMatrixAsOrtho2D(0.0,1.0,0.0,1.0); ortho_cam-setViewMatrix(::osg::Matrix::identity()); ortho_cam-setRenderOrder(::osg::Camera::POST_RENDER); // Root Node root-addChild(scene); root-addChild(ortho_cam); // View view-setCamera(rtt_cam); view-setSceneData(root); view-setCameraManipulator(trackball); Any ideas? Thanks and best regards Martin -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT and MatrixManipulator
Hello Shayne, I have multiple views in a single window. I create four views and one camera per view. Example: camera1-setViewport(0,0,400,300); camera2-setViewport(400,0,400,300); camera3-setViewport(0,300,400,300); camera4-setViewport(400,300,400,300); view1-setCamera(camera1); view2-setCamera(camera2); view3-setCamera(camera3); view4-setCamera(camera4); viewer-addView(view1); viewer-addView(view2); viewer-addView(view3); viewer-addView(view4); But I add a rtt camera in the scene graph of every view. And in this camera is the position (x,y) not important. It must be zero. Now I see it is logical. But I have another problems now. The stereoscopic option doesn't work with the RTT. Have you a hint for me about this? Thank you Martin Original-Nachricht Datum: Tue, 15 Feb 2011 09:20:04 -0700 Von: Tueller,Shayne R Civ USAF AFMC 519 SMXS/MXDEC shayne.tuel...@hill.af.mil An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] RTT and MatrixManipulator Martin, How do you have your composite viewer set up? Is it multiple views in a window or a single view per window? If you're using multiple views/viewports embedded in a single window, the viewport (x,y) are relative to the window. If your views are set up in separate windows (i.e. a view viewport per window) then the viewport (x,y) are (0,0). From what you described, I would guess it's the latter. Each view/camera should have a viewport defined otherwise things won't draw (they're clipped out). -Shayne -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Martin Großer Sent: Tuesday, February 15, 2011 7:29 AM To: OpenSceneGraph Users Subject: Re: [osg-users] RTT and MatrixManipulator I think it works now! My problem was in the following line: rtt_cam-setViewport(_x,_y,_width,_height); _x and _y musst be zero in all views. I guess it makes sense, but I am not sure. However, I wrote rtt_cam-setViewport(0,0,_width,_height); and it works fine! Cheers Martin Original-Nachricht Datum: Tue, 15 Feb 2011 14:40:18 +0100 Von: Martin Großer grosser.mar...@gmx.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] RTT and MatrixManipulator Ok it works for one view in my composite viewer. The problem was my texture. It didn't have the right size. However, I have 4 views and the render to texture only works for the first view. I get the following message: RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cd9 Is render to texture per view of a composite viewer possible? There are any experience about this? Cheers Martin Original-Nachricht Datum: Tue, 15 Feb 2011 12:50:34 +0100 Von: Martin Großer grosser.mar...@gmx.de An: osg-users@lists.openscenegraph.org Betreff: [osg-users] RTT and MatrixManipulator Hello, I want to render my scene in a texture and after this I want to use that texture on a Plane in the front of a ortho camera. My question is how can I use the matrix manipulator on the rtt camera? Here my idea to do this, but it doesn't work. It is only a short form of the code to show my scene graph structure. // Plane plane-getOrCreateStateSet()-setTextureAttributeAndModes(0,texture,ON | OVERRIDE); // RTT Camera rtt_cam-setRenderTargetImplementation( FRAME_BUFFER_OBJECT ); rtt_cam-attach(COLOR_BUFFER, texture, 0, 0); // Ortho Camera ortho_cam-addChild(plane); ortho_camsetReferenceFrame(::osg::Transform::ABSOLUTE_RF); ortho_cam-setProjectionMatrixAsOrtho2D(0.0,1.0,0.0,1.0); ortho_cam-setViewMatrix(::osg::Matrix::identity()); ortho_cam-setRenderOrder(::osg::Camera::POST_RENDER); // Root Node root-addChild(scene); root-addChild(ortho_cam); // View view-setCamera(rtt_cam); view-setSceneData(root); view-setCameraManipulator(trackball); Any ideas? Thanks and best regards Martin -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users
[osg-users] Problem: CompositeViewer doesn't work with Stereo
Hello, I use the osg composite viewer and I try to use some stereo mode, i.e. CHECKERBOARD, HORIZONTAL_INTERLACE or the VERTICAL_INTERLACE. But this modes don't work with the composite viewer. I use osg 2.8. I guessed it is a problem in my application, so I tried the osgcompositeviewer example with these stereo modes. Also these didn't work. Any ideas? Cheers Martin -- Schon gehört? GMX hat einen genialen Phishing-Filter in die Toolbar eingebaut! http://www.gmx.net/de/go/toolbar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Render To Texture is very slow
Hello, I would like use render to texture in every render step. My texture resolution is 2048 x 2048 and it is very slow. There are tipps and tricks to speed up the render to texture? With 2048 x 2048 I get around 15 FPS and with 1024 x 1024 I get 45 FPS. Thanks Martin -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render To Texture is very slow
Hello David, So I use the FRAME_BUFFER_OBJECT and I have a NVIDIA GTX 470 grafics card. I tried the osgprerendercubemap, but I cannot print out the frame rate. Additionally I tried the osgprerender example and I get a frame rate of around 3500 FPS. Here my Implementation: osg::ref_ptrosg::Image img = osgDB::readImageFile(image.tga); osg::ref_ptrosg::Group rtt = new osg::Group; root-addChild(rtt); osg::ref_ptrosg::Camera camera = new osg::Camera; camera-addChild( scene ); camera-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); camera-setViewport(0,0,2048,2048); camera-setRenderOrder(osg::Camera::PRE_RENDER, 0); camera-setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT ); camera-attach(osg::Camera::COLOR_BUFFER, img, 0, 0); rtt-addChild(camera.get()); Is the image format (internal format) a problem? Thanks Martin Original-Nachricht Datum: Wed, 2 Feb 2011 13:56:09 +0100 Von: David Callu led...@gmail.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Render To Texture is very slow Hi Martin What is your Hardware/Software configuration? Which osg::Camera::RenderTargetImplementation did you use in your code ? Try the osgprerendercubemap example to test performance of your hardware. HTH David Callu 2011/2/2 Martin Großer grosser.mar...@gmx.de Hello, I would like use render to texture in every render step. My texture resolution is 2048 x 2048 and it is very slow. There are tipps and tricks to speed up the render to texture? With 2048 x 2048 I get around 15 FPS and with 1024 x 1024 I get 45 FPS. Thanks Martin -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render To Texture is very slow
Hello Peter, that was the problem! Now I have around 1500 FPS. I didn't know there are difference between to attach an image or a texture. Thank you very much! Cheers Martin Original-Nachricht Datum: Wed, 02 Feb 2011 14:58:46 +0100 Von: Peter Hrenka p.hre...@science-computing.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Render To Texture is very slow Hi Martin, Am 02.02.2011 14:35, schrieb Martin Großer: Hello David, So I use the FRAME_BUFFER_OBJECT and I have a NVIDIA GTX 470 grafics card. I tried the osgprerendercubemap, but I cannot print out the frame rate. Additionally I tried the osgprerender example and I get a frame rate of around 3500 FPS. Here my Implementation: osg::ref_ptrosg::Image img = osgDB::readImageFile(image.tga); osg::ref_ptrosg::Group rtt = new osg::Group; root-addChild(rtt); osg::ref_ptrosg::Camera camera = new osg::Camera; camera-addChild( scene ); camera-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); camera-setViewport(0,0,2048,2048); camera-setRenderOrder(osg::Camera::PRE_RENDER, 0); camera-setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT ); camera-attach(osg::Camera::COLOR_BUFFER, img, 0, 0); Your performance Problem is in the previous line: By attaching an image you instruct OSG to fetch the whole image back to CPU memory (for each frame!). If this is what you really want, it probably is as fast as it will get. If you want to use the rendered image on the GPU, then you should attach an osg::Texture instead. See osgprerender example, with useImage=false. rtt-addChild(camera.get()); Is the image format (internal format) a problem? Thanks Martin Cheers, Peter -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Michel Lepert Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Can I do somthing between two render passes?
Hello, Is it possible to do something between two render passes? I render an image into a texture and then I would like execute functions and after this I wanna render the final image on the screen. I use the osg::Camera with PRE_RENDER and the FRAME_BUFFER_OBJECT. And this camera is in my scenegraph. What can I do if I want to work on the texture after the first render step? Cheers Martin -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Postrendering Effects only with RTT?
Hello, if I want to create a blur effect or a focus effect, if is absolutely necessary to do it with Render To Texture? The question is: Do I have to create a plane with a texture or there are an other way to do that? And Do I have to bind a callback function to the plane for the resize event of the viewer? Have someone implemented post rendering effects like blur, focus or glare before and can give me some helpful hints? Cheers Martin -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] SEPERATE_WINDOW is that correct?
Hello, a little question or hint about the expression SEPERATE_WINDOW in the osg::Camera. It is not so important, but I guess SEPARATE_WINDOW would be correct. I have noticed that and I thought I post it here. Cheers Martin -- GRATIS! Movie-FLAT mit über 300 Videos. Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] SEPERATE_WINDOW is that correct?
Hello Robert, no no I don't have a question. SEPARATE_WINDOW is misspelt in osg::Camera. I had use that and the compiler said something like SEPARATE_WINDOW is not found because in osg it is misspelt -- SEPERATE_WINDOW. Maybe it is not so important, but I want to let you know that. That's all. Additional I'm using osg-2.8.3. Cheers Martin Original-Nachricht Datum: Thu, 2 Dec 2010 11:58:39 + Von: Robert Osfield robert.osfi...@gmail.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] SEPERATE_WINDOW is that correct? Hi Martin, 2010/12/2 Martin Großer grosser.mar...@gmx.de: a little question or hint about the expression SEPERATE_WINDOW in the osg::Camera. It is not so important, but I guess SEPARATE_WINDOW would be correct. I have noticed that and I thought I post it here. I can't work out what your question is... SEPARATE_WINDOW is useful for debugging render to texture techniques, instead of using an FBO or a pbuffer it hints to the OSG to create a separate GraphicsWindow that is rendered to and then a copy is done to the attach texture/image. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GRATIS! Movie-FLAT mit über 300 Videos. Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] My Render to Texture is very slow
Hello, I've implemented a RTT example with osg and I my scene object is the cessna.osg. Without the RTT-Implementation I have around 4500 fps. But with the RTT I have only 380 fps. My Texture is 512 x 512. What is the Problem? I have got a GeForce 470 and a intel processor i7 820. I guess the hardware is ok. My Implementation is: osg::Vec3 eye(40,-40,40); osg::Vec3 point(0,0,0); c-addChild(in); c-setReferenceFrame(osg::Transform::ABSOLUTE_RF); c-setProjectionMatrixAsPerspective(30.0,1.0,0.1,100.0); c-setViewMatrixAsLookAt(eye,point,osg::Vec3(0,0,1)); c-setClearColor(osg::Vec4(0.4,0.0,0.0,0.0)); c-setViewport(0,0,512,512); c-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); c-setRenderOrder(osg::Camera::PRE_RENDER, 0); c-setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT ); c-attach(osg::Camera::COLOR_BUFFER, img, 0, 0); Is my implementation the problem? In OpenGL I can use glCopyTexImage2D(...). There are a Wrapper in OSG for this functionality? Cheers, Martin -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] My Render to Texture is very slow
Hello Robert, that is correct with the frame rate. 380 fps is ok, but it is a very simple scene. But what happens if I have 150.000 polygons? My apprehension is that the frame rate will break down. You wrote there are an approach to render to texture only on the gpu. How can I do that? With a GLSL-Shader? I want to give you a little introduction about my motivation. The reason is I want to move the pixels on my screen. For example I want to move the color information from [0,0] to [3,3] and so on. I guess it can be solve on the gpu. Cheers, Martin Original-Nachricht Datum: Fri, 26 Nov 2010 13:52:44 + Von: Robert Osfield robert.osfi...@gmail.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] My Render to Texture is very slow Hi Martin, There isn't a technical problem, just a need of greater understanding of what's happening in OpenGL and the CPU and GPU. OpenGL has a deep FIFO buffer than your application put all the required OpenGL tokens and data into, the OpenGL driver packages this up and send it the GPU. This pipeline enables the CPU and GPU to be run asynchronously, and at perform at a high performance level. However, the asynchronous nature provided by the OpenGL FIFO is broken any time you need to get data from GPU, a glReadPixels is one such operation - to handle this OpenGL call the driver has to block the application thread and wait for all the data in the FIFO to be processed by the GPU, then it can copy the data back to the CPU and return it to your application. This round trip to the GPU is therefore extremely costly. In your case attaching an osg::Image to a RTT Camera forces the OSG to use a glReadPixels. There are different techniques to address this issue, which is appropriate depends upon your needs. One approach is to do all render to texture work down on the GPU and avoid ever needing to copy data back to the main memory. Another approach is to use double buffer PBO's to read the data back in the subsequent frame. However, in all these changes perhaps they aren't needed. You are getting 380fps which is many times faster than screen refresh, and if you app is rev'ing faster than screen refresh then you are wasting your time worrying about optimizing. Just stick vsync on, reduce your energy consumption and noise pollution, and enjoy the better visual quality. If there does come a day when you app starts breaking frame then worry about it. Robert. 2010/11/26 Martin Großer grosser.mar...@gmx.de: Hello, I've implemented a RTT example with osg and I my scene object is the cessna.osg. Without the RTT-Implementation I have around 4500 fps. But with the RTT I have only 380 fps. My Texture is 512 x 512. What is the Problem? I have got a GeForce 470 and a intel processor i7 820. I guess the hardware is ok. My Implementation is: osg::Vec3 eye(40,-40,40); osg::Vec3 point(0,0,0); c-addChild(in); c-setReferenceFrame(osg::Transform::ABSOLUTE_RF); c-setProjectionMatrixAsPerspective(30.0,1.0,0.1,100.0); c-setViewMatrixAsLookAt(eye,point,osg::Vec3(0,0,1)); c-setClearColor(osg::Vec4(0.4,0.0,0.0,0.0)); c-setViewport(0,0,512,512); c-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); c-setRenderOrder(osg::Camera::PRE_RENDER, 0); c-setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT ); c-attach(osg::Camera::COLOR_BUFFER, img, 0, 0); Is my implementation the problem? In OpenGL I can use glCopyTexImage2D(...). There are a Wrapper in OSG for this functionality? Cheers, Martin -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] LightSource?
Hello, I have been trying to use the osg::Light and osg::LightSource in my application this week. The light source is a osg::Group and I would like to know what's happen when I add a child node to this group? I don't know why the light source must be a group? What is the reason about this? Cheers Martin -- GMX DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Texture on a HeightField?!
Hello, is it possible to texture a osg::HeightField? Cheers Martin -- GMX DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How can I use the Light?
Hello, I use osg long time ago, but I think I don't understand the light concept. Can everyone explain me the correct use of Light, LightSource and ShadowMap? In previous implementations I put the Light into the LightSource and the LightSource into my scene graph. Now my root node is a ShadowGroup. But the Shadow doesn't work. Musst I use a special order in the graph? Why there are a Light and a LightSource? Is the relative position of the shadow group to the light source important? Thanks Martin -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I calculate a matrix via a MatrixManipulator
Hello Jean-Sébastien, I guess it wouldn't work, because I use the setUpViewerAsEmbeddedInWindow(...)-Method of the osgViewer::Viewer. The composite viewer don't have this function. Cheers Martin Original-Nachricht Datum: Wed, 03 Nov 2010 10:45:46 -0400 Von: Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] How can I calculate a matrix via a MatrixManipulator Hello Martin, Yes I know, but I won't to use the CompositeViewer. Because I will use this feature in the gtk embedded viewer. CompositeViewer and embedded graphics contexts are two separate things. You can still use a CompositeViewer even if you use an embedded graphics context. In your case, I assume you're using a single window with multiple views overlaid over the main one? You could create multiple osgViewer::Views, then set the same GraphicsContext (GraphicsWindowEmbedded in your case I guess) on all the views' main cameras. Then set a different CameraManipulator on each view and you're set. Having now looked at the osgviewerGTK code, I see it has a class OSGGTKDrawingArea that derives from osgViewer::Viewer. That strikes me as unnecessary coupling, but I've only looked at the code quickly, so I don't know the details. You could make this derive from CompositeViewer instead. I don't know what it uses from osgViewer::Viewer - perhaps instead of deriving, it could have a pointer to an osgViewer::ViewerBase instead? Then it would be independent of the viewer type. Anyways, I can imagine it's probably more work than what you want to do, but CompositeViewer is the tool you need, so using things as designed will be more future-proof. Alternatively calling getInverseMatrix() and setting that matrix on the camera you want might work, or might not. Or just don't use a camera manipulator and write your own event handler that will manipulate the camera's view matrix. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I calculate a matrix via a MatrixManipulator
Oh yes, now I understand it! I must delegate the functionality to the views. For example: viewer-setSceneData(...) ...; MyCompsiteViewer(...){... getView(i)-setSceneData(...); } And I write a own setUpViewerAsEmbeddedInWindow(...) like that: GraphicsWindowEmbedded* setUpViewerAsEmbeddedInWindow(int x, int y, int width, int height) { setThreadingModel(SingleThreaded); osgViewer::GraphicsWindowEmbedded* gw; gw = new osgViewer::GraphicsWindowEmbedded(x,y,width,height); // camera of the view with id i getCamera(i)-setViewport(new osg::Viewport(0,0,width,height)); double ar = static_castdouble(width)/static_castdouble(height); getCamera(i)-setProjectionMatrixAsPerspective(30.0f, ar, 1.0f, 1.0f); getCamera(i)-setGraphicsContext(gw); return gw; } It seems to me that I understand this solution. I try it. Thanks Martin Original-Nachricht Datum: Fri, 05 Nov 2010 09:46:01 -0400 Von: Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] How can I calculate a matrix via a MatrixManipulator Hello Martin, I guess it wouldn't work, because I use the setUpViewerAsEmbeddedInWindow(...)-Method of the osgViewer::Viewer. The composite viewer don't have this function. But that method is not magical, you can just copy the code from it and do it yourself. All it does AFAIK is create a GraphicsWindowEmbedded and set it on the Viewer's camera. Just do the same, but create your osgViewer::Views and set the context on each of those views' cameras. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I calculate a matrix via a MatrixManipulator
Hello Jean-Sébastien, I tried it and it works. Your tip was perfect. Thanks Martin Original-Nachricht Datum: Fri, 05 Nov 2010 16:50:22 +0100 Von: Martin Großer grosser.mar...@gmx.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] How can I calculate a matrix via a MatrixManipulator Oh yes, now I understand it! I must delegate the functionality to the views. For example: viewer-setSceneData(...) ...; MyCompsiteViewer(...){... getView(i)-setSceneData(...); } And I write a own setUpViewerAsEmbeddedInWindow(...) like that: GraphicsWindowEmbedded* setUpViewerAsEmbeddedInWindow(int x, int y, int width, int height) { setThreadingModel(SingleThreaded); osgViewer::GraphicsWindowEmbedded* gw; gw = new osgViewer::GraphicsWindowEmbedded(x,y,width,height); // camera of the view with id i getCamera(i)-setViewport(new osg::Viewport(0,0,width,height)); double ar = static_castdouble(width)/static_castdouble(height); getCamera(i)-setProjectionMatrixAsPerspective(30.0f, ar, 1.0f, 1.0f); getCamera(i)-setGraphicsContext(gw); return gw; } It seems to me that I understand this solution. I try it. Thanks Martin Original-Nachricht Datum: Fri, 05 Nov 2010 09:46:01 -0400 Von: Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] How can I calculate a matrix via a MatrixManipulator Hello Martin, I guess it wouldn't work, because I use the setUpViewerAsEmbeddedInWindow(...)-Method of the osgViewer::Viewer. The composite viewer don't have this function. But that method is not magical, you can just copy the code from it and do it yourself. All it does AFAIK is create a GraphicsWindowEmbedded and set it on the Viewer's camera. Just do the same, but create your osgViewer::Views and set the context on each of those views' cameras. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GRATIS! Movie-FLAT mit über 300 Videos. Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I calculate a matrix via a MatrixManipulator
Hello Jean-Sébastien, I have try this way, but it doesn't work. I guess the manipulator needs more information. For example, when I set the manipulator in the viewer via addEventHandler(), it doesn't work. A manipulator must set with setCameraManipulator(). I have many viewports now and I use a GUIEventHandler to detect the viewport which I hit with the mouse. And now I would like manipulate the camera of this viewport. That is my basic problem. There are a better way, for this problem? Thanks Martin Original-Nachricht Datum: Tue, 02 Nov 2010 13:00:30 -0400 Von: Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] How can I calculate a matrix via a MatrixManipulator Hi Martin, TrackballManipulator* tm = new TrackballManipulator() tm-calculateViewMatrix(eventAdapter, ActionAdapter); Well, inside your own handle(ea, aa) you can always call the manipulator's handle(ea, aa). Is that what you mean? And when you want the view matrix you call the manipulator's getInverseMatrix() method. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I calculate a matrix via a MatrixManipulator
Maybe my problem declaration is unclear. Sorry about this. The goal is I doesn't want to set the camera (master camera) of the viewer. That do the CameraManipulator. I want use the Matrix (or inverse matrix) to set the view matrix of another camera. I have 4 cameras (viewports) and I want change only the camera of one viewport. Is this an better explanation? I hope so. Cheers Martin Original-Nachricht Datum: Wed, 03 Nov 2010 09:20:44 -0400 Von: Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] How can I calculate a matrix via a MatrixManipulator Hello Martin, I have try this way, but it doesn't work. I guess the manipulator needs more information. For example, when I set the manipulator in the viewer via addEventHandler(), it doesn't work. A manipulator must set with setCameraManipulator(). Well I don't know much about what you're doing, just small bits of information... Is the manipulator above your own manipulator or the trackball manipulator? What I thought you were doing was: class MyCameraManipulator : public osgGA::CameraManipulator { public: MyCameraManipulator() : osgGA::CameraManipulator(), _trackball(new osgGA::TrackballManipulator) {} virtual bool handle(ea, aa) { // handle my events //at the end, call trackball so it also handles its events return _trackball-handle(ea, aa); } virtual osg::Matrixd getInverseMatrix() { return _trackball-getInverseMatrix(); } // ... }; // in main() viewer-setCameraManipulator( new MyCameraManipulator ); This should work, I think. If it doesn't then you need to start up your debugger and trace what's going on, I can't do it for you... The basic principle is that the view will call its camera manipulator's getInverseMatrix() method once per frame to get the updated view matrix. It won't do this for a general event handler set by addEventHandler()... If you don't set a camera manipulator on your view(er), then you need to pass it a view matrix some other way, because no one will call your camera manipulator's getInverseMatrix()... So you can't set the manipulator with addEventHandler(), it doesn't make sense, because the camera manipulator is a special event handler whose getInverseMatrix() method must be called. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GRATIS! Movie-FLAT mit über 300 Videos. Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I calculate a matrix via a MatrixManipulator
Yes I know, but I won't to use the CompositeViewer. Because I will use this feature in the gtk embedded viewer. Cheers Martin Original-Nachricht Datum: Wed, 03 Nov 2010 10:13:24 -0400 Von: Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] How can I calculate a matrix via a MatrixManipulator Hi Martin, Maybe my problem declaration is unclear. Sorry about this. The goal is I doesn't want to set the camera (master camera) of the viewer. That do the CameraManipulator. I want use the Matrix (or inverse matrix) to set the view matrix of another camera. I have 4 cameras (viewports) and I want change only the camera of one viewport. Is this an better explanation? I hope so. Are you using CompositeViewer with multiple Views? Each view has its own camera, and can have different camera manipulators. So when you manipulate the camera in one view it won't affect other views. You can always call getInverseMatrix() yourself on the manipulator and then pass that matrix to the camera you want to manipulate, CompositeViewer and CameraManipulators are designed to do this for you. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GRATIS! Movie-FLAT mit über 300 Videos. Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I calculate a matrix via a MatrixManipulator
Hello, it works! I'm very happy now. It was another mistake. I have write my EventHandler and call the handle-method of the manipulator in the handle method of my handler. That was the first idea of Jean-Sebastien. My problem was I had define another event handler above and this makes problems for my second event handler. bool handle(const osgGA::GUIEventAdapter ea,osgGA::GUIActionAdapter us) { switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::FRAME): _activeViewport = getActiveViewport(ea); _tm = _viewports[_activeViewport]-getManipulator(); _viewports[_activeViewport]-setViewMatrix(_tm-getInverseMatrix()); } return _tm-handle(ea,us); } That is my solution. Cheers Martin Original-Nachricht Datum: Wed, 03 Nov 2010 15:19:28 +0100 Von: Martin Großer grosser.mar...@gmx.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] How can I calculate a matrix via a MatrixManipulator Yes I know, but I won't to use the CompositeViewer. Because I will use this feature in the gtk embedded viewer. Cheers Martin Original-Nachricht Datum: Wed, 03 Nov 2010 10:13:24 -0400 Von: Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] How can I calculate a matrix via a MatrixManipulator Hi Martin, Maybe my problem declaration is unclear. Sorry about this. The goal is I doesn't want to set the camera (master camera) of the viewer. That do the CameraManipulator. I want use the Matrix (or inverse matrix) to set the view matrix of another camera. I have 4 cameras (viewports) and I want change only the camera of one viewport. Is this an better explanation? I hope so. Are you using CompositeViewer with multiple Views? Each view has its own camera, and can have different camera manipulators. So when you manipulate the camera in one view it won't affect other views. You can always call getInverseMatrix() yourself on the manipulator and then pass that matrix to the camera you want to manipulate, CompositeViewer and CameraManipulators are designed to do this for you. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GRATIS! Movie-FLAT mit über 300 Videos. Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How can I calculate a matrix via a MatrixManipulator
Hello, is it possible to use a osgGA::MatrixManipulator to calculate a ViewMatrix on demand? I won't put the manipulator in the viewer like this: viewer-setCameraManipulator(new TrackballManipulator); I want to use it like: TrackballManipulator* tm = new TrackballManipulator() tm-calculateViewMatrix(eventAdapter, ActionAdapter); The reason is, I have already a GUIEventHandler and this event handler should use the TrackballManipulator to calculate a view matrix. Also I want to make a delegation. How can I do this? Cheers Martin -- GMX DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Two Viewports with one Camera
Hello all, I would like use two viewports in my application and one camera. Is this possible? I think, the normal way is to define the viewport for a camera like: camera-setViewport(...) Is the only way to define camera, copy the camera and set the viewports separatly for every camera? The main problem is when I change the camera settings, I have to copy the camera again. Cheers Martin -- GMX DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Two Viewports with one Camera
Ah OK, the render to texture idea is maybe a good alternative. Do the RTT affect the performance? My idea was a observer pattern. The camera settings are in a subject object and the osg::Camera is in the observer object. When the settings to be change the subject notify the observer (cameras with different viewports). But I think it is time consuming. Do you think, the RTT is the better way? Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 17:32:34 +1100 Von: Ulrich Hertlein u.hertl...@sandbox.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi Martin, On 29/10/10 17:17 , Martin Großer wrote: I would like use two viewports in my application and one camera. Is this possible? I think, the normal way is to define the viewport for a camera like: camera-setViewport(...) I can't say if it's possible, but if it is then I'd guess it renders the same scene twice. In this case it might be easier to render to a texture and just display the texture in two viewports. /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Two Viewports with one Camera
I made a thumbnail sketch with the two concepts (see png). On the one hand (blue graph) I use three cameras with the diffrent viewport settings, on the other hand (yellow graph) I use one camera (ortho) and create geometry nodes (planes) and map the texture on this planes. The main question is: what is the efficient way? Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 09:00:40 +0200 Von: Martin Großer grosser.mar...@gmx.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Ah OK, the render to texture idea is maybe a good alternative. Do the RTT affect the performance? My idea was a observer pattern. The camera settings are in a subject object and the osg::Camera is in the observer object. When the settings to be change the subject notify the observer (cameras with different viewports). But I think it is time consuming. Do you think, the RTT is the better way? Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 17:32:34 +1100 Von: Ulrich Hertlein u.hertl...@sandbox.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi Martin, On 29/10/10 17:17 , Martin Großer wrote: I would like use two viewports in my application and one camera. Is this possible? I think, the normal way is to define the viewport for a camera like: camera-setViewport(...) I can't say if it's possible, but if it is then I'd guess it renders the same scene twice. In this case it might be easier to render to a texture and just display the texture in two viewports. /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl attachment: camera_viewport_concept.png___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Two Viewports with one Camera
Ok. I try the slave variant. I have a additional question. When I use two different cameras and three viewports, how would you implement this. Two viewport have the first camera and the third viewport has the second camera. My idea is something like this: // Camera 1 osg::Camera* cam1 = new ... slaveCam1-setViewport(...); // Slave Camera 1 osg::Camera* slaveCam1 = new ... slaveCam1-setViewport(...); // Camera 2 osg::Camera* cam2 = new ... cam2-setViewport(...); cam2-addChild(scene); // RootNode // Camera two as a part of the scene graph. Is this clever? osg::Group* root = new ... root-addChild(scene); root-addChild(cam2); // Viewer osg::Viewer* viewer = new ... viewer-setSceneData(root); viewer-setCamera(cam1); viewer-addSlave(slaveCam1); Is this the right way? And what is your commendation to use different camera manipulators. That means, what can I do when I want to use a manipulator for the second camera (the camera in the root node). My idea is to write a GUIEventhandler. This should check the mouse position and give the viewport or the camera and then I calculate the new position like the trackball manipulator. That is the approximate idea. Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 09:21:29 +0100 Von: Robert Osfield robert.osfi...@gmail.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi Martin, I'm a bit confused by the thread, but as a general note you shouldn't go attempting to use two separate Viewport per Camera. The OSG fully supports slave Camera that can share scene graphs and share the same graphics context, so it's straight forward to implement and manage, the osgViewer design has been specifically designed to make this type of usage as simple as possible. Robert. 2010/10/29 Martin Großer grosser.mar...@gmx.de: Hello all, I would like use two viewports in my application and one camera. Is this possible? I think, the normal way is to define the viewport for a camera like: camera-setViewport(...) Is the only way to define camera, copy the camera and set the viewports separatly for every camera? The main problem is when I change the camera settings, I have to copy the camera again. Cheers Martin -- GMX DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Two Viewports with one Camera
Hello, the problem is that I want to use a embedded viewer (gtk), too. I guess it doesn't work with the composite viewer. Or is it possible? Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 10:58:10 +0200 Von: J.P. Delport jpdelp...@csir.co.za An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi, On 29/10/10 10:48, Martin Großer wrote: Ok. I try the slave variant. I have a additional question. When I use two different cameras and three viewports, how would you implement this. Two viewport have the first camera and the third viewport has the second camera. My idea is something like this: // Camera 1 osg::Camera* cam1 = new ... slaveCam1-setViewport(...); // Slave Camera 1 osg::Camera* slaveCam1 = new ... slaveCam1-setViewport(...); // Camera 2 osg::Camera* cam2 = new ... cam2-setViewport(...); cam2-addChild(scene); // RootNode // Camera two as a part of the scene graph. Is this clever? osg::Group* root = new ... root-addChild(scene); root-addChild(cam2); // Viewer osg::Viewer* viewer = new ... viewer-setSceneData(root); viewer-setCamera(cam1); viewer-addSlave(slaveCam1); Is this the right way? And what is your commendation to use different camera manipulators. That means, what can I do when I want to use a manipulator for the second camera (the camera in the root node). My idea is to write a GUIEventhandler. This should check the mouse position and give the viewport or the camera and then I calculate the new position like the trackball manipulator. That is the approximate idea. Do you want something different from what happens if you run osgcompositeviewer cow.osg. There, each view can have its own manipulator. jp Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 09:21:29 +0100 Von: Robert Osfieldrobert.osfi...@gmail.com An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi Martin, I'm a bit confused by the thread, but as a general note you shouldn't go attempting to use two separate Viewport per Camera. The OSG fully supports slave Camera that can share scene graphs and share the same graphics context, so it's straight forward to implement and manage, the osgViewer design has been specifically designed to make this type of usage as simple as possible. Robert. 2010/10/29 Martin Großergrosser.mar...@gmx.de: Hello all, I would like use two viewports in my application and one camera. Is this possible? I think, the normal way is to define the viewport for a camera like: camera-setViewport(...) Is the only way to define camera, copy the camera and set the viewports separatly for every camera? The main problem is when I change the camera settings, I have to copy the camera again. Cheers Martin -- GMX DSL Doppel-Flat ab 19,99euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GRATIS! Movie-FLAT mit über 300 Videos. Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Two Viewports with one Camera
Hello, OK, for the completeness of my problem. I want to use two different viewer. An normal OSGViewer and a GTKViewer. The common denominator is the osg::Viewer class. I want to use one or more viewports and one or more cameras. And every camera can show different scenes. The cameras should have a manipulator like trackball manipulator. I guess the problem is not so trivial. I try to do this: - First camera is the master camera (set camera and scene data in viewer) viewer-setCamera(cam_1); root-addChild(scene_1); viewer-setSceneData(root); - next camera set in the scene graph and the scene is a child of the camera cam_2-addChild(scene_2); root-addChild(cam_2); - and so on for more cameras with a scene - now I set the viewports cam_1-viewport(...); cam_2-viewport(...); - it works fine, but now I want to add a third viewport with the first camera, too cam_1-addChild(scene_1); root-addChild(cam_1); cam_1-setviewport(...); - it is unsurprising that doesn't work That is my actual state of affairs. Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 11:14:56 +0200 Von: J.P. Delport jpdelp...@csir.co.za An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi, On 29/10/10 11:02, Martin Großer wrote: Hello, the problem is that I want to use a embedded viewer (gtk), too. I guess it doesn't work with the composite viewer. Or is it possible? sorry, I'm not sure. jp Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 10:58:10 +0200 Von: J.P. Delportjpdelp...@csir.co.za An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi, On 29/10/10 10:48, Martin Großer wrote: Ok. I try the slave variant. I have a additional question. When I use two different cameras and three viewports, how would you implement this. Two viewport have the first camera and the third viewport has the second camera. My idea is something like this: // Camera 1 osg::Camera* cam1 = new ... slaveCam1-setViewport(...); // Slave Camera 1 osg::Camera* slaveCam1 = new ... slaveCam1-setViewport(...); // Camera 2 osg::Camera* cam2 = new ... cam2-setViewport(...); cam2-addChild(scene); // RootNode // Camera two as a part of the scene graph. Is this clever? osg::Group* root = new ... root-addChild(scene); root-addChild(cam2); // Viewer osg::Viewer* viewer = new ... viewer-setSceneData(root); viewer-setCamera(cam1); viewer-addSlave(slaveCam1); Is this the right way? And what is your commendation to use different camera manipulators. That means, what can I do when I want to use a manipulator for the second camera (the camera in the root node). My idea is to write a GUIEventhandler. This should check the mouse position and give the viewport or the camera and then I calculate the new position like the trackball manipulator. That is the approximate idea. Do you want something different from what happens if you run osgcompositeviewer cow.osg. There, each view can have its own manipulator. jp Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 09:21:29 +0100 Von: Robert Osfieldrobert.osfi...@gmail.com An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi Martin, I'm a bit confused by the thread, but as a general note you shouldn't go attempting to use two separate Viewport per Camera. The OSG fully supports slave Camera that can share scene graphs and share the same graphics context, so it's straight forward to implement and manage, the osgViewer design has been specifically designed to make this type of usage as simple as possible. Robert. 2010/10/29 Martin Großergrosser.mar...@gmx.de: Hello all, I would like use two viewports in my application and one camera. Is this possible? I think, the normal way is to define the viewport for a camera like: camera-setViewport(...) Is the only way to define camera, copy the camera and set the viewports separatly for every camera? The main problem is when I change the camera settings, I have to copy the camera again. Cheers Martin -- GMX DSL Doppel-Flat ab 19,99euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal
Re: [osg-users] Two Viewports with one Camera
I try this concept, now. (see png) I'm not sure, but I guess it is a elegant solution. Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 11:35:04 +0200 Von: Martin Großer grosser.mar...@gmx.de An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hello, OK, for the completeness of my problem. I want to use two different viewer. An normal OSGViewer and a GTKViewer. The common denominator is the osg::Viewer class. I want to use one or more viewports and one or more cameras. And every camera can show different scenes. The cameras should have a manipulator like trackball manipulator. I guess the problem is not so trivial. I try to do this: - First camera is the master camera (set camera and scene data in viewer) viewer-setCamera(cam_1); root-addChild(scene_1); viewer-setSceneData(root); - next camera set in the scene graph and the scene is a child of the camera cam_2-addChild(scene_2); root-addChild(cam_2); - and so on for more cameras with a scene - now I set the viewports cam_1-viewport(...); cam_2-viewport(...); - it works fine, but now I want to add a third viewport with the first camera, too cam_1-addChild(scene_1); root-addChild(cam_1); cam_1-setviewport(...); - it is unsurprising that doesn't work That is my actual state of affairs. Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 11:14:56 +0200 Von: J.P. Delport jpdelp...@csir.co.za An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi, On 29/10/10 11:02, Martin Großer wrote: Hello, the problem is that I want to use a embedded viewer (gtk), too. I guess it doesn't work with the composite viewer. Or is it possible? sorry, I'm not sure. jp Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 10:58:10 +0200 Von: J.P. Delportjpdelp...@csir.co.za An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi, On 29/10/10 10:48, Martin Großer wrote: Ok. I try the slave variant. I have a additional question. When I use two different cameras and three viewports, how would you implement this. Two viewport have the first camera and the third viewport has the second camera. My idea is something like this: // Camera 1 osg::Camera* cam1 = new ... slaveCam1-setViewport(...); // Slave Camera 1 osg::Camera* slaveCam1 = new ... slaveCam1-setViewport(...); // Camera 2 osg::Camera* cam2 = new ... cam2-setViewport(...); cam2-addChild(scene); // RootNode // Camera two as a part of the scene graph. Is this clever? osg::Group* root = new ... root-addChild(scene); root-addChild(cam2); // Viewer osg::Viewer* viewer = new ... viewer-setSceneData(root); viewer-setCamera(cam1); viewer-addSlave(slaveCam1); Is this the right way? And what is your commendation to use different camera manipulators. That means, what can I do when I want to use a manipulator for the second camera (the camera in the root node). My idea is to write a GUIEventhandler. This should check the mouse position and give the viewport or the camera and then I calculate the new position like the trackball manipulator. That is the approximate idea. Do you want something different from what happens if you run osgcompositeviewer cow.osg. There, each view can have its own manipulator. jp Cheers Martin Original-Nachricht Datum: Fri, 29 Oct 2010 09:21:29 +0100 Von: Robert Osfieldrobert.osfi...@gmail.com An: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi Martin, I'm a bit confused by the thread, but as a general note you shouldn't go attempting to use two separate Viewport per Camera. The OSG fully supports slave Camera that can share scene graphs and share the same graphics context, so it's straight forward to implement and manage, the osgViewer design has been specifically designed to make this type of usage as simple as possible. Robert. 2010/10/29 Martin Großergrosser.mar...@gmx.de: Hello all, I would like use two viewports in my application and one camera. Is this possible? I think, the normal way is to define the viewport for a camera like: camera-setViewport(...) Is the only way to define camera, copy the camera and set the viewports separatly for every camera? The main problem is when I change the camera settings, I have to copy the camera again. Cheers Martin -- GMX DSL Doppel-Flat ab 19,99euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net
Re: [osg-users] Two Viewports with one Camera
Yes, I understand. I try the RTT-Idea. Maybe it serve my purpose. Otherwise I drop this idea and try a observer pattern in my software architecture. Thank you very much. Martin Original-Nachricht Datum: Fri, 29 Oct 2010 11:02:43 +0100 Von: Robert Osfield robert.osfi...@gmail.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] Two Viewports with one Camera Hi Martin, 2010/10/29 Martin Großer grosser.mar...@gmx.de: Ok. I try the slave variant. I have a additional question. When I use two different cameras and three viewports, how would you implement this. Two viewport have the first camera and the third viewport has the second camera. Arggg,.. Use three camera's. Drop the idea of sharing a single Viewport on a single Camera, it's simply not a sensible idea, the OSG hasn't been designed around the ability to keep flipping Camera Viewport in the way you want. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL Doppel-Flat ab 19,99 euro;/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How can I rotate a image
Hello, I would like rotate a image. Because I want to rotate the separate images from my sky box. I think it is difficult to change the texture coordinates of my sphere. I my idea is to rotate the images at the beginning. Example ::osg::Image* image = osgDB::readImageFile(c_posX.Filename); // rotate image _cubeMap-setImage(::osg::TextureCubeMap::POSITIVE_X, image); I hope someone can help me. Cheers Martin -- GMX DSL SOMMER-SPECIAL: Surf Phone Flat 16.000 für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I rotate a image
Ok, also I have create a sky box like the sky box in the vertexprogramm example of osg. But in my scene the up vector is in the z direction and not in the y direction. Now I have rotate my sky box 90 degrees around the x axis. Is it understandable? But now, the images on the sky box are in the wrong orientation. For example the image in the positiv x direction is 90 degrees rotated. And I want to correct this rotation. Is it understandable? I am not sure. Cheers Martin Original-Nachricht Datum: Tue, 7 Sep 2010 14:57:24 +0400 Von: Trajce (Nick) Nikolov nikolov.tra...@gmail.com An: OpenSceneGraph Users osg-users@lists.openscenegraph.org Betreff: Re: [osg-users] How can I rotate a image what do you mean by rotating an image? Could you tell what you are actually trying to do? More info you provide more chances to get some advice -Nick 2010/9/7 Martin Großer grosser.mar...@gmx.de Hello, I would like rotate a image. Because I want to rotate the separate images from my sky box. I think it is difficult to change the texture coordinates of my sphere. I my idea is to rotate the images at the beginning. Example ::osg::Image* image = osgDB::readImageFile(c_posX.Filename); // rotate image _cubeMap-setImage(::osg::TextureCubeMap::POSITIVE_X, image); I hope someone can help me. Cheers Martin -- GMX DSL SOMMER-SPECIAL: Surf Phone Flat 16.000 für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GMX DSL SOMMER-SPECIAL: Surf Phone Flat 16.000 für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Fag and Shadows
Hello all, I try to implement fog in my scene. It works fine and a was very happy, but after this I would like shadows in my scene and I include a standard shadow map. But my fog doesn't work now. Here my // Shadowed Scene osg::ref_ptrosgShadow::ShadowedScene shadowedScene = new osgShadow::ShadowedScene; shadowedScene-setReceivesShadowTraversalMask(ReceivesShadowTraversalMask); shadowedScene-setCastsShadowTraversalMask(CastsShadowTraversalMask); shadowedScene-addChild(node); root = shadowedScene; StandardShadowMap* ssm; // StandardShadowMap is my a wrapper ssm = new StandardShadowMap(2048,2048); shadowedScene-setShadowTechnique( ssm-getShadowTechnique() ); // StateSet (Fog) osg::Fog* fog = new osg::Fog(); osg::StateSet* state = root-getOrCreateStateSet(); state-setMode(GL_DEPTH_TEST,osg::StateAttribute::ON); state-setMode(GL_FOG, osg::StateAttribute::ON); fog-setColor( viewer-getCamera()-getClearColor() ); fog-setDensity(0.0); fog-setMode(osg::Fog::LINEAR); fog-setStart(50.0f); fog-setEnd(60.0f); fog-setFogCoordinateSource(osg::Fog::FRAGMENT_DEPTH); state-setAttributeAndModes(fog,osg::StateAttribute::ON); Also the root is my osgShadow::ShadowedScene and for this node, I set up the fog. What can I do to use fog and shadows? Cheers Martin -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Mixin Shadow Technique
Hello, is it possible to mix two different osg shadow techniques. I would like use the parallel split shadow map for my terrain and the standard shadow map for my vehicle. Cheers Martin -- GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl. Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Cubemap
Hello, can it be possible that the positive y and the negative y are interchanged? The example osgvertexprogram use the Cubemap_snow and the negy.jpg looks like the positive y. I think the correct settings looks like the following image: http://www.waterpg.com/wordpress/wp-content/uploads/2009/08/cube_map_unfolded.jpg Cheers Martin -- GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl. Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] What is the different between the DisplayTypes?
Hi Farshid, thank you very much for the explanation. Have you an idea why the Head_Mounted_Display need asymmetric frustums? Cheers Martin Am 16.06.2010 18:14, schrieb Farshid Lashkari: Hi Martin, 2010/6/16 Martin Großer grosser.mar...@gmx.de mailto:grosser.mar...@gmx.de can everybody explane what the different between the display types? For example, what is different between MONITOR and POWERWALL? When I try to use the Powerwall and I set the type MONITOR it works very good. I'm not sure about the other types, but I know that the HEAD_MOUNTED_DISPLAY option is used during stereo rendering to create symmetric frustums. All the other options will produce asymmetric frustums for the left/right eye. Cheers, Farshid ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] What is the different between the DisplayTypes?
Hello, can everybody explane what the different between the display types? For example, what is different between MONITOR and POWERWALL? When I try to use the Powerwall and I set the type MONITOR it works very good. Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How can I define the screen which show me my viewer?
Hello, I get the number of screens with the following lines: _wsi = _gc-getWindowingSystemInterface(); std::cout Detected Screens: _wsi-getNumScreens() std::endl; My question is: How can I define the screen which show me my viewer? Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Build error in eclipse
Hello, I try to build OSG in eclipse. And I have a error in the readwrite.cpp of the 3ds plugin. In this function: Lib3dsIntw lib3ds_intw_read(FILE *f) { Lib3dsByte b[2]; ASSERT(f); int result = fread(b,2,1,f); if (result==0) return 0; if (s_requiresByteSwap) { osg::swapBytes2((char*)b); } return (*((Lib3dsIntw*)b)); } The error is in the return line. The compiler print out violation of the strict-aliasing-rule (it is a basically translation, the original message is in german). It seems to me,that the unref *(pointer-type) is a problem. What is happens when I unref a array?! Get I the first item? Because b is declared as a array in the first line. Cheers Martin -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] CubeMap-Reflection and ShadowMap don't work togehter?
Hello, short question. I have a Node with a cube map reflection like the osgcubemap example. Now I use the StandardShadowMap. Only the shadow works. Only the cube map works. But when I use it together only the shadow works. Override the shadow settings my cube map settings? But what can I do to fix it in my application without writing a glsl shader? Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgshadow example does not work
hello, i try to run the osgshadow.exe on windows xp and it doesn't work. Have everyone a impression what the mistake is (see the image osgshadow.jpg)? I have a NVIDIA GeForce 9600 and the latest driver. Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] wrong lighting with scaled stl
Hello, when I load a STL-file and I scale this geometry up, it is black and when I scale down it is white. It seems that is a problem with the lighting. Any ideas, what is my mistake? Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] wrong lighting with scaled stl
Hello jp it works fine! Thank you. But when I load a osg-file, I don't have this problem. What is the reason? Cheers Martin Am 08.03.2010 09:23, schrieb J.P. Delport: Hi, your normals are being scaled with the geom. You can put something in the stateset to rescale normals. I think, but check it up, GL_NORMALISE will do, but you can also use GL_RESCALE_NORMALS if you are using same scaling for all axes. If you can't find osg code for this, ping the list again. jp Martin Großer wrote: Hello, when I load a STL-file and I scale this geometry up, it is black and when I scale down it is white. It seems that is a problem with the lighting. Any ideas, what is my mistake? Cheers Martin ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org