Commit Graph

119 Commits

Author SHA1 Message Date
Robert Osfield
6496e35421 Moved GraphicsCostEstimator ref pointer into osg::State 2011-02-03 12:42:23 +00:00
Robert Osfield
652c274d09 From Chris Hanson, "As an extension to this excellent work:
http://forum.openscenegraph.org/viewtopic.php?t=7285

 This file adds the same string API wrapper to the State object for other older apps that
track Uniforms by string. The original comment about performance is preserved."
2011-01-11 17:18:44 +00:00
Robert Osfield
65aee287e7 From Mathias Froehlich, "Attached are most of the fixes that are required to build osg on solaris and
hpux. I have skipped irix this time as irix is too dead to keep osg building
there.

As usual, solaris does not like member templates in stl containers.
Some headers missing and link problems due to missing libraries."
2010-12-02 14:13:54 +00:00
Robert Osfield
cdfbb7a753 From Michael Platings, To address performance bottleneck that occurs when using large number of uniforms introduced a name to uniqued ID scheme for Uniforms so comparisons can be done on a uint rather than a string. 2010-11-25 12:30:38 +00:00
Robert Osfield
be9003d90c From Wang Rui, "The latest modification of osg/State uses the GLuint64EXT type, which
belongs to GL_EXT_timer_query and should be decalared to avoid
compiling errors if the extension is not supported. I've attached this
small fix."
2010-11-11 10:53:23 +00:00
Robert Osfield
68f37c4dcb From Tim More and Robert Osfield, implementation of ARB_timer_query based GPU timing stats syncronization.
Initial email from Tim : "I've implemented using a timestamp, available with ARB_timer_query and OpenGL 3.3, to gather GPU stats. This is nice because it can accurately fix the GPU draw time with respect to the other times on the stats graph, rather than having to estimate the wall time of the end of GPU drawing. This also prevents anomalies like the GPU phase starting before the draw phase..."
Changes to Tim's submission by Robert:  Removal of need for swap buffer callback in ViewerBase.cpp, by
integrating a osg::State::frameCompleted() method that does the stats timing collection.  Introduction of a
GraphicsContext::swapBuffersCallbackOrImplementation() method that calls the State::frameCompleted() and
the swap buffers callback or the swapImplementation as required.
2010-11-10 16:58:58 +00:00
Robert Osfield
64b26ebeb5 Added debug State::print(std::ostream&) method and extra debug messages in ShaderComposer and ShaderAttribute.
Added better shader composition testing in the osgshadercomposition example.
2010-07-10 17:14:59 +00:00
Robert Osfield
74ae526bb5 Added support for passing on uniforms from StateAttribute 2010-07-06 10:55:54 +00:00
Robert Osfield
751b0498fe Added basic code injection fields to osg::Shader,
creation of main shader to ShaderComposer and
collection of ShaderComponent to osg::State.
Also added very basic shader set up in osgshadecomposition example.
2010-07-05 16:32:58 +00:00
Robert Osfield
a55c4b7d70 Added basic ShaderComponent class and beginnings osgshadercomposition example 2010-07-02 12:04:20 +00:00
Robert Osfield
5cac233764 Added beginnings of shader composition with the shells of the ShaderComposer and ShaderAttribute classes. This aren't
functional yet, but a useful placeholders for future fucntionality.
2010-06-24 17:15:27 +00:00
Robert Osfield
4a047f2a82 From Michael Platings, introduced osg::State::applyModelViewMaitrx(const osg::Matrix& matrix) method and associated osg::State::_modelViewCache to enable osgText::Text3D to be refactored in away that avoids creating/destroying matrices 2010-06-01 13:33:58 +00:00
Robert Osfield
a6c7fee246 From Alok Priyadarshi, "1. Replaced APIENTRY to GL_APIENTRY which is used by OpenGL ES
headers. For desktop GL GL_APIENTRY has been defined as APIENTRY."
2010-04-28 21:22:44 +00:00
Robert Osfield
117d949d1f From Roland Smeenk and Robert Osfield, improvements to the indentation of comments. 2010-04-23 16:35:44 +00:00
Robert Osfield
6196652ef0 Replaced use of observer_ptr<> with straight C pointer to avoid thrashing of an observer_ptr<> every frame.
Changed include to point to new Observer header
2010-02-18 21:18:49 +00:00
Robert Osfield
248a0813db From Lilith Bryant, "As discussed previously on the users list. Fixes the redundant calls to
glActiveTexture on every State::apply after more than one texunits have been
used.

This is against 2.9.6 (I think SVN head is the same)

Quick Synopsis:

New functions:

State::applyModeOnTexUnit
State::applyAttributeOnTexUnit
State::applyModeMapOnTexUnit
State::applyAttributeMapOnTexUnit
State::applyModeListOnTexUnit
State::applyAttributeListOnTexUnit

All copies of the normal versions, but they also set the active tex unit if
absolutely necessary (i.e. only if they call something OpenGL).

State::apply (*2)
State::applyTextureAttribute

Changed to call the above functions and no longer call setActiveTextureUnit
themselves.

State::setActiveTextureUnit

Made inline, so the benefit of having applyModeOnTexUnit (etc) inline
is retained.
"
2010-01-07 16:49:12 +00:00
Robert Osfield
2f854d4978 Fixed primCount default value 2009-11-18 12:50:03 +00:00
Robert Osfield
4374ca23f9 Introduced new State::drawQuads(..) convinience method to help out with mapping GL 1.x style calls to GLES2.0 compatible calls. 2009-11-12 12:18:33 +00:00
Robert Osfield
37ee16403a Introduced usage of OSG_GLES*_AVAILABLE macros to headers and .cpp's to enable building against OpenGL ES 1.x and 2.x headers 2009-10-25 11:52:01 +00:00
Robert Osfield
2785ea4dfb Added support for automatic vertex aliasing to new ArrayDispatchers, and updated wrappers 2009-10-21 14:09:12 +00:00
Robert Osfield
9499b19b43 Moved the ArrayDispatchers management so that osg::State now has a ArrayDispatchers object that any osg::Geometry can reuse,
and optimized the implementation to reduce the CPU overhead.
2009-10-21 11:18:13 +00:00
Robert Osfield
6a56b6e6be Refactored osg::Geometry::drawImplementation(..) to use new osg::ArrayDispatchers that encapsulate the task
of dispatch osg::Array data as OpenGL attributes.
2009-10-20 19:34:24 +00:00
Robert Osfield
aefd1513f4 Ported osg::Geometry across to supporting the aliasing of vertex, color and normal etc. calls to Vertex Attributes.
Added support for automatic aliasing of vertex, normal, color etc. arrays to Vertex Attribute equivelants.

Added new osg::GLBeginEndAdapter class for runtime conversion from glBegin/glEnd codes to vertex arrray equivelants.

Added automatic shader source conversion from gl_ to osg_ builtins.
2009-10-16 16:26:27 +00:00
Robert Osfield
9e2567cb88 Made the use of the new projection and modelview matrix uniforms optional 2009-10-11 06:05:19 +00:00
Robert Osfield
f6166d1119 Introduced new uniforms for tracking the modelview and project matrices in shaders using non built-ins. 2009-10-09 13:39:11 +00:00
Robert Osfield
32b21dbb89 Introduced new GLBufferObject pool for managing the memory footprint taken up by VertexBufferObejct, ElementBufferObject and PixelBufferObject. 2009-10-03 09:25:23 +00:00
Robert Osfield
f75013d534 Introduced new BufferObject design + implementation in preperation of implementing a pool system for buffer objects 2009-10-01 20:19:42 +00:00
Robert Osfield
3d75054e2c Preliminary work on support for a texture object pool that is designed to help manage resources down the GPU more tightly. 2009-09-22 18:45:24 +00:00
Robert Osfield
8138a7698f Moved getAttributeVec into public: to allow 3rd party code to access without having to subclass 2009-05-12 05:49:36 +00:00
Robert Osfield
411431f3be Fixed warnings, updated NEWS 2009-01-30 10:55:28 +00:00
Robert Osfield
69f9377093 Fixed effective leak in Program::PerContextProgram caused by previously osg::State keeping a set of std::ref_ptr<Program::PerContextProgram> without ever pruning this list.
The fix was to convert the osg::State to use C pointers for the set of applied PerContexProgram objects, and use the osg::Oberver mechanism to avoid dangling pointers for being maintained in osg::State.
2009-01-26 15:16:24 +00:00
Robert Osfield
4f3b1baee4 Added support for primitive instancing 2009-01-06 14:55:49 +00:00
Robert Osfield
f4afa427a7 From Roland Smeenk, "Attached you will find a large set of small typo fixes (mainly in the comments)." 2007-12-10 17:30:18 +00:00
Robert Osfield
c346f5b943 Introduce new osgViewer::Renderer class for implementing of the rendering
of cameras in viewers
2007-08-02 11:02:47 +00:00
Robert Osfield
ab4398e440 From Farshid Lashkari, "I made a modification to the setClientActiveTextureUnit and
setActiveTextureUnit methods of osg::State so they return false if the
texture unit is outside the range of allowable units for the driver.
Currently, the functions would return true even if the units are
invalid. This would cause the osg::State to become out of sync with
the actual driver state, which can cause some bugs in certain cases.

The change I made would verify that the unit passed to
setClientActiveTextureUnit is below GL_MAX_TEXTURE_COORDS, and the
unit passed to setActiveTextureUnit is below
max(GL_MAX_TEXTURE_COORDS,GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS). I
modeled this behavior from the OpenGL docs for these commands which
can be found here:

http://www.opengl.org/sdk/docs/man/xhtml/glClientActiveTexture.xml
http://www.opengl.org/sdk/docs/man/xhtml/glActiveTexture.xml
"
2007-05-15 11:25:14 +00:00
Robert Osfield
859bcf3c4b Further perfomrmance optimizations and clean up on new VBO/EBO/PBO API. 2007-05-01 18:03:32 +00:00
Robert Osfield
40db1a8934 Moved VBO switching code into inline methods into osg::State to speed performance 2007-05-01 06:28:20 +00:00
Robert Osfield
9db23e0b22 Fixed bug associated with complex RenderBin setup. 2007-04-16 12:18:56 +00:00
Robert Osfield
fd0ea388c2 Began work on providing support for threading camera cull traversals in parallel with
the previous frames draw traversal.  Changes range from osg::State, through osgUtil::RenderBin, through to osgViewer
2007-01-29 22:44:29 +00:00
Robert Osfield
36330f7e40 Changed osgUtil::RenderBin and osg::State to allow nesting of StateSet's associated with RenderBin's. 2007-01-27 11:13:01 +00:00
Robert Osfield
def74d3471 Introduced new osg::View, and osg::RenderInfo classes into the core OSG to help
handle scenes with multiple views with elements that need coordinating on a per view basis.

Added beginings of new osgText::FadeText class (not functionality yet).
2006-09-18 20:54:48 +00:00
Robert Osfield
0336231321 Moved extension function pointer initilization into a method, and the pointers from
being static to be local member variables.  This should avoid issues under Windows
with multiple graphics contexts have seperate entry points.
2006-08-02 16:14:17 +00:00
Robert Osfield
f1c2694c17 Updated copyright years. 2006-07-18 15:21:48 +00:00
Robert Osfield
7d3ddc0e1b From Paul Martz, clean up of comments. 2006-06-08 12:09:51 +00:00
Robert Osfield
32b929a493 Added support for OpenGL mode black listing to provide better support
for extension checking and invalidation of OpenGL modes associated with
extensions.
2006-02-22 14:31:13 +00:00
Robert Osfield
b9e651baf1 Added new osg::GraphicsContext base class 2005-07-20 15:55:07 +00:00
Robert Osfield
7c90800822 From Jan Ciger, gcc 4.0 compile fix. 2005-05-12 20:35:15 +00:00
Robert Osfield
1afd5e48a7 Added support for PROTECTED and OVERRIDE to uniforms. 2005-05-10 13:56:05 +00:00
Robert Osfield
97daa561f4 Added support for lazy state updating of uniforms. 2005-05-03 21:46:47 +00:00
Robert Osfield
7117ff4bd3 Added support for controlling the frequency of checking for OpenGL errors
via:

        enum CheckForGLErrors
        {
            /** NEVER_CHECK_GL_ERRORS hints that OpenGL need not be checked for, this
                is the fastest option since checking for errors does incurr a small overhead.*/
            NEVER_CHECK_GL_ERRORS,
            /** ONCE_PER_FRAME means that OpenGl errors will be checked for once per
                frame, the overhead is still small, but at least OpenGL errors that are occurring
                will be caught, the reporting isn't fine grained enough for debugging purposes.*/
            ONCE_PER_FRAME,
            /** ONCE_PER_ATTRIBUTE means that OpenGL errors will be checked for after
                every attribute is applied, allow errors to be directly associated with
                particular operations which makes debugging much easier.*/
            ONCE_PER_ATTRIBUTE
        };

        /** Set whether and how often OpenGL errors should be checked for.*/
        void setCheckForGLErrors(CheckForGLErrors check) { _checkGLErrors = check; }

        /** Get whether and how often OpenGL errors should be checked for.*/
        CheckForGLErrors getCheckForGLErrors() const { return _checkGLErrors; }
2005-04-29 20:56:20 +00:00