Okay, DrawArrays also uses the slow path. I was under the impression that
only DrawArrayLengths were. The only hint I had of this before digging
through the source was a posting here that said not to use
DrawArrayLengths.
Maybe a warning should be put in the doxygen file for those primitives?
-K
On Tue, 30 Nov 2010, Keith Parkins wrote:
A follow-up:
I used an opengl tracer and found that in my app there are calls to
glBegin and glEnd while in the osgviewer dump there aren't any. I am using
the same models in both. glNormal3fv has 6 calls in osgviewer, yet mine
has 426974. Any ideas on how that happened? I am not knowingly using
DrawArrayLengths, but I DID use some DrawArrays (w/o indices).
---------- Forwarded message ----------
Date: Tue, 30 Nov 2010 14:43:20 -0500 (Eastern Standard Time)
From: Keith Parkins <[email protected]>
To: OpenSceneGraph Users <[email protected]>
Subject: FBO problem?
Hi,
I'm working on a driving simulator. I have been having problems meeting my
frame rate requirements. I spent a lot of time tuning the scene, making
sure that I wasn't using DrawArrayLengths, using instances of geometry,
instances of blocks of buildings as a tile (5 blocks get repeated over 25
possible locations), and flattening static tranforms. In the end, I was
still hitting massive cull times and massive draw(GPU) times. I wrote some
portal culling type algorithm for culling blocks depending on where in the
grid the camera is and I am still getting ~26Hz over large areas of the
town. I finally dumped the scene out to a file and loaded that with
osgviewer. I got 60Hz without a sweat; vsync is locked and there is no
custom culling. The bug must be in the rendering, not the scene itself.
My main viewer has a couple of cameras hanging off of it as a switch node
depending on what screen I'm in. The main view gets added like this:
getSceneData()->asGroup()->addChild(_town_view.get());
_town_view is derived from a osg::Camera and points to a screen with a
texture attached to an FBO. We are projecting the screen onto a curved
surface, so this is done for the geometry correction phase. The screen
mesh is static.
The RTT camera is initialized like this:
_camera->setClearColor(osg::Vec4(0.0,0.0,0.0,1.0));
_camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
_camera->setViewport(0, 0, (int)TEX_W, (int)TEX_H);
_camera->setRenderOrder(osg::Camera::PRE_RENDER);
_camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
_camera->setViewMatrixAsLookAt(_pos + _head_pos + _eye_pos,
_pos + _head_pos + _eye_pos + rotate * _dir, _up);
_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
_view_root->addChild(_camera.get());
_camera->addChild(_scene_root.get());
_scene_root is the scene that I wrote out and tested. I am using bullet to
control the car physics, but right now I only have it registering a plane
where the road is. In other words it's just moving the camera and doing
isects with the plane, very simple.
I've stripped out all extraneous code, including physics, and just have
town loading and am still having the same problem.
the scene:
class myviewer: osg::Viewer
sceneData -> class townview : osg::Camera(NESTED_RENDER)
townview->child - geode screen w/ RTT texture
townview->child - RTT _camera(PRE_RENDER)
_camera-> _scene_root
using osgviewer:
Camera 0
Bins 2
Materials 2265
Drawables 2265
Vertices 59835
View 0
Stateset 706 5080
Group 480 2127
Transform 213 459
Geode 757 4616
Drawable 827 5040
Geometry 827 5040
Vertices 35574 1000261
Prims 21287 60407
Framerate: 60Hz
my app:
Camera 0
Bins 3
Materials 1939
Drawables 1939
Vertices 51436
View 0
Stateset 608 1982
Group 75 273
Transform 192 227
Geode 237 1032
Drawable 825 1965
Geometry 825 1965
Vertices 35374 51799
Prims 20490 29791
Framerate: 20Hz
I've walked through the culling section of the code, added cull callbacks
to nodes, and the only thing I can verify is that it just takes forever
culling each block in my app. My app marks which blocks are visible during
an update traversal and only does so when the camera switches to another
grid co-ordinate. My app should be visiting less nodes (verified in
callbacks and View output above) and yet it is getting nailed. You can see
that I flatten Transforms above. What is happening???? I'm at my wits end
on this. I thought that I was visiting nodes more than once on the culling
traversal, but my node callbacks don't show that; they just confirm that
the majority of the time spent culling is in each block.
I've attached two images of the stats screen. The myapp image is using the
default lighting like osgviewer which is why you can't see the skymap in
it.
Please help!
-K
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org