[osg-users] Linux: Compile nvtt with cuda
Hi, I have trouble to compile nvtt 2.0.8.1 from the code.google.com webpage with cuda support. My system is: Kubuntu 10.04 64 bit I have installed the 280 driver from the NVIDIA homepage. as well as the CUDA 4.0 SDK, the CUDA Tools and the Sample programs. I use GCC 4.4.3 The sample programs compile find, also the program "deviceQuery" finds my cuda grafics hardware correctly. Unfortunately, if I try to compile nvtt, it throws a low of errors in the nvtt part. Can some of the linux users gibe me an advice what could create the error? The message is: Code: [ 65%] Generating CompressKernel.gen.c nvcc warning : option 'host-compilation' has been deprecated and is ignored [ 67%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/nvtt.cpp.o [ 69%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/Compressor.cpp.o [ 71%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/nvtt_wrapper.cpp.o [ 73%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/CompressDXT.cpp.o [ 75%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/CompressRGB.cpp.o [ 76%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/QuickCompressDXT.cpp.o [ 78%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/OptimalCompressDXT.cpp.o [ 80%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/CompressionOptions.cpp.o [ 82%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/InputOptions.cpp.o [ 84%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/OutputOptions.cpp.o [ 86%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/cuda/CudaUtils.cpp.o [ 88%] Building CXX object src/nvtt/CMakeFiles/nvtt.dir/cuda/CudaCompressDXT.cpp.o [ 90%] Building C object src/nvtt/CMakeFiles/nvtt.dir/CompressKernel.gen.c.o In file included from /usr/local/cuda/include/builtin_types.h:61, from /usr/local/cuda/include/crt/host_runtime.h:70, from /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/stddef.h:213: /usr/local/cuda/include/vector_types.h:497: error: expected specifier-qualifier-list before ‘dim3’ /usr/local/cuda/include/cuda_runtime_api.h:134: error: expected identifier or ‘(’ before string constant /usr/local/cuda/include/cuda_runtime_api.h:151: error: expected identifier or ‘(’ before string constant /usr/
Re: [osg-users] osgconv won't downsize my textures and save power of 2 size?
Sorry, I seem to have a tradition of answering to my own questions I inserted this piece of code into the osgconv.cpp CompressTextureVisitor after the line beginning with osg::ref_ptr image = ... This resizes the images to power of 2, up to OSG_MAX_TEXTURE_SIZE on each 2D dimension. Because it only works in conjunction with the --compressed switch, it is not a generic solution and it does not currently deal with 3D textures at all. Might I suggest that a more general approach to this be implemented in osgconv? Christian if (image.valid()) { #define MIN(a,b) ((a)<(b)?(a):(b)) int w = image->s(), h = image->t(), nw, nh; int mts = atoi(getenv("OSG_MAX_TEXTURE_SIZE")); if (mts == 0) { nw = image->computeNearestPowerOfTwo(w); nh = image->computeNearestPowerOfTwo(h); } else { nw = MIN(image->computeNearestPowerOfTwo(w), mts); nh = MIN(image->computeNearestPowerOfTwo(h), mts); } if (w != nw || h != nh) { osg::notify(osg::NOTICE) << "Rescaling image from (" << w << "," << h << ") to (" << nw << "," << nh << ")." << std::endl; image->scaleImage(nw, nh, image->r()); } } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgconv won't downsize my textures and save power of 2 size?
Hi everyone, osgconv seems to be (almost) the holy grail I was looking for: It can simplify models and apply compression to textures. But it does not appear to accept a maximum texture size. On Windows, I am trying the following (where I use a building model made in Google Sketchup) SET OSG_MAX_TEXTURE_SIZE=256 && osgconv --compressed Glyptothek\models\model.dae So it writes a file called "converted.osg" and lots of texture*.dds files. But all of these textures retain their original size instead of being downsized to 256x256 or smaller. Same when writing to binary .ive format. So this means the next time OSG loads the model, it still has to apply scaling (to generate power of 2 textures, or to downscale texture size as required). This needlessly requires CPU and disk space. Isn't there a way to make osgconv save downsized textures in power of 2 sizes? I've looked through the --help options, as well as the DAE (Collada) plugin options without success. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RemoveChild() overwriting application memory
Problem solved! I had buried the reference to my scene class in my console class (which acts as a callback for a node I was destroying)... Long way of saying "whoops", I guess. Anyway, thanks for the help - I certainly learned a good bit nonetheless. Joel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42986#42986 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] "GraphicsWindow has not been created successfully"
AT LAST!!! :-) I managed to solve my problem. Now I have a beautiful textured Earth! I had to: *compile OSG with imageio instead of Quicktime *compile OSG with Cocoa as a windowing system How happy! Le 23 sept. 2011 à 20:44, Robert Osfield a écrit : > Hi Yann, > > On Fri, Sep 23, 2011 at 7:21 PM, Yann Blaudin de Thé wrote: >> Hi Robert, >> >> Actually I don't know :-) Xcode makes the linking job, with the following >> flags I gavehim : "-losg -losgViewer" (etc) >> So I don't think it is linked statically (the binary itself is 2Mo) > > You have to explicitly build the OSG as static build to be able to > link it statically, you enable via CMake. As for XCode I can't > comment as I've only used it a couple of times quite a few years ago > and only use gmake for builds under OSX these days when I'm infront of > the OSX box. > > Robert. > ___ > 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
Re: [osg-users] "GraphicsWindow has not been created successfully"
Hi Yann, On Fri, Sep 23, 2011 at 7:21 PM, Yann Blaudin de Thé wrote: > Hi Robert, > > Actually I don't know :-) Xcode makes the linking job, with the following > flags I gavehim : "-losg -losgViewer" (etc) > So I don't think it is linked statically (the binary itself is 2Mo) You have to explicitly build the OSG as static build to be able to link it statically, you enable via CMake. As for XCode I can't comment as I've only used it a couple of times quite a few years ago and only use gmake for builds under OSX these days when I'm infront of the OSX box. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] "GraphicsWindow has not been created successfully"
Hi Robert, Actually I don't know :-) Xcode makes the linking job, with the following flags I gavehim : "-losg -losgViewer" (etc) So I don't think it is linked statically (the binary itself is 2Mo) Yann Le 22 sept. 2011 à 09:50, Robert Osfield a écrit : > Hi Yann, > > Are you statically linking your application? I can't think of any > other reason for the WindowSystemInterface not to be registered. Even > under static linking it's possible to register it, see the > osgstaticviewer for example of this. > > Robert. > > On Wed, Sep 21, 2011 at 7:26 PM, Yann Blaudin de Thé wrote: >> Hi, >> Hope somebody will be able to help me :s >> I am under Mac OS X 10.7, and I have OSG 3.0.1, that I compiled with g++ >> (and not LLVM) >> I can run osgviewer, and my own program which loads a 3d model. >> But when I want to create a sphere (still my old sphere problem :-) ) OSG >> yields : >> GraphicsWindow has not been created successfully. >> View::setUpViewAcrossAllScreens() : Error, no WindowSystemInterface >> available, cannot create windows. >> Viewer::realize() - failed to set up any windows >> and the programs goes on until it quits (without entering the main loop). >> So why didn't it manage to create the window for a sphere? I really don't >> get it. >> I don't find anything on the internet, and I really don't know where to >> start my investigation... >> Yann >> ___ >> 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
Re: [osg-users] Attach camera manipulator to RTT camera instead of viewer?
Hi Ulrich, I'm trying to find a way to attach a camera manipulator (Trackball) to my RTT camera rather than the main viewer. So far I couldn't find anything similar in the examples. This must be a frequent scenario so obviously I'm missing something. Can this be achieved without writing a custom handler and if so, how? You don't attach a camera manipulator to a camera, but to an osgViewer::View. So the trick is to tell the right camera to respond to user input, and the other(s) not to. camera->setAllowEventFocus(true or false); This may only work with slave cameras, perhaps not with in-scene-graph RTT cameras, I don't know. I've used it with slave cameras, where the RTT camera would respond to input, and the final draw camera (which draws a quad with the texture and shaders) would not. Hope this helps, J-S -- __ Jean-Sébastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Attach camera manipulator to RTT camera instead of viewer?
Hi guys, I'm trying to find a way to attach a camera manipulator (Trackball) to my RTT camera rather than the main viewer. So far I couldn't find anything similar in the examples. This must be a frequent scenario so obviously I'm missing something. Can this be achieved without writing a custom handler and if so, how? Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgexport for blender?
On Fri, 2011-09-23 at 17:36 +0200, Alberto Luaces wrote: > Jeremy Moles writes: > > > Some history: Alberto wrote the first osgexport.py. > > Hi Jeremy, > > just a clarification: I didn't wrote anything :) As far as I know, the > original osgexport.py script belongs to Rubén López. CRAP, you're right. Sorry. It was your thread I was responding to and somehow I transposed that. It WAS Ruben, sorry. :) ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgexport for blender?
Jeremy Moles writes: > Some history: Alberto wrote the first osgexport.py. Hi Jeremy, just a clarification: I didn't wrote anything :) As far as I know, the original osgexport.py script belongs to Rubén López. -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgexport for blender?
On Fri, 2011-09-23 at 16:38 +0200, Alberto Luaces wrote: > "Benjamin Gehmlich" writes: > > > Hi Alberto, > > thanks for your answer, but there is a Problem with blender. > > > > > > When I want to add the osgExport file ("Install Add-On"), there happens > > nothing. > > > > What I have done > > 1.) put the osg folder in blender-2.59/2.59/scripts/addons > > 2.) the osgExport.py in blender-2.59 > > 3.) started Blender -> User Preferences -> Install Add-On > > 4.) then chose osgExport.py > > > > By the other versions I used, after this I saw an entry. > > > > Is there a mistake? > > > > The other versions worked good for normaly exports, but when I chose > > "Armatur" by the mesh as parent it did not export. > > Therefore I used the Modifier Armatur and i could export as osg but the > > mesh was not correct. > > Benjamin, > > I don't fully understand how you are installing the add-on, but you have > to take into consideration that the plugin doesn't only need > osgExport.py, but the `osg' directory as well. Also, start Blender from > the command line in order to check if the script is not found by your > Python installation. The state of the Blender export(s) requires some explanation... Some history: Alberto wrote the first osgexport.py. A few years later, Cedric and myself came along and improved (?) it, in a very general sense. Another year later, Cedric wrote animtk, which eventually became osgAnimation, and added support for that as well into the exporter. Then, along came Blender 2.5. It drastically changed the way data is represented and enumerated in Python internally. Cedric adapted the Mesh exports easily enough, but the Animation exporting remains non-functional. You can find all of this code here (git): https://github.com/cedricpinson/osgexport.git HOWEVER, another exporter has come into light. I'm not sure WHY this individual chose to start over (rather than add to the existing exporter), I do not know. The code base has become quite large however, so perhaps that is the reason. There are also comments in the source to the "main" exporter that he actually did work on it at some point. His code DOES support animation export, but it isn't as robust as the original in other ways. You can find that code here (git): https://code.google.com/p/blender-osgexport-25/ To be completely honest, the state of all of this is a total mess. We now have 2 exporters, each possessing features the other lacks, and neither of which are (anymore) particularly clean or usable code bases. I've talked with Cedric about the future of the "original" exporter, and it certainly hasn't been forgotten, but he is an extremely, EXTREMELY busy person and it may be a while before anything happens. I also tried adapting the code from Wiese's exporter myself, but I can't follow either of the exporters anymore, so no luck there... ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgexport for blender?
"Benjamin Gehmlich" writes: > Hi Alberto, > thanks for your answer, but there is a Problem with blender. > > > When I want to add the osgExport file ("Install Add-On"), there happens > nothing. > > What I have done > 1.) put the osg folder in blender-2.59/2.59/scripts/addons > 2.) the osgExport.py in blender-2.59 > 3.) started Blender -> User Preferences -> Install Add-On > 4.) then chose osgExport.py > > By the other versions I used, after this I saw an entry. > > Is there a mistake? > > The other versions worked good for normaly exports, but when I chose > "Armatur" by the mesh as parent it did not export. > Therefore I used the Modifier Armatur and i could export as osg but the mesh > was not correct. Benjamin, I don't fully understand how you are installing the add-on, but you have to take into consideration that the plugin doesn't only need osgExport.py, but the `osg' directory as well. Also, start Blender from the command line in order to check if the script is not found by your Python installation. -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] RTT and new color_buffer binding per frame.
Hello folks, the main intention is to use an off screen RTT scene setting to generate textures for the main scene asynchronously. The RTT base seems to work, but rebinding the color_buffer at each frame to a new target (image or texture) does not work. (During the development osg::Image instances are bound to the color buffer instead of textures.) The off screen RTT approach seems to work (thank to this forum). Here is the setup: Code: // Init the GraphicsContext Traits osg::ref_ptr traits = new osg::GraphicsContext::Traits; traits->x = 0; traits->y = 0; traits->width = RenderSettings::ETileSize; traits->height = RenderSettings::ETileSize; traits->red = 8; traits->green = 8; traits->blue = 8; traits->alpha = 8; traits->windowDecoration = false; traits->pbuffer = true; traits->doubleBuffer = false; traits->sharedContext = 0; // Create the GraphicsContext osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits); // Create & Setup Camera mViewer= new osgViewer::Viewer; osg::ref_ptr camera = mViewer->getCamera(); camera->setGraphicsContext(gc); camera->setClearColor(osg::Vec4(0.1f, 0.1f, 0.3f, 1.0f)); camera->setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera->setViewport(new osg::Viewport( 0, 0, RenderSettings::ETileSize, RenderSettings::ETileSize)); osg::Camera::RenderTargetImplementation renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; //osg::Camera::RenderTargetImplementation renderImplementation = osg::Camera::PIXEL_BUFFER; camera->setRenderTargetImplementation( renderImplementation ); PrepairScreenshot* prepairScreenshot= new PrepairScreenshot; camera->setUpdateCallback( prepairScreenshot); CaptureScreenshot* captureScreenshot= new CaptureScreenshot(prepairScreenshot); camera->setFinalDrawCallback( captureScreenshot); mViewer->setSceneData( mScene); osg::Geode* g= createAxisModel(); // DEB: test scene //mScene->addChild( g); camera->addChild(g); mViewer->setThreadingModel( osgViewer::Viewer::SingleThreaded); mViewer->realize(); But, I want to change the camera attached color_buffer for each frame -- which is not working. The callbacks: Code: class PrepairScreenshot : public osg::NodeCallback { osg::ref_ptr mImage; public: PrepairScreenshot() : osg::NodeCallback() , mImage() {} osg::Image* getImage() const { return mImage.get(); } virtual void operator () (osg::Node* node, osg::NodeVisitor* nv) override { osg::Camera* cam= dynamic_cast(node); if (cam) { // updateProjection(cam); static float x=-4.0f; cam->setProjectionMatrixAsOrtho2D( x, x + 4, -2, 2); x+= 0.1f; #if 0 mImage = 0; // test new img binding for each frame! // here: only the first img has receives content "tst_1.png", other all gray. #else // here: all frames have valid content "tst_*.png". #endif if (!mImage) { mImage= new osg::Image; mImage->allocateImage( RenderSettings::ETileSize, RenderSettings::ETileSize, 1, GL_RGBA, GL_UNSIGNED_BYTE ); unsigned char* data= (unsigned char*) mImage->getDataPointer(); for (int i=0; i < 100; ++i) { data[i*4+1]= 0xFF; } cam->setRenderingCache( NULL ); cam->detach( osg::Camera::COLOR_BUFFER); //cam->attach( osg::Camera::COLOR_BUFFER, tilePtr.getTileTexture()); cam->attach( osg::Camera::COLOR_BUFFER, mImage.get()); } } traverse( node, nv); } }; class CaptureScreenshot : public osg::Camera::DrawCallback { PrepairScreenshot* mPreparator; public: CaptureScreenshot(PrepairScreenshot* preparator) : osg::Camera::DrawCallback() , mPreparator( preparator) {} virtual void operator () (osg::RenderInfo& renderInfo) const override { osg::Image* image= mPreparator->getImage(); if (image) { static int imgCnt= 0; std::ostringstream buf; buf << "D:\\tst_" << (++imgCnt) << ".png"; osgDB::writeImageFile( *image, buf.str()); } } }; Letting the same osg::Image instance attached all the time works (the image receives the frame results). But attaching a new osg::Image instance for each upcoming frame (in update callback) works only for the initial attached image, all subsequent image instances remain gray (untouched). To test this I write the image content to a new file in each camera->finalDrawCallback. The frames are triggered manually by Code: mViewer->frame(); until the texture update queue is empty. Can you tell me, what is the right way to change the color buffer binding for each new frame? ... Thank you! Cheers, Alexej -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42976#42976 ___ osg-users mailing list osg-users@list
Re: [osg-users] Conversion from 'GLsizeiptrARB' to 'const GLvoid *' of greater size
Hi Jean-Sébastien, Just to let you know that you're not alone to see those Warning, I'm seeing them too under VS 2008 with 32bits build... You can hide them using option : /wd 4312 Kind regards, * * 2010/1/11 Robert Osfield > Hi JS, > > On Mon, Jan 11, 2010 at 2:41 PM, Jean-Sébastien Guay > wrote: > > So would you accept a change that pushes the warning disable state at the > > start of include/osg/State, disables that warning for the file, and pops > the > > warning disable state at the end of the file? (or perhaps only in those > > functions would be less prone to hiding other problems) > > Jikes, no way. Hacks like that stays well out of general OSG headers. > > Disabling warnings in specific .cpp's where there are problems is > acceptable. If that's not possible then placing a global disable in > the CMake build or the include/osg/Export. > > > You've refused such changes in the past, but perhaps for this case it's > the > > only way to go... > > Having yet another example of how crappy compilers can be doesn't > change my opinion on putting hacks into the OSG headers. > > Robert. > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- Alexandre AMALRIC Ingénieur R&D === PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille http://www.pixxim.fr ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgexport for blender?
Hi Alberto, thanks for your answer, but there is a Problem with blender. When I want to add the osgExport file ("Install Add-On"), there happens nothing. What I have done 1.) put the osg folder in blender-2.59/2.59/scripts/addons 2.) the osgExport.py in blender-2.59 3.) started Blender -> User Preferences -> Install Add-On 4.) then chose osgExport.py By the other versions I used, after this I saw an entry. Is there a mistake? The other versions worked good for normaly exports, but when I chose "Armatur" by the mesh as parent it did not export. Therefore I used the Modifier Armatur and i could export as osg but the mesh was not correct. Thank you! Cheers, Benjamin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42973#42973 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Changing DrawBuffer for FBO
Hi, Manu Cant comment on performance gain with pure gl, but you can write small test to see possible gain. Osg dont share fbos with cameras and dont keep track of vbo's binded so most of gain would be from reducing number of glBindFramebuffer...(..) calls and geometry setup (vertex\index\texcoord arrays\pointers). It is possible to create whatever objects you need inside renderImplementation, also you need to info osg::State about all gl state that osg::State keep track of, that you change with opengl calls (look at osg::State::haveApplied...(...) ), or use osg::State functionality instead of opengl calls (look at applyMode(..)/applyAttribute(..)), though not all gl calls can be done through osg::State interface. Instead you can use pure gl and call osg::State::dirtyAll...() afterwards. Dont forget to restore fbo used by osg if you change fbo binding inside drawImplementation(). Also there could be issues with multiple opengl contexts handling if you use multiple screens, so you may need to track current contextID and create\store opengl handles for each contextID used, and pick right handles for current contextID. Also with pure gl approach you can get rid of fbo and drawBuffers switch if you can use NV_texture_barrier extension - you can create texture array with two textures, reading from one layer and writing to another based on uniform value or instanceID if you use instanced drawing for sqreen aligned quads. Cheers,Sergey.23.09.2011, 15:50, "Emmanuel Roche" :Thanks Sergey,Right now I'm using multiple cameras rendered one after another... but I have the feeling the performances are not too good (with 17 pre render cameras...). Do you think I'm right to assume I could really improve the performances by using pure GL code instead and create only one FBO ? as a matter of fact, my second idea would be to encapsulate all this using approximately the code snippet of the previous mail in a special drawable. But i'm wondering if this will not lead to other issues (I'm not that familiar with pure GL code and creating special drawables): is it possible to allocate by FBO and everything I could need from within the renderImplementation of a drawable ? Could somebody predict a big issue doing this ? Cheers,Manu.2011/9/23 Sergey PolischukHi, Manu There are no convenient support for renderbuffer ping-ponging. You can either use pure gl, graph with lots of cameras setup with correct render order and output textures, or osgppu graph with chain of units Cheers,Sergey.22.09.2011, 16:28, "Emmanuel Roche" : Hi everyone,I have a question regarding FBO usage and Draw/Read buffer changes:- I have one pre render camera using FBO and with 2 textures attached (to COLOR_BUFFER0 and COLOR_BUFFER1) - Under that camera I would like to add multiple screen aligned quads that would use the attached textures this way: (call them tex0 and tex1): - quad0 would using the tex0 as input and draw on tex1 - quad1 would then use tex1 as input and draw on tex0 - quad2 would using the tex0 as input and draw on tex1 - quad3 would then use tex1 as input and draw on tex0 - etc.This is possible in pure OpenGL using something like that: glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fftFbo2); glUseProgram(fftx->program); glUniform1i(glGetUniformLocation(fftx->program, "nLayers"), choppy ? 5 : 3); for (int i = 0; i < PASSES; ++i) { glUniform1f(glGetUniformLocation(fftx->program, "pass"), float(i + 0.5) / PASSES); if (i%2 == 0) { glUniform1i(glGetUniformLocation(fftx->program, "imgSampler"), FFT_A_UNIT); glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); } else { glUniform1i(glGetUniformLocation(fftx->program, "imgSampler"), FFT_B_UNIT); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); } drawQuad(); } glUseProgram(ffty->program); glUniform1i(glGetUniformLocation(ffty->program, "nLayers"), choppy ? 5 : 3); for (int i = PASSES; i < 2 * PASSES; ++i) { glUniform1f(glGetUniformLocation(ffty->program, "pass"), float(i - PASSES + 0.5) / PASSES); if (i%2 == 0) { glUniform1i(glGetUniformLocation(ffty->program, "imgSampler"), FFT_A_UNIT); glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); } else { glUniform1i(glGetUniformLocation(ffty->program, "imgSampler"), FFT_B_UNIT); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); } drawQuad(); } glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);.. but I can't figure out how to do something equivalent to the internal calls to glDrawBuffer in the previous snippet when I have a single camera. (as calling setDrawBuffer() is done once and for all before rendering anything... Any idea what could be worth trying here ? Cheers,Manu.___osg-users mailing listosg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org_
Re: [osg-users] RemoveChild() overwriting application memory
Hi Joel, The code that you suggest is erroneous looks fine, while your code with release() looks dubious. The ref_ptr<>::release() decrements the reference count without deleting the object, it's a special case that should only be used when passing back a C pointer from a function that creates the object, locally ref_ptr<> it but wishes to pass back a plain C pointer. For some reason I can determine you seem to be having far more problems with than users normally have. I don't have your full code or and understanding of exactly what is going on with you understanding of how things are meant to work to know what you are missing. The problems you are seeing are almost certainly down to how you are doing things. The best I can do is suggest you go back and read the documentation on ref_ptr<> & tutorials. Robert. On Fri, Sep 23, 2011 at 12:16 PM, Joel Graff wrote: > Robert, > > This turns out to be more complicated than I anticipated. You were right - > at least partly.. I think. I did some research on ref_ptr's (consulted OSG > 3.0 Beginner's Guide and a few (conflicting) online tutorials) a few days > ago. Fixed a few consistency issues, but didn't catch this problem... > > Anyway, part of the problem appears to lie in the fact that I had several > osg::ref_ptr var members to my Scene class which pointed to nodes in the > scene graph. > > My erroneous code: > > > Code: > > _activeNode=NULL; > _SceneRoot=NULL; > _projectNode=NULL; > _projectRoot=NULL; > > _root->removeChild( 0U ); > _root->addChild( model ); > > > > > The (apparently) correct code: > > > Code: > > _root->removeChild( _projectRoot ); > > _activeNode.release(); > _SceneRoot.release(); > _projectNode.release(); > _projectRoot.release(); > > _root->addChild( model ); > > > > > What leaves me scratching my head a bit is the fact that I should have had to > release the pointers at all - these are, after all, smart pointers, and I > reassign them in the following lines to newly-added nodes. > > Anyway, the error actually appears to have been two-fold: 1. Assigning NULL > to my pointers and 2. calling removeChild (0U) rather than passing in the > node to remove. In the latter error, I opted for specifying the index > assuming that since there's only one child to _root, it would have the first > position... > > The other odd thing I noticed is sometimes, on return from this call, my > Scene pointer wouldn't always be destroyed... Referencing this post: > > http://forum.openscenegraph.org/viewtopic.php?t=8997&highlight= > > could it be this is conflicting with the draw thread? At present, the > solution above appears to work consistently (and the erroneous code failed to > work consistently), but I'm nevertheless a bit worried... (edit:) Now that I > think of it, maybe explicitly releasing the pointers is sparing me the > problem described in the above thread? > > Finally, I seem to have encountered a problem with the viewer using this > methodology. That is, while my viewer's scene data is set to _root (which is > never destroyed), after loading a saved file, I get a debug error that tells > me "vector iterator is not incrementable". Obviously related to the > removeChild() / addChild() calls... > > Thanks! > > Joel > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=42966#42966 > > > > > > ___ > 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
Re: [osg-users] [osgCompute] Experiences with osgCompute
Hi Maik, Thank you for answers. I supplied a short example program as you requested. The program displays a triangle (osgCuda::Geometry) and the GPU increments its positions with a positive value, so it's moving to the top-right. Secondly, there is a dummy array (osgCuda::Memory) and the GPU increments its elements with a certain value and prints this to the standard output every frame. You can download a zip at Code: #include #include #include #include #include #include #include #include "TestModule.h" using namespace osg; using namespace std; //main int main() { //Setup viewer osgViewer::Viewer viewer; viewer.setCameraManipulator(new osgGA::TrackballManipulator()); viewer.getCameraManipulator()->setHomePosition(Vec3(0.5f, 0.5f, 3.0f), //Eye position Vec3(0.5f, 0.5f, 0.0f), //Coordinate looking at Vec3(0.0f, 1.0f, 0.0f)); //Positive y is up-vector viewer.getCamera()->setClearColor(Vec4f(0.0f, 0.0f, 1.0f, 1.0f)); //Blue background viewer.home(); viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); //osgCompute does not support multi-threading viewer.setUpViewInWindow(200, 200, 800, 600, 0); //Setup triangle ref_ptr const geoHost = new Geometry(); geoHost->setDataVariance(Object::DYNAMIC); //We update the vertices geoHost->setUseVertexBufferObjects(true); //Setup vertex positions of triangle int numVertices = 3; ref_ptr vertices = new Vec2Array(); vertices->reserve(numVertices); vertices->push_back(Vec2f(0.0f, 0.0f)); vertices->push_back(Vec2f(1.0f, 0.0f)); vertices->push_back(Vec2f(1.0f, 1.0f)); geoHost->setVertexArray(vertices); vertices->getVertexBufferObject()->setUsage(GL_STREAM_DRAW); //Setup elements of triangle ref_ptr elements = new DrawElementsUInt(PrimitiveSet::TRIANGLES); elements->reserve(3); elements->push_back(0); elements->push_back(1); elements->push_back(2); geoHost->addPrimitiveSet(elements); elements->getElementBufferObject()->setUsage(GL_STATIC_DRAW); //Dummy Vec3 array (just for demonstrating purposes) ref_ptr dummy = new Vec3Array(); int numDummies = 10; dummy->reserve(numDummies); for (int i = 0; i < numDummies; ++i) dummy->push_back(Vec3f(8.0f, 9.0f, 10.0f)); //Place geometry in osgCuda::Geometry osgCuda::Geometry* geoDev = new osgCuda::Geometry; geoDev->setVertexArray(geoHost->getVertexArray()); geoDev->addPrimitiveSet(geoHost->getPrimitiveSet(0)); geoDev->setStateSet(geoHost->getOrCreateStateSet()); geoDev->addIdentifier("triangle"); //Setup test module TestModule* tm = new TestModule(numVertices, dummy); //Setup computation osgCuda::Computation* computation = new osgCuda::Computation(); computation->addModule(*tm); computation->addResource(*geoDev->getMemory()); //Setup scene graph ref_ptr const root = new Group(); ref_ptr const geode = new Geode(); geode->addDrawable(geoDev); computation->addChild(geode); root->addChild(computation); //Set scene data viewer.setSceneData(root); //Draw loop while (!viewer.done()) { viewer.frame(); } return 0; } Code: #ifndef TEST_MODULE_H #define TEST_MODULE_H #include #include #include #include class TestModule : public osgCompute::Module { private: //Vertex data of triangle int numVertices; osg::ref_ptr hostPositions; osg::ref_ptr devPositions; //Data of dummy int numDummies; osg::ref_ptr hostDummy; osg::ref_ptr devDummy; public: //Constructors TestModule() : osgCompute::Module() {} TestModule(int numVertices, osg::ref_ptr dummy); //OSG macros META_Object( , TestModule) //Called once by osgCompute and should be used to create and initialize all resources bool init(); //Used for getting a resource that is located somewhere else in the scene graph void acceptResource(osgCompute::Resource& resource); //Called each frame by osgCompute and should contain calls to CUDA kernel(s) void launch(); protected: //Destructor ~TestModule() { osgCompute::Module::clear(); } private: //Copy TestModule(const TestModule&, const osg::CopyOp& ) {} //Assignment inline TestModule &operator=(const TestModule &) { return *this; } }; #endif Code: #include #include #include #include "TestModule.h" using namespace osg; extern "C" void incrementPositions(float2* positions, int numVertices); extern "C" void incrementDummy(float3* dummy, int numDummies); TestModule::TestModule(int numVertices, osg::ref_ptr dummy) : osgCompute::Module() { this->numVertices = numVertices; //Store dummy, because we again have to use it in ini
[osg-users] Texture2DMultisample usage example
Hello, I'm experimenting a bit with multisampled RenderTargets and need some advice with Texture2DMultisample. As far as I understood this, it can be used like usual textures (i.e. binding it to a COLOR_BUFFER for a MRT setup) with a specific sampler inside the shader. Unfortunally I get an error when using it along side with setTextureAttributeAndModes: osg::Texture2DMultisample* DiffuseMap = new osg::Texture2DMultisample(4, GL_FALSE); DiffuseMap ->setTextureSize(width,height); DiffuseMap ->setInternalFormat(GL_RGBA); DiffuseMap ->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE); DiffuseMap ->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE); DiffuseMap ->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST); DiffuseMap ->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST); osg::Uniform* uniformTex01 = new osg::Uniform("sampler_diffuse",0); osg::StateSet* ss = new osg::StateSet(); ss->setTextureAttributeAndModes(0,DiffuseMap,osg::StateAttribute::ON); If I understood this correctly this can be used inside a shader to do the following: uniform sampler2DMS sampler_diffuse; in vec2 texcoord; int samples = 4; for (int i = 0; i < samples; i++) { // AA renderbuffers are addressed with integers vec3 diffuse = texelFetch(sampler_diffuse, texcoord2, i).rgb; result += vec4(diffuse,1.0); } The error I've got came from inside the StateSet::setTextureMode where a static set of valid texture modes is queried: This TextureGLModeSet doesn't contain the entries for the GL_TEXTURE_2D_MULTISAMPLE. Is this an error, or am I using the texture in a wrong way? cheers Sebastian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Changing DrawBuffer for FBO
Thanks Sergey, Right now I'm using multiple cameras rendered one after another... but I have the feeling the performances are not too good (with 17 pre render cameras...). Do you think I'm right to assume I could really improve the performances by using pure GL code instead and create only one FBO ? as a matter of fact, my second idea would be to encapsulate all this using approximately the code snippet of the previous mail in a special drawable. But i'm wondering if this will not lead to other issues (I'm not that familiar with pure GL code and creating special drawables): is it possible to allocate by FBO and everything I could need from within the renderImplementation of a drawable ? Could somebody predict a big issue doing this ? Cheers, Manu. 2011/9/23 Sergey Polischuk > Hi, Manu > > There are no convenient support for renderbuffer ping-ponging. You can > either use pure gl, graph with lots of cameras setup with correct render > order and output textures, or osgppu graph with chain of units > > Cheers, > Sergey. > 22.09.2011, 16:28, "Emmanuel Roche" : > > Hi everyone, > > I have a question regarding FBO usage and Draw/Read buffer changes: > > - I have one pre render camera using FBO and with 2 textures attached (to > COLOR_BUFFER0 and COLOR_BUFFER1) > - Under that camera I would like to add multiple screen aligned quads that > would use the attached textures this way: (call them tex0 and tex1): > - quad0 would using the tex0 as input and draw on tex1 > - quad1 would then use tex1 as input and draw on tex0 > - quad2 would using the tex0 as input and draw on tex1 > - quad3 would then use tex1 as input and draw on tex0 > - etc. > > This is possible in pure OpenGL using something like that: > >* glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fftFbo2); > glUseProgram(fftx->program); > glUniform1i(glGetUniformLocation(fftx->program, "nLayers"), choppy ? 5 > : 3); > for (int i = 0; i < PASSES; ++i) { > glUniform1f(glGetUniformLocation(fftx->program, "pass"), float(i + > 0.5) / PASSES); > if (i%2 == 0) { > glUniform1i(glGetUniformLocation(fftx->program, "imgSampler"), > FFT_A_UNIT); > glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); > } else { > glUniform1i(glGetUniformLocation(fftx->program, "imgSampler"), > FFT_B_UNIT); > glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); > } > drawQuad(); > } > glUseProgram(ffty->program); > glUniform1i(glGetUniformLocation(ffty->program, "nLayers"), choppy ? 5 > : 3); > for (int i = PASSES; i < 2 * PASSES; ++i) { > glUniform1f(glGetUniformLocation(ffty->program, "pass"), float(i - > PASSES + 0.5) / PASSES); > if (i%2 == 0) { > glUniform1i(glGetUniformLocation(ffty->program, "imgSampler"), > FFT_A_UNIT); > glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); > } else { > glUniform1i(glGetUniformLocation(ffty->program, "imgSampler"), > FFT_B_UNIT); > glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); > } > drawQuad(); > } > > glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);* > > .. but I can't figure out how to do something equivalent to the internal > calls to glDrawBuffer in the previous snippet when I have a single camera. > (as calling setDrawBuffer() is done once and for all before rendering > anything... Any idea what could be worth trying here ? > > Cheers, > Manu. > > ___ > 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
Re: [osg-users] osgPPU swig wrapped and viewport issues
Hi, I'am experiencing some issues with osgPPU, (some might have been addressed before on the list): * I use an ON_DEMAND scheme and osgPPU always has a one frame lag. (i am using a simple setup similar to examples like osgppu_viewer) * My Camera had some hud camera childs doing a POST_RENDER, these huds are no longer visible. and the previously mentioned issues * auto compute near far breaks my manipulators * viewports need a 0,0 origin I am using osgPPU to add camera effects like bloom and vignetting, the results are nice and the performance is good, now i need to resolve these issues to finalize the implementation. Any ideas if i can resolve this in my application, or are these issues to be solved in osgPPU or osg? Grtz, René Op 22 augustus 2011 15:42 schreef René Molenaar het volgende: > Hi, > > I recently started some experimenting with osgPPU. > The first results are very nice and promising!! (osgppu rocks ;-)) > > I added osgswig wrappers to the osgswig project to do some testing, and i > experienced a few glitches. > > 1. there were some manipulation glitches, these were caused by our camera > setting COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES on. Turning this off > resolved the issue. > > 2. i had some resize problems, after searching on the forum. I found a > solution, by adding some additional explicit resize calls ( for example in > an event handler ): > > osgPPU::Camera::resizeViewport(0,0, ea.getWindowWidth(), > ea.getWindowHeight(), viewer->getCamera()); > viewer->getProcessor()->onViewportChange(); > > this does work when the x and y of the viewport are 0, 0 but i see wrong > results if x and y are increased ( purple bars appear ). > > 3. an additional frame() call was needed after the scene is loaded and > before the postprocessor is attached, otherwise i would see only a black > screen. > > Grtz, > > René > > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgexport for blender?
"Benjamin Gehmlich" writes: > Hi all, > > I want to export characters with the osgExport-Plugin for Blender 2.59. > > I used the nathan file (character.blend) and boxman.blend (found them in the > web), but the versions "osgexport_no_mercurial_20100530_r7tar_563" and > "osgexport_no_mercurial_20100527_r6tar_199" does not work. > > Can anyone help me please? > > Thank you! Benjamin, try https://github.com/cedricpinson/osgexport . -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RemoveChild() overwriting application memory
Robert, This turns out to be more complicated than I anticipated. You were right - at least partly.. I think. I did some research on ref_ptr's (consulted OSG 3.0 Beginner's Guide and a few (conflicting) online tutorials) a few days ago. Fixed a few consistency issues, but didn't catch this problem... Anyway, part of the problem appears to lie in the fact that I had several osg::ref_ptr var members to my Scene class which pointed to nodes in the scene graph. My erroneous code: Code: _activeNode=NULL; _SceneRoot=NULL; _projectNode=NULL; _projectRoot=NULL; _root->removeChild( 0U ); _root->addChild( model ); The (apparently) correct code: Code: _root->removeChild( _projectRoot ); _activeNode.release(); _SceneRoot.release(); _projectNode.release(); _projectRoot.release(); _root->addChild( model ); What leaves me scratching my head a bit is the fact that I should have had to release the pointers at all - these are, after all, smart pointers, and I reassign them in the following lines to newly-added nodes. Anyway, the error actually appears to have been two-fold: 1. Assigning NULL to my pointers and 2. calling removeChild (0U) rather than passing in the node to remove. In the latter error, I opted for specifying the index assuming that since there's only one child to _root, it would have the first position... The other odd thing I noticed is sometimes, on return from this call, my Scene pointer wouldn't always be destroyed... Referencing this post: http://forum.openscenegraph.org/viewtopic.php?t=8997&highlight= could it be this is conflicting with the draw thread? At present, the solution above appears to work consistently (and the erroneous code failed to work consistently), but I'm nevertheless a bit worried... (edit:) Now that I think of it, maybe explicitly releasing the pointers is sparing me the problem described in the above thread? Finally, I seem to have encountered a problem with the viewer using this methodology. That is, while my viewer's scene data is set to _root (which is never destroyed), after loading a saved file, I get a debug error that tells me "vector iterator is not incrementable". Obviously related to the removeChild() / addChild() calls... Thanks! Joel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42966#42966 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgexport for blender?
Hi all, I want to export characters with the osgExport-Plugin for Blender 2.59. I used the nathan file (character.blend) and boxman.blend (found them in the web), but the versions "osgexport_no_mercurial_20100530_r7tar_563" and "osgexport_no_mercurial_20100527_r6tar_199" does not work. Can anyone help me please? Thank you! Cheers, Benjamin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42965#42965 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] "hide" objects from manipulators
Thanks for your help ! To be more specific, when my dragger is hidden by another geometry, the camera manipulator get the event. Any idea about this ? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42963#42963 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Shadowing + Multitexture
Thanks for the speedy reply Sebastian, I mainly needed to know whether I was missing something simple or not as i don't really have time to learn enough to get stuck in to writing shaders. Hopefully I can return to the problem at some point Much appreciated, Ally -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42962#42962 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Texture two faces of a triangle independently
Hi, James You can write shader which will use texture depending on triangle facing, there are bool gl_FrontFacing variable accessible in fragment shader (or you can check viewspace normal z sign). 22.09.2011, 20:31, "James Klink" : > Hi, > > Thanks for the quick reply. I didn't want to have to create two triangles, > but I guess I'll have to bite the bullet and do it. I was also afraid of > z-fighting, but I didn't know that cull faces would take care of it. > > Thanks again > James. > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=42945#42945 > > ___ > 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
Re: [osg-users] "hide" objects from manipulators
Hi, After looking at sources, it looks like only possible cause of malfunction - event didnt get to your handler or already handled by that time. It should be not important if dragger visible or hidden by other geometry. Event should be handled by first dragger intersected by the ray. Can't help you much there. 23.09.2011, 13:03, "Aurelien Albert" : > Hi, > > I already use 2 subgraphs, like his : > > Root > | > | Manipulators > | > | Objects > > But how can I tell to the TranslateAxisManipulator to visit only the > "Manipulators" subgraph ? > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=42960#42960 > > ___ > 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
Re: [osg-users] "hide" objects from manipulators
Hi, I already use 2 subgraphs, like his : Root | | Manipulators | | Objects But how can I tell to the TranslateAxisManipulator to visit only the "Manipulators" subgraph ? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42960#42960 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] "hide" objects from manipulators
Hi, You can use node masks so intersector visitor would check intersection only on nodes you want, or keep separate graph for intersections search 22.09.2011, 20:19, "Aurelien Albert" : > Hi, > > I'm working on an OSG based application, with user interaction > (TranslateAxisDragger, RotateAxisDragger...) > > My scene is rendered as follow : > > - Depth and color buffer clear > - Objects are rendered > - Depth buffer clear > - Manipulators are rendered > > So manipulators are always drawn in front of objects. > > My problem is : > - an object is dranw > - associated manipulator is drawn in front of it, but all its geometry is > included in object geometry > > => user can't pick and use manipulators because the object's geometry "block" > the mouse event. So the mouse event is transfered to camera manipulator. > > How can I "hide" all objects from picking (not on render) except the > manipulators so they are always drawn in front AND always usable ? > > Don't sure if my question is really clear and sorry for my bad english ! > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=42944#42944 > > ___ > 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
Re: [osg-users] Changing DrawBuffer for FBO
Hi, Manu There are no convenient support for renderbuffer ping-ponging. You can either use pure gl, graph with lots of cameras setup with correct render order and output textures, or osgppu graph with chain of units Cheers,Sergey.22.09.2011, 16:28, "Emmanuel Roche" :Hi everyone,I have a question regarding FBO usage and Draw/Read buffer changes:- I have one pre render camera using FBO and with 2 textures attached (to COLOR_BUFFER0 and COLOR_BUFFER1)- Under that camera I would like to add multiple screen aligned quads that would use the attached textures this way: (call them tex0 and tex1): - quad0 would using the tex0 as input and draw on tex1 - quad1 would then use tex1 as input and draw on tex0 - quad2 would using the tex0 as input and draw on tex1 - quad3 would then use tex1 as input and draw on tex0 - etc.This is possible in pure OpenGL using something like that: glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fftFbo2); glUseProgram(fftx->program); glUniform1i(glGetUniformLocation(fftx->program, "nLayers"), choppy ? 5 : 3); for (int i = 0; i < PASSES; ++i) { glUniform1f(glGetUniformLocation(fftx->program, "pass"), float(i + 0.5) / PASSES); if (i%2 == 0) { glUniform1i(glGetUniformLocation(fftx->program, "imgSampler"), FFT_A_UNIT); glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); } else { glUniform1i(glGetUniformLocation(fftx->program, "imgSampler"), FFT_B_UNIT); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); } drawQuad(); } glUseProgram(ffty->program); glUniform1i(glGetUniformLocation(ffty->program, "nLayers"), choppy ? 5 : 3); for (int i = PASSES; i < 2 * PASSES; ++i) { glUniform1f(glGetUniformLocation(ffty->program, "pass"), float(i - PASSES + 0.5) / PASSES); if (i%2 == 0) { glUniform1i(glGetUniformLocation(ffty->program, "imgSampler"), FFT_A_UNIT); glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); } else { glUniform1i(glGetUniformLocation(ffty->program, "imgSampler"), FFT_B_UNIT); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); } drawQuad(); } glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);.. but I can't figure out how to do something equivalent to the internal calls to glDrawBuffer in the previous snippet when I have a single camera. (as calling setDrawBuffer() is done once and for all before rendering anything... Any idea what could be worth trying here ? Cheers,Manu.___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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
Re: [osg-users] RTT multipass on same geometry
Hi, Sebastian You can setup blend func in a way that will keep old rgb values and replace alpha with new value. for second pass -> BlendFunc(osg::BlendFunc::ZERO, osg::BlendFunc::ONE, osg::BlendFunc::ONE, osg::BlendFunc::ZERO). However if you reading from same texture attached to camera output this is not gonna work, unless you use NV_texture_barrier extension (and it have limitations too). Cheers 22.09.2011, 11:46, "Sebastian Messerschmidt" : > Thanks to all replies but I was able to figure it out. > > My initial idea was to modify a color attachment created in the first > pass in the second pass only where fragments were created(i.e. depth was > written) > I came up with the following solution: > > 1. Pass > RTT-Cam1 > - DEPTH, COLOR1, COLOR2, ... > - renders the scene > 2. Pass > RTT-Cam2 > - DEPTH, COLOR1 (same attachments as in the first pass > - depth test to GREATER > - depth writes off > - disable color and depth clearing (which we want to reuse) > - bind the COLOR1-texture as uniform input > - render a full screen quad with camera in ABSOLUTE_RF and same > viewport as first pass > - in the frag shader for instance do: gl_FragData[0]= > vec4(texture2D(firstPassTexture,gl_TexCoord[0].st).rgb, 0.0) + > vec4(0.0,0.0,0.0, myNewTerm); > > This works, because the fullscreen quad rendered will pass depth test > only if something was written there in the first pass. Using this sceme > saves us a stencil test. > > There is a remaining question however: > What I really wanted to do is to write the gl_FragData[0].rgb in the > first and gl_FragData[0].a in the second pass. > This gave me a blank result (with the alpha component set to 1) > Do I have to enable blending or something? Or is it illegal to write > uncomplete FragData? > >> Hello, >> >> I've have a question regarding RenderToTexture in a multipass setup. >> I have to RTT cameras, the first one has DEPTH and 3 color >> attachments, while the second has only one color attachment. >> I need to use the data from the first RTT-pass in the second camera, >> so the renderorder is set accordingly. >> >> Basically my scene is organized like this: >> >> root >> | >> RTTCamera_1 >> | |Model >> RTTCamera_2 >> | |Model >> >> Booth cameras use the same geometry, viewport, transform. Yet the >> Model graph is culled twice. >> Is there any way to prevent the second cull traversal? I.e. reuse the >> batch collected in the first culling? >> >> cheers >> Sebastian >> ___ >> 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
Re: [osg-users] Current time when displaying an image stream
Hi Brad, You are the first to request such a feature as far as I'm aware. So if the get current time isn't their it's because no one has needed thus far, so no one has added it. Feel free to dive in and add the feature to the ImageStream interface and the associated subclasses of it. Cheers, Robert. On Fri, Sep 23, 2011 at 6:37 AM, Christiansen, Brad wrote: > Hi, > > > > I am creating a basic video player using the ImageStream class. I have > created a standard 'position' slider to seek within the stream. Seeking is > working with no problems but I cant see any way of reliabily updating the > position of the slider as the stream is played. > > > > As well as the seek() and length() function I was hoping to find a > 'curentTime' like function, basically the 'getter' for 'seek'. Without this > function it looks like I will have to assume that length and seek are both > in seconds and then calculate my own 'currentTime' based on elapsed time > since play was called. This seems overly complex and somewhat unreliable as > it also assumes that the stream is playing with exactly the correct timing. > > > > Has anyone solved this? Have I missed something? > > > > Cheers, > > Brad > > - > DISCLAIMER: This e-mail transmission and any documents, files and previous > e-mail messages attached to it are private and confidential. They may > contain proprietary or copyright material or information that is subject to > legal professional privilege. They are for the use of the intended recipient > only. Any unauthorised viewing, use, disclosure, copying, alteration, > storage or distribution of, or reliance on, this message is strictly > prohibited. No part may be reproduced, adapted or transmitted without the > written permission of the owner. If you have received this transmission in > error, or are not an authorised recipient, please immediately notify the > sender by return email, delete this message and all copies from your e-mail > system, and destroy any printed copies. Receipt by anyone other than the > intended recipient should not be deemed a waiver of any privilege or > protection. Thales Australia does not warrant or represent that this e-mail > or any documents, files and previous e-mail messages attached are error or > virus free. > - > ___ > 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
Re: [osg-users] RemoveChild() overwriting application memory
Hi Joel, On Thu, Sep 22, 2011 at 10:15 PM, Joel Graff wrote: > My Scene class manages the scene graph almost entirely (sans custom > nodevisitors and callbacks). It isn't derived from any osg classes and I > can't really think of any reason why it should be... The class itself has no > active role in the scene graph, it merely acts as a container for the scene > graph and whatever functions I need to manipulate the scene graph. > > However, on a wild hunch, I tried inheriting osg::Referenced into Scene (then > making all references to my Scene object osg::ref_ptr) but to no > avail (note that "sg" is the namespace I use for my application). It's pointers to the OSG objects that you'll need to use ref_ptr<> for, not your own class unless is owned by a scene graph objects in some way - such as via UserData. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Please remove me from list
You can do that yourself, using the mailing list link below. /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Shadowing + Multitexture
Hello Alastair, If you parse the forum/mailing list for shadow and multitexturing or other terms you will find a heap of information about this. In general you'll have to write your own custum shader in order to use shadow with more than one texture /3d-texture and so on. The stock shadow-shader is only sampling one base texture and performs simple lighting. In my projects I've abstracted the shadow to a separate function in the vertex and fragment shaders (usually call float shadowTerm()) which is then later called for fragment color determination (e.g. gl_FragColor = ambient + shadowTerm *diffuse) hth Sebastian Hello, Can anyone tell me if it's possible to get any of the shadow map techniques to work with an object using texture3D? I can only get the shadow texture technique work, shadow map just seems to overwrite the texture on the objects. Do I need to put the shadows in a different texture unit or something? Any help much appreciated!, Many thanks, Ally -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42933#42933 ___ 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