Commit Graph

168 Commits

Author SHA1 Message Date
Robert Osfield
1d75089bf8 Build fixes when compiling wuth CMake options OPENGL_PROFILE set to GLCORE 2016-10-11 11:29:29 +01:00
Robert Osfield
d5f18590fd Added intializers 2016-06-22 10:35:37 +01:00
Robert Osfield
dd996a3289 Introduced CMake option OSG_PROVIDE_READFILE option that defaults to ON, but when switched to OFF disables the building of the osgDB::read*File() methods,
forcing users to use osgDB::readRef*File() methods.  The later is preferable as it closes a potential threading bug when using paging databases in conjunction
with the osgDB::Registry Object Cache.  This threading bug occurs when one thread gets an object from the Cache via an osgDB::read*File() call where only
a pointer to the object is passed back, so taking a reference to the object is delayed till it gets reassigned to a ref_ptr<>, but at the same time another
thread calls a flush of the Object Cache deleting this object as it's referenceCount is now zero.  Using osgDB::readREf*File() makes sure the a ref_ptr<> is
passed back and the referenceCount never goes to zero.

To ensure the OSG builds when OSG_PROVIDE_READFILE is to OFF the many cases of osgDB::read*File() usage had to be replaced with a ref_ptr<> osgDB::readRef*File()
usage.  The avoid this change causing lots of other client code to be rewritten to handle the use of ref_ptr<> in place of C pointer I introduced a serious of
templte methods in various class to adapt ref_ptr<> to the underly C pointer to be passed to old OSG API's, example of this is found in include/osg/Group:

    bool addChild(Node* child); // old method which can only be used with a Node*

    tempalte<class T> bool addChild(const osg::ref_ptr<T>& child) { return addChild(child.get()); } // adapter template method

These changes together cover 149 modified files, so it's a large submission. This extent of changes are warrent to make use of the Object Cache
and multi-threaded loaded more robust.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15164 16af8721-9629-0410-8352-f15c8da7e697
2015-10-22 13:42:19 +00:00
Robert Osfield
161246d864 Refactored the GL object deletion management to use new osg::GraphicsObjectManager/GLObjectManager base classes, and osg::ContextData container.
This approach unifies much of the code handling the clean up of OpenGL graphics data, avoids lots of local mutexes and static variables that were previously required,
and enables the clean up scheme to be easily extended by users providing their own GraphicsObjectManager subclasses.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15130 16af8721-9629-0410-8352-f15c8da7e697
2015-09-23 09:47:34 +00:00
Robert Osfield
78a01ce2a5 From Jannik Heller, "I have added new functions Texture::generateAndAssignTextureObject mirroring the Texture::generateTextureObject functions.
I have left the Texture::generateTextureObject functions intact as I'm not sure if/how it's used outside the core OSG. If you feel that compatibility isn't important in that area feel free to drop it.

While testing the build with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION=OFF I found a compile error in GlyphGeometry.cpp that was entirely unrelated to the changes I've made. The fix is included in the patch.

There is one thing left to fix and that is Texture2D::SubloadCallback:

        class OSG_EXPORT SubloadCallback : public Referenced
        {
            public:
                ....
                virtual TextureObject* generateTextureObject(const Texture2D& texture, State& state) const
                {
                    return osg::Texture::generateTextureObject(&texture, state.getContextID(), GL_TEXTURE_2D);
                }
                ...
         }"
         


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14879 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 10:50:44 +00:00
Robert Osfield
d5f2c34f24 From Andreas Henne, OpenGL core profile fixes required for OSX.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14669 16af8721-9629-0410-8352-f15c8da7e697
2015-01-21 15:35:19 +00:00
Robert Osfield
485709f708 Moved GL2Extensions functionality into the include/osg/GLExtensions header and new GLExtensions object.
Moved the #defines into new include/osg/GLDefines
Converted all GL2Extensions usage to GLExtensions usage


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14593 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 10:38:12 +00:00
Robert Osfield
22e51c9902 Windows build fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14590 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 20:09:29 +00:00
Robert Osfield
cceee38727 Moved Texture*::Extensions functionality into GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14581 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 10:05:59 +00:00
Robert Osfield
5da4e80e95 From Claus Steuer, "XCode 6, IOs 8.1 SDK Compile fix : There are some undefined texture formats when compiling osg for IOs 8.1 with XCode 6 and OpenGLES2 enabled."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14510 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 17:37:52 +00:00
Robert Osfield
99cbab1806 Changes to support building against ANDROID under OSX.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14399 16af8721-9629-0410-8352-f15c8da7e697
2014-08-08 09:28:26 +00:00
Robert Osfield
d22f62396c From Alexander Sinditskiy, "My changes added support for gltexstorrage2d for texture2d.
Initially I described issue in message:
http://forum.openscenegraph.org/viewtopic.php?t=13820
It solves issue with compiling texture using ico from image with mipmaps

I added enviroment variable OSG_GL_TEXTURE_STORAGE_ENABLE to control usage of glTexStorage2d. Initially it is disabled.

It used only if image have mipmaps.

Another issue is converting from internalFormat + type to sized internal format. I created sizedInternalFormats[] struct where sized internal formats are ordered from worse->best.
also this struct have commented lines. Commented formats are listed in
http://www.opengl.org/wiki/GLAPI/glTexStorage2D
but looks like not using in osg."

Note from Robert Osfield.  Changed the env var control to OSG_GL_TEXTURE_STORAGE and made it's value true by default when the feature is supported by the OpenGL driver.  To disable to
use of glTexStorage2D use OSG_GL_TEXTURE_STORAGE="OFF" or "DISABLE"



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14275 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 09:57:36 +00:00
Robert Osfield
723ecfad8d Removed the unused Texture::Extensions::numTextureUnits() 2013-12-16 11:28:10 +00:00
Robert Osfield
ff8fe4143e From Likasz Izebski, "added support for etc2/eac compression" 2013-10-28 12:03:55 +00:00
Robert Osfield
2dc53ceabb From Aurelien Albert, Added support for texture swizzle. 2013-06-03 15:10:53 +00:00
Robert Osfield
1a683e2f83 From Ulrich Hertlein, "Attached is a patch that introduces 'static_cast<unsigned int>' on some instances where
the code returns '.size()' of a std::vector.  This caused some warnings when using clang++
on OS X."
2013-05-14 16:12:21 +00:00
Robert Osfield
6ec15736cd Standardized use of GL_HALF_FLOAT_NV and GL_HALF_FLOAT_ARB to GL_HALF_FLOAT 2013-01-31 16:26:06 +00:00
Robert Osfield
26a8f63212 From Wang Rui, "In the attached files I've added the Compute Shader support for OSG, as well as serializer updates and a new osgcomputeshaders example. My submission also include a setComputeGroups() function in Program for setting compute-shader work groups, and a bindToImageUnit() function in Texture for binding textures as image variables in shaders.
All code are tested on Windows 7 + NVIDIA GFX 570 with the latest GeForce 310.70 Driver (BETA), which could support OpenGL 4.3.

Compute shader information can be found at "http://www.opengl.org/registry/specs/ARB/compute_shader.txt"
"
2013-01-25 11:54:03 +00:00
Robert Osfield
0b1605ed08 From Wang Rui with edits from Robert Osfield, additional GLenums for cross platform build 2013-01-23 16:22:45 +00:00
Robert Osfield
0a746faa2d Introduced Texture::Extensions::s/getPreferGenerateMipmapSGISForPowerOfTwo() flag that defaults to false for Radeon, true elsewhere.
This is used to workaround mipmapping bugs with ATI/AMD cards.
2012-07-12 16:41:53 +00:00
Robert Osfield
14a563dc9f Ran script to remove trailing spaces and tabs 2012-03-21 17:36:20 +00:00
Robert Osfield
a793958836 From Johannes Baeuerele, "I have extended the pvr reader plugin to support etc1 compression(GL_ETC1_RGB8_OES). The changes attached to this submission are based on today's trunk.
The pvr format which can be used as a wrapper for different compressed and uncompressed formats supports this compression algorithm. The original pvr compression uses the pvrtc format. The handling of pvrtc is already implemented in the pvr plugin. PVR provides wrapper functionality for some formats, e.g. etc or even dxt/dds.

Our target system (gles2) is able to use the etc compression format. With minor changes in the submitted files, there is no need to write a separate plugin. However the original pvr texture compression formats are not supported on our target, which is the reason for this extension.

The changes mainly consist in the definition on new enum values in the classes and headers of ReaderWriterPVR,Image and Texture. I also found some locations where the handling of the original pvr textures was not implemented. These are also part of this submission."
2011-04-21 17:04:50 +00:00
Robert Osfield
e7e860b742 Added support for explitly requesting DXT1a and DXT1c compression 2011-04-11 19:11:25 +00:00
Robert Osfield
95feb34ffa Fixed the size computation 2010-12-15 19:44:29 +00:00
Robert Osfield
8b8dda86af Removed no longer used static member variables 2010-12-15 16:30:48 +00:00
Robert Osfield
65f95fe3fe Added methods for checking sizes of various buffer object/texture object pool sizes. 2010-12-14 19:29:01 +00:00
Robert Osfield
4b4b438d44 Removed redundent MinimumNumberOfTextureObjectsToRetainInCache static variable 2010-12-14 15:28:31 +00:00
Robert Osfield
2aaf0ed297 From Fabien Lavingotte and Robert Osfield, Fixed handling of texture pool size when TextureObject::setAllocate(..) is called. 2010-11-04 17:53:58 +00:00
Robert Osfield
d2a9f48054 From Per Fahlberg, "I have added support for PowerVR texture compression. osg::Texture and osg::Image have been modified to support the texture formats and I have added a plugin to load pvr files. All modified files are in the attached zip. " 2010-11-04 11:02:37 +00:00
Robert Osfield
f6517d2f8b From Alexander Wiebel, "I did some spell checking in my spare time. Here come 20 files." 2010-09-24 14:53:10 +00:00
Robert Osfield
551d2b6479 From Ulrich Hertlein, "not sure how severe this is but I believe there's a bug in
Texture.cpp:applyTexImage2D_subload:

<code>
unsigned char* data = = (unsigned char*)image->data();
if (needImageRescale) {
 // allocates rescale buffer
 data = new unsigned char[newTotalSize];

 // calls gluScaleImage into the data buffer
}

const unsigned char* dataPtr = image->data();
// subloads 'dataPtr'

// deletes 'data'
</code>

In effect, the scaled data would never be used.

I've also replaced bits of duplicate code in Texture1D/2D/2DArray/3D/Cubemap/Rectangle
that checks if the texture image can/should be unref'd with common functionality in
Texture.cpp.

"
2010-09-14 13:19:55 +00:00
Robert Osfield
a171c88cf1 From Lukasz Izdebski, "Texture: added support for GL_EXT_texture_compression_rgtc, I added support (read and write ) for BC4 BC5 Block Compression to dds file format." 2010-08-16 14:11:49 +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
5d0b84edd0 From Marcin Hajder, "This submission contains Texture2DMultisample osg implementation.
Texture2DMultismaple as name suggests provides means to directly access subsamples of rendered FBO target. (GLSL 1.5 texelFetch call).

Recently I was working on deferred renderer with OSG, during that I noticed there is no support for multisampled textures (GL_ARB_texture_multisample extension). After consultations with Paul Martz and Wojtek Lewandowski I added Texture2DMultisample class and made few necessary changes around osg::FrameBufferObject, osg::Texture and osgUtil::RenderStage classes."

and from follow email:

"Fixed. According to ARB_texture_multisample extension specification multisample textures  don't need TexParameters since they can only be fetched with  texelFetch."
2010-04-22 17:02:22 +00:00
Robert Osfield
d10ce23e62 Fixed recursive call due to missing _ 2010-03-15 20:09:23 +00:00
Robert Osfield
9015ff7084 Refactored Texture::Extensions to simplify it and make it more efficient. 2010-03-15 10:32:03 +00:00
Robert Osfield
a31aa512d7 From Rob Radtke, "I recently ran into some issues trying to save/load a scene graph as a .ive file. The problems came about because the scene graph contained depth textures in it. I have attached a patch (against the current revision: 10919) that fixes the issues that I encountered. Both attachments contain the same patch--one is a .zip file that contains the modified files and the other is a text patch file. Here is a summary of the changes I made:
1) Add getShadowComparison() accessor function to osg::Texture class
2) Modify ReaderWriterTiff::writeTifStream() and _readColor() (in Image.cpp) to handle pixelFormat==GL_DEPTH_COMPONENT as if it were GL_LUMINANCE
3) Modify the Texture classes of the ive and osg plug-ins so that they save/load the following Texture members: _use_shadow_comparison, _shadow_compare_func and _shadow_texture_mode
"
2010-01-08 11:32:55 +00:00
Robert Osfield
ab8d93a181 Introduced preliminary osg::deleteAllGLObjects() and osg::discardAllGLObjects() functions and associated support into Texture and BufferObjects 2009-11-26 12:33:07 +00:00
Robert Osfield
3599be9708 From Wojciech Lewandowski, "I have extended a list of texture targets that can be used with shadow comparison. These targets are avaialble in in OpenGL 3.x shadow sampler variants. Changes are based on current SVN." 2009-11-24 13:24:30 +00:00
Robert Osfield
5a0186555b From Lilin Xiong, added missing OSG_EXPORT 2009-11-19 17:27:21 +00:00
Robert Osfield
8238396099 Added missing export 2009-11-13 09:56:47 +00:00
Robert Osfield
d17d7159a1 Ported osgUtil, osgDB, osgGA, NodeKits and plugins to compile against OpenGL ES 1.1 and OpenGL ES 2.0. 2009-10-28 20:31:57 +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
69557c060b Fixed the TextureObject's + GLBufferObject reassignment to a new set.
Disabled the unref after apply for a Texture classes when the texture pool is enabled
2009-10-06 13:42:12 +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
1fce3c0ad1 Added handling of resetting of the texture object format 2009-09-27 15:14:57 +00:00
Robert Osfield
4d75729650 Added stats collection to new Texture Pool code, and improved TexturePool implementation.
The Texture Pool can be enabled by setting the env var OSG_TEXTURE_POOL_SIZE=size_in_bytes.
Note, setting a size of 1 will result in the TexturePool allocating the minimum number of
textures it can without having to reuse TextureObjects from within the same frame.
2009-09-25 18:05:54 +00:00
Robert Osfield
216849f73a From Jean-Sebastien Guay, fixed Widows build and updated the SO version 2009-09-23 15:16:34 +00:00
Robert Osfield
d56499025b Introduced memory pool size management 2009-09-23 13:51:20 +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