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 +0000
> 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

Reply via email to