Re: [osg-users] [build] How to properly use the OSG_GL3_AVAILABLE CMake option?

2009-11-26 Thread John Price
Hi Robert,

My understanding of the way bindness graphics actually achieves its speedup is 
by not requiring CPU dereferencing of graphic object pointers and the likely L2 
cache misses this causes.

nVidia states:

OpenGL has evolved in a way that allows applications to replace many of the 
original state machine variables with blocks of user-defined data. For example, 
the current vertex state has been augmented by vertex buffer objects, 
fixed-function shading state and parameters have been replaced by 
shaders/programs and constant buffers, etc.. Applications switch between coarse 
sets of state by binding objects to the context or to other container objects 
(e.g. vertex array objects) instead of manipulating state variables of the 
context. In terms of the number of GL commands required to draw an object, this 
enables applications to be an order of magnitude more efficient. However, this 
explosion of objects bound to other objects has led to a new bottleneck - 
pointer chasing and CPU L2 cache misses in the driver, and general L2 cache 
pollution. 

Recent OpenGL graphics applications tend to change state at roughly these 
frequencies:

for  (...) { // cold
data downloads, render target changes, etc.
for (...) { // warm
bind textures
for (...) { // hot
bind constants
bind vertex buffers
Draw();
}
}
}

The most frequent state changes are binding vertex buffer objects (every draw), 
followed closely by binding constant buffers. Vertex buffer and constant buffer 
binds are significantly more expensive than one might expect. These binds 
require several reads from the driver internal object data structure to 
accomplish what the driver actually needs to do. In an OpenGL driver, it looks 
like this:

name-obj (lookup object by name) 
obj-{refcount, GPU address, state, etc.} (dereference object to reference 
count it, to get its GPU virtual address, and validate its state). 

Each of these dereferences has a high probability of causing a CPU L2 cache 
miss due to the inherently LRU-eviction-unfriendly nature of graphics 
applications (each frame starts over at the beginning). These L2 cache misses 
are a huge bottleneck in modern drivers, and a penalty paid for every frame 
rendered.

End nVidia states.

I think these extensions address new bottlenecks created by the switch to gl3 
style vertex and constant buffers, shaders for everything, etc. It seems to be 
a graphic driver bottleneck, not a scenegraph problem. But what nVidia is doing 
is admitting the problem and is trying to provide OpenGL users a way to take 
advantage of an optimization technique.
The OpenGL extensions are GL_NV_shader_buffer_load and 
GL_NV_vertex_buffer_unified_memory.

I am not competent enough with gl3 yet to begin to implement these in code, but 
it seems it may be worth doing that at some point. I like to add quality in 
things I pursue. As I progress, I will keep in touch. For now I am a toddler.

Thank you!

Cheers,
John

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=20462#20462





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] How to properly use the OSG_GL3_AVAILABLE CMake option?

2009-11-25 Thread John Price
Hi Robert and Paul,

Thank you both for your replies. Your answers affirmed my own investigations 
into gl3.

For Paul - my OSG project is being developed for Win32 x64. I have just moved 
it to Windows 7 x64. It is tied to Windows because it is designed to work in 
concert with other Windows commercial apps that will probably never be ported 
to Linux.

My project is still in development and has a long term objective. My view is 
forward looking, so I am interested in embracing gl3 as development progresses. 
I am primarily developing for nVidia hardware, and am particularly interested 
in nVidia extensions to gl3 that they refer to as Bindness Graphics.

nVidia states:
Bindless Graphics refers to changes to OpenGL that can enable close to 
an order of magnitude improvement in the CPU-limitedness of graphics 
applications.

Bindless Graphics has the following desirable properties:
•   The driver need not dereference a vertex buffer or constant buffer on 
the CPU in order for the GPU to use it. 
•   Relieves the limits on how many buffer objects can be accessed at once 
by shaders 
•   Buffer objects are accessed as C-style pointer dereferences in the 
shading language 
•   Allows for dependent pointer fetches, enabling more complex scene graph 
structures to be built into buffer objects providing significant new 
flexibility in the use of shaders. 

Measurements have shown that bindless graphics can result in more than 7x 
speedup!

Unfortunately the nVidia OpenGL SDK which usually provides code examples seems 
to be stuck at this time at the GeForce 8 gl2.1  level. Hopefully this will be 
updated sometime in the future.

As it seems that I am at about the same juncture as everyone else with respect 
to gl3, I don't feel so alone or incompetent as I did when I first began asking 
questions. I plan to take Paul's advice and begin writing gl3 code. If I come 
up with anything useful I will gladly contribute it with a submission.

I have found that the Red Book 7th Edition covers gl3 and gl3.1. I also found 
the book Beginning OpenGL Game Programming 2nd Edition by Luke Benstead has 
been updated to gl3. I have just ordered it, but don't have it yet.


Thank you!

Cheers,
John

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=20392#20392





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] How to properly use the OSG_GL3_AVAILABLE CMake option?

2009-11-24 Thread John Price
Hi Robert,

Thank you again for taking the time to reply. Your assumptions were correct, I 
had not turned off the other GL options.

I am planning to play with gl3 a little, there must be some advantages to using 
it. But it also seems at first glance that one might be giving up some 
optimizations in OSG by not using gl1 and gl2. I am curious if it might be 
useful to create a gl3 compatibility context to take advantage of existing 
optimizations. I have to admit that I have found only bits and pieces of useful 
information on gl3 even though it appears to be at rev. 3.2. My assumptions 
about a compatibility context could be completely off.

If you or Paul Martz have found a source of useful information about gl3 I 
would be very appreciative if you could share it with me and the OSG community. 
In the mean time I will begin the learning curve by doing.


Thank you!

Cheers,
John

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=20282#20282





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [build] How to properly use the OSG_GL3_AVAILABLE CMake option?

2009-11-23 Thread John Price
Hi,

My nVidia graphics driver supports GL 3.2. So I enabled OSG_GL3_AVAILABLE and 
got hundreds of errors about gl3.h. I downloaded gl3.h from OpenGL.org and 
placed it where it would be found, and got hundreds of new errors.

I know I am doing something wrong and was wondering if someone would be kind 
enough to provide a quick tutorial. I don't need complete newbie instructions, 
just the necessary steps to compile OSG with gl3.

Thank you!

Cheers,
John

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=20193#20193





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] createContextImplementation is undefined in GraphicsWindowWin32.cpp

2009-11-22 Thread John Price
Hi Robert,

Thank you for taking the time to reply. Your guess was correct, updating again 
fixed my build.

Cheers,
John

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=20092#20092





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [build] createContextImplementation is undefined in GraphicsWindowWin32.cpp

2009-11-21 Thread John Price
Hi,

Trying to build SVN 10813 update fails because osgViewer won't compile on 
Windows. GraphicsWindowWin32.cpp fails because createContextImplementation is 
undefined.

I have the entire source tree indexed, and doing a full text search finds only 
one reference to createContextImplementation, and that is in 
GraphicsWindowWin32.cpp on line 1198.

Thank you!

Cheers,
John

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=20068#20068





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Opening a GL3 context on MS Windows

2009-11-03 Thread John Price
Hi,

I found the following on the NVIDIA developers site and thought it might be 
what you are looking for.

1) How do I start using OpenGL 3 in my code base?
In order to use OpenGL 3.0 and later versions, an application should opt in 
to use these versions. There is a new context creation call 
CreateContextAttribsARB (for WGL and GLX defined in the 
WGL/GLX_ARB_create_context extensions) that you should use in order to request 
a context that supports OpenGL 3.0, 3.1 or 3.2.

For OpenGL 3.2, and later versions, you additionally will have to indicate what 
profile you want the 3.2 context to support. Either the Core or the 
Compatibility profile.


Thank you!

Cheers,
John

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=19136#19136





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Saving files dosn't save references to images

2009-05-06 Thread John Price

Hi,

I am saving a loaded scene with the following:

bool cOSG::Save(const std::string filename)
{
   return osgDB::writeNodeFile(*mRoot.get(), filename);
}

If I have loaded cow.osg and save it to cow1.osg the two files are 
identical except in the textureUnit section of the saved file cow1.osg the 
reference to:

 file Images/reflect.rgb

is missing. I have done a reasonable amount of research on my own, but can't 
seem to work this one out. When loading cow1.osg everything is good except 
there are no textures. This senario holds true for any file I save in any 
format. Any help would be much welcomed.

Thank you!

Cheers,
John Price

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=11556#11556





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org