Compare commits

..

66 Commits

Author SHA1 Message Date
Robert Osfield
d011ca4e8d Updated ChangeLog for 3.6.3 release 2018-09-14 11:16:53 +01:00
Robert Osfield
3a6b13c46e Updated version number and date for 3.6.3 stable release 2018-09-14 10:41:24 +01:00
Robert Osfield
88afccd85e Updated ChangeLog for 3.6.3-rc3 2018-09-13 08:52:21 +01:00
Robert Osfield
d6d6c3cda2 Updated for 3.6.3-rc3 2018-09-13 08:47:17 +01:00
Robert Osfield
ca134dca2d Standardized the glTexStorage*() calls to use osg::maximum(_numMipmapLevels,1) of rnumber of mipmaps to keep the usage consistent.
Fixed the erronous Texture2DArray glTexStorage call so that it used the _numMipmapLevels as above to resolve bug in allocation.
2018-09-12 17:45:49 +01:00
Robert Osfield
66246703bf Warning fixes 2018-09-11 15:32:44 +01:00
Robert Osfield
fb09be05a9 Fixed warning 2018-09-11 12:29:40 +01:00
Robert Osfield
41fa8fecd1 Updated for 3.6.3-rc2 2018-09-11 12:23:01 +01:00
Robert Osfield
2213011caa Updated rc number 2 for 3.6.3-rc2 2018-09-11 11:56:04 +01:00
OpenSceneGraph git repository
c2f0da31f2 Merge pull request #620 from LaurensVoerman/txt_SCREEN_COORDS
fix scale problem for osgText with characterSizeMode SCREEN_COORDS and _position set.
2018-09-11 11:29:36 +01:00
Robert Osfield
2e14bd52bf Fixed hang using a ReentrantMutex 2018-09-11 11:23:34 +01:00
Robert Osfield
4ea833cc6b Fixed build 2018-09-11 10:13:49 +01:00
Robert Osfield
7fae3b67cd Fixed build 2018-09-11 09:31:35 +01:00
Robert Osfield
8780347f2f Cleaned up code 2018-09-11 09:05:16 +01:00
gwaldron
22e6f6038f osgText: fixed thread-safety issues in Glyph and Font 2018-09-11 08:53:40 +01:00
mp3butcher
385cfa0cbf fix examples context creation for X11
(when display not :0.0)
2018-09-11 08:40:02 +01:00
OpenSceneGraph git repository
960f4d1ef2 Merge pull request #619 from mathieu/topic/SaveInlinedImages
Added saving of inline Images without having the physical image file.
2018-09-11 08:34:20 +01:00
Robert Osfield
257c2deb86 Added greater control of how cubemap is set up and controlled 2018-09-11 08:11:27 +01:00
Laurens Voerman
4dc6a6c4cd fix scale problem for osgText with characterSizeMode SCREEN_COORDS and _position set. 2018-09-07 15:09:15 +02:00
Mathieu MARACHE
2e38e4751c Added saving of inline Images without having the physical image file.
The can be read from and inlined image file
2018-09-07 14:05:50 +02:00
Robert Osfield
dfdb946d60 Merge branch 'OpenSceneGraph-3.6' of https://github.com/openscenegraph/OpenSceneGraph into OpenSceneGraph-3.6 2018-09-06 12:30:18 +01:00
Robert Osfield
2f056dcaa9 Updated for 3.6.3-rc1 2018-09-06 12:29:44 +01:00
Robert Osfield
d07fe93f34 Fixed memory leak with assignment of default value to ObjectSerializer 2018-09-06 11:53:35 +01:00
OpenSceneGraph git repository
05297f439c Merge pull request #616 from eligovision/OpenSceneGraph-3.6_particles
ParticleSystem: Added support for GLES2 and upper (GL_QUADS -> GL_TRI…
2018-09-05 18:06:25 +01:00
Robert Osfield
34d58d447d Fixed copy constructor 2018-09-05 18:01:33 +01:00
Konstantin S. Matveyev
637e1cc33b ParticleSystem: Using of GL_TRIANGLES for GLES2 and upper; GL_QUADS otherwise 2018-09-05 19:00:29 +03:00
OpenSceneGraph git repository
5d6ab3e6b7 Merge pull request #617 from aluaces/Image_scaleImage_typo
Fix typo in the initial check of Image::scaleImage().
2018-09-05 14:04:57 +01:00
Alberto Luaces
69667a478f Fix typo in the initial check of Image::scaleImage(). 2018-09-05 13:38:09 +02:00
Konstantin S. Matveyev
f00b7180cb ParticleSystem: Added support for GLES2 and upper (GL_QUADS -> GL_TRIANGLES) 2018-09-05 14:05:29 +03:00
Jason Beverage
6ae1139630 Protect the _programSet in Shader with a mutex.
This prevents thread safety issues when Shader objects are used in
multiple programs.
2018-09-05 09:34:54 +01:00
Robert Osfield
a06fcbe5d9 Updated ChangeLog 2018-09-05 09:33:24 +01:00
Robert Osfield
5f9c6a0170 Changed the ShapeDrawable::build() methpd so that it does run when the ShadpwDrawabe is a KdTree. 2018-09-04 15:26:30 +01:00
Robert Osfield
2a4dd6e03b Updated SO version as XmlNode::Input changes change the ABI 2018-09-04 14:13:32 +01:00
Robert Osfield
afe5644b9f Added support for reading UTF-8 encoded of xml files 2018-09-04 12:42:31 +01:00
Robert Osfield
ae3133522d Changed the logic for whether to call setUpThreading() in setThreadingModel() to make it possible to changed threadings even if the threading model starts of as SingleThreaded 2018-09-03 12:30:02 +01:00
Robert Osfield
5040c583b4 Updated version number to 3.6.3 in prep for next naintainance release 2018-09-03 11:19:50 +01:00
Robert Osfield
61967a7d1a Merge branch 'OpenSceneGraph-3.6-TexStorage' into OpenSceneGraph-3.6 2018-09-03 10:16:45 +01:00
Robert Osfield
bcba3928e6 Added reset of _stateset to prevent the releaseGLObjects calling release on th StateSet from the destructor 2018-09-03 09:41:59 +01:00
Robert Osfield
006ca64f4b Added reset of _stateset to prevent the releaseGLObjects calling release on th StateSet from the destructor 2018-09-03 09:37:36 +01:00
Robert Osfield
77fd07eaa9 Replaced the glSGetProcAddressARB code with the dlsym() usage as the NVidia driver looks to be returning non NULL pointers for invalid function names. 2018-08-28 12:01:35 +01:00
Robert Osfield
8b8c427afe Replaced the glSGetProcAddressARB code with the dlsym() usage as the NVidia driver looks to be returning non NULL pointers for invalid function names. 2018-08-28 11:52:42 +01:00
Robert Osfield
f55b864d59 Enabled point sprite validty modes. 2018-08-22 11:21:30 +01:00
Robert Osfield
d18c498322 Enabled point sprite validty modes. 2018-08-22 11:13:11 +01:00
Robert Osfield
4f7f34a6b0 Merged fix for PointSprite modes validity checks from master. 2018-08-22 10:43:15 +01:00
Robert Osfield
29789f898b Merged fix for PointSprite modes validity checks from master. 2018-08-22 10:42:18 +01:00
plevy
dd9312ae35 Change GL_RGBA16F to GL_RGBA16F_ARB to fix Windows Build
Change GL_RGBA16F to  GL_RGBA16F_ARB to fix Windows build.
2018-08-22 07:48:55 +01:00
plevy
78e050db43 Change GL_RGBA16F to GL_RGBA16F_ARB to fix Windows Build
Change GL_RGBA16F to  GL_RGBA16F_ARB to fix Windows build.
2018-08-22 07:48:22 +01:00
Robert Osfield
250dcc5b6c Replaced GL_RGBA32F with GL_RGBA32F_ARB to fix Windows build 2018-08-21 09:20:49 +01:00
Robert Osfield
f2dfd78914 Replaced GL_RGBA32F with GL_RGBA32F_ARB to fix Windows build 2018-08-21 09:19:50 +01:00
OpenSceneGraph git repository
1819bb32ae Merge pull request #606 from mp3butcher/OpenSceneGraph-3.6-TexStorage
Open scene graph 3.6 tex storage
2018-08-20 10:08:09 +01:00
mp3butcher
e043c3db33 complete TexStorage support 2018-08-20 05:11:43 +02:00
mp3butcher
587e65e674 add more extensions 2018-08-20 05:11:29 +02:00
mp3butcher
274b6894af remove redondant variable and test 2018-08-19 22:46:10 +02:00
Robert Osfield
29e87780f5 Removed check as this is better outside of the function 2018-08-17 16:53:13 +01:00
Robert Osfield
58a51cbc41 Created a GLenum Texture::selectSizedInternalFormat(const osg::Image* image=0) const method to help clean up set up of glTexStorage.
Fixed typo.
2018-08-17 12:20:59 +01:00
Robert Osfield
7ae7a994b4 Merged changes to InternalPixelRelations sizedInternalFormats[] from master 2018-08-17 10:31:46 +01:00
Robert Osfield
3808b298d1 Fixed memory leak associated with VertexArrayStte objects not getting released on destruction of Geometry/Drawables. 2018-08-16 19:24:56 +01:00
Robert Osfield
ed13576d03 From Chris White, Cygwin build fix 2018-08-08 14:42:04 +01:00
Vic-Min
15f2ae8d15 Renamed USE_DEPRECATED_API to OSG_USE_DEPRECATED_API 2018-08-08 14:37:28 +01:00
OpenSceneGraph git repository
9ab5aafd02 Merge pull request #583 from emminizer/flt-registry-cache
OpenFlight: Replace internal caches with osgDB::ObjectCache use.  Fix…
2018-07-31 16:58:41 +01:00
Daniel Emminizer
2e0e78144f OpenFlight: Replace internal caches with osgDB::ObjectCache use. Fixes unbounded memory growth when using readNode(std::istream&, ...) method. 2018-07-31 11:45:33 -04:00
Robert Osfield
ffb68bec7c Removed unneccessary FIX ME statement. 2018-07-31 09:14:02 +01:00
Robert Osfield
79bc4c3843 Fixed check against dataType changes 2018-07-27 17:34:30 +01:00
Alex Burton
a7747972dc updated osgviewerWX to remove deprecated calls in wxWidgets 3.x 2018-07-27 17:12:07 +01:00
OpenSceneGraph git repository
467baa8c00 Merge pull request #573 from emminizer/fix-flt-typo
FLT: Fix texture unit typo and code style from PR 568.
2018-07-09 17:55:38 +01:00
Daniel Emminizer
4d6c4a7f1f FLT: Fix texture unit typo and code style from PR 568. 2018-07-09 06:34:41 -04:00
77 changed files with 1110 additions and 456 deletions

View File

@@ -1,6 +1,6 @@
OpenSceneGraph Library 3.6.2 OpenSceneGraph Library 3.6.3
568 Contributors: 569 Contributors:
Firstname Surname Firstname Surname
----------------- -----------------
@@ -10,10 +10,10 @@ Stephan Huber
Paul Martz Paul Martz
Laurens Voerman Laurens Voerman
Farshid Lashkari Farshid Lashkari
Mathias Fr<EFBFBD>hlich Mathias Frhlich
Marco Jez Marco Jez
Wang Rui Wang Rui
Jean-S<EFBFBD>bastien Guay Jean-Sbastien Guay
Ulrich Hertlein Ulrich Hertlein
Mike Weiblen Mike Weiblen
Sukender Sukender
@@ -67,11 +67,11 @@ Norman Vine
Chris Denham Chris Denham
Sherman Wilcox Sherman Wilcox
Serge Lages Serge Lages
Romano Jos<EFBFBD> Magacho da Silva Romano Jos Magacho da Silva
Mourad Boufarguine Mourad Boufarguine
Alberto Farre Alberto Farre
Glenn Waldron Glenn Waldron
Andr<EFBFBD> Garneau Andr Garneau
Adrian Egli Adrian Egli
Sebastian Messerschmidt Sebastian Messerschmidt
Randall Hopper Randall Hopper
@@ -86,7 +86,7 @@ Michael Gronager
Martin Naylor Martin Naylor
Joakim Simonsson Joakim Simonsson
David Spilling David Spilling
Daniel Sj<EFBFBD>lie Daniel Sjlie
Bryan Thrall Bryan Thrall
Andreas Ekstrand Andreas Ekstrand
Rafa Gaitan Rafa Gaitan
@@ -123,7 +123,7 @@ Gordon Tomlinson
Frederic Marmond Frederic Marmond
Frederic Bouvier Frederic Bouvier
Carlo Camporesi Carlo Camporesi
Bj<EFBFBD>rn Blissing Bjrn Blissing
Alexander Sinditskiy Alexander Sinditskiy
Vladimir Chebaev Vladimir Chebaev
Thibault Genessay Thibault Genessay
@@ -143,7 +143,7 @@ Uwe Woessner
Tony Horrobin Tony Horrobin
Thom DeCarlo Thom DeCarlo
Tatsuhiro Nishioka Tatsuhiro Nishioka
Tanguy Fautr<EFBFBD> Tanguy Fautr
Sean Spicer Sean Spicer
Ryan Kawicki Ryan Kawicki
Richard Schmidt Richard Schmidt
@@ -202,7 +202,7 @@ Phil Atkin
Pawel Ksiezopolski Pawel Ksiezopolski
Patrick Neary Patrick Neary
Nathan Monteleone Nathan Monteleone
Miha Rav<EFBFBD>elj Miha Ravelj
Miguel Escriva Miguel Escriva
Mattias Linde Mattias Linde
Mark Sciabica Mark Sciabica
@@ -234,8 +234,8 @@ Christian Ruzicka
Christian Buchner Christian Buchner
Charles Cole Charles Cole
Blake Williams Blake Williams
Bj<EFBFBD>rn Hein Bjrn Hein
Aur<EFBFBD>lien Chatelain Aurlien Chatelain
Antoine Hue Antoine Hue
Andrew Bettison Andrew Bettison
Andreas Henne Andreas Henne
@@ -264,7 +264,7 @@ Paul Obermeier
Nguyen Van Truong Nguyen Van Truong
Nathan Cournia Nathan Cournia
Morten Haukness Morten Haukness
Morn<EFBFBD> Pistorius Morn Pistorius
Michael Mc Donnell Michael Mc Donnell
Michael Henheffer Michael Henheffer
Michael Guerrero Michael Guerrero
@@ -297,7 +297,7 @@ Guillaume Taze
Guillaume Chouvenc Guillaume Chouvenc
Giuseppe Donvito Giuseppe Donvito
Gill Peacegood Gill Peacegood
Giampaolo Vigan<EFBFBD> Giampaolo Vigan
Gerrick Bivins Gerrick Bivins
George Tarantilis George Tarantilis
Ferdi Smit Ferdi Smit
@@ -305,7 +305,7 @@ Eduardo Poyart
Edgar Ellis Edgar Ellis
Dmitry Marakasov Dmitry Marakasov
Dimi Christopoulos Dimi Christopoulos
Diane Delall<EFBFBD>e Diane Delalle
David Longest David Longest
David Ergo David Ergo
Daniel Trstenjak Daniel Trstenjak
@@ -337,7 +337,7 @@ Vasily Radostev
Valery Bickov Valery Bickov
Valeriy Dubov Valeriy Dubov
Vaclav Bilek Vaclav Bilek
Tyge L<EFBFBD>vset Tyge Lvset
Troy Yee Troy Yee
Torben Dannahauer Torben Dannahauer
Tony Vasile Tony Vasile
@@ -387,7 +387,7 @@ Piotr Rak
Pierre Bourdin Pierre Bourdin
Philipp Svehla Philipp Svehla
Philipp Siemoleit Philipp Siemoleit
Philipp M<EFBFBD>chler Philipp Mchler
Philip Lamb Philip Lamb
Petr Salinger Petr Salinger
Peter Bear Peter Bear
@@ -412,7 +412,7 @@ Nick Thu
Nick Black Nick Black
Mojtaba Fathi Mojtaba Fathi
Mirko Viviani Mirko Viviani
Mikkel Gj<EFBFBD>l Mikkel Gjl
Mike Krus Mike Krus
Mike Garrity Mike Garrity
Mick Thu Mick Thu
@@ -465,7 +465,7 @@ Juan Hernando
Josh Portway Josh Portway
Jonathan Greig Jonathan Greig
John Tan John Tan
John Hedström John Hedstrm
John Grant John Grant
John Farrier John Farrier
John Donovan John Donovan
@@ -523,11 +523,11 @@ David Jung
Danny Valente Danny Valente
Daniel Stien Daniel Stien
Dan Minor Dan Minor
C<EFBFBD>sar L. B. Silveira Csar L. B. Silveira
Cyril Brulebois Cyril Brulebois
Curtis Rubel Curtis Rubel
Cory Slep Cory Slep
Cl<EFBFBD>ment B<EFBFBD>sch Clment Bsch
Clay Fowler Clay Fowler
Claus Steuer Claus Steuer
Chuck Sembroski Chuck Sembroski
@@ -537,6 +537,7 @@ Christophe Herreman
Christian Noon Christian Noon
Christian Kaser Christian Kaser
Christian Ehrlicher Christian Ehrlicher
Chris White
Chris McGlone Chris McGlone
Chris Djali Chris Djali
Carlos Garcea Carlos Garcea

View File

@@ -3,8 +3,8 @@
# #
SET(OPENSCENEGRAPH_MAJOR_VERSION 3) SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
SET(OPENSCENEGRAPH_MINOR_VERSION 6) SET(OPENSCENEGRAPH_MINOR_VERSION 6)
SET(OPENSCENEGRAPH_PATCH_VERSION 2) SET(OPENSCENEGRAPH_PATCH_VERSION 3)
SET(OPENSCENEGRAPH_SOVERSION 157) SET(OPENSCENEGRAPH_SOVERSION 158)
# set to 0 when not a release candidate, non zero means that any generated # set to 0 when not a release candidate, non zero means that any generated

265
ChangeLog
View File

@@ -1,3 +1,268 @@
Fri, 14 Sep 2018 10:41:24 +0100
Author : Robert Osfield
Updated version number and date for 3.6.3 stable release
Thu, 13 Sep 2018 08:52:21 +0100
Author : Robert Osfield
Updated ChangeLog for 3.6.3-rc3
Thu, 13 Sep 2018 08:47:17 +0100
Author : Robert Osfield
Updated for 3.6.3-rc3
Wed, 12 Sep 2018 17:45:49 +0100
Author : Robert Osfield
Standardized the glTexStorage*() calls to use osg::maximum(_numMipmapLevels,1) of rnumber of mipmaps to keep the usage consistent. Fixed the erronous Texture2DArray glTexStorage call so that it used the _numMipmapLevels as above to resolve bug in allocation.
Tue, 11 Sep 2018 15:32:44 +0100
Author : Robert Osfield
Warning fixes
Tue, 11 Sep 2018 12:29:40 +0100
Author : Robert Osfield
Fixed warning
Tue, 11 Sep 2018 12:23:01 +0100
Author : Robert Osfield
Updated for 3.6.3-rc2
Tue, 11 Sep 2018 11:56:04 +0100
Author : Robert Osfield
Updated rc number 2 for 3.6.3-rc2
Tue, 11 Sep 2018 11:29:36 +0100
Author : OpenSceneGraph git repository
Merge pull request #620 from LaurensVoerman/txt_SCREEN_COORDSfix scale problem for osgText with characterSizeMode SCREEN_COORDS and _position set.
Tue, 11 Sep 2018 11:23:34 +0100
Author : Robert Osfield
Fixed hang using a ReentrantMutex
Tue, 11 Sep 2018 10:13:49 +0100
Author : Robert Osfield
Fixed build
Tue, 11 Sep 2018 09:31:35 +0100
Author : Robert Osfield
Fixed build
Tue, 11 Sep 2018 09:03:01 +0100
Author : Robert Osfield
Cleaned up code
Mon, 10 Sep 2018 08:00:41 -0400
Author : gwaldron
osgText: fixed thread-safety issues in Glyph and Font
Sat, 8 Sep 2018 18:18:33 +0200
Author : mp3butcher
fix examples context creation for X11 (when display not :0.0)
Tue, 11 Sep 2018 08:34:20 +0100
Author : OpenSceneGraph git repository
Merge pull request #619 from mathieu/topic/SaveInlinedImagesAdded saving of inline Images without having the physical image file.
Tue, 11 Sep 2018 08:11:27 +0100
Author : Robert Osfield
Added greater control of how cubemap is set up and controlled
Fri, 7 Sep 2018 15:09:15 +0200
Author : Laurens Voerman
fix scale problem for osgText with characterSizeMode SCREEN_COORDS and _position set.
Fri, 7 Sep 2018 14:04:41 +0200
Author : Mathieu MARACHE
Added saving of inline Images without having the physical image file.The can be read from and inlined image file
Thu, 6 Sep 2018 12:30:18 +0100
Author : Robert Osfield
Merge branch 'OpenSceneGraph-3.6' of https://github.com/openscenegraph/OpenSceneGraph into OpenSceneGraph-3.6
Thu, 6 Sep 2018 12:29:44 +0100
Author : Robert Osfield
Updated for 3.6.3-rc1
Thu, 6 Sep 2018 11:50:21 +0100
Author : Robert Osfield
Fixed memory leak with assignment of default value to ObjectSerializer
Wed, 5 Sep 2018 18:06:25 +0100
Author : OpenSceneGraph git repository
Merge pull request #616 from eligovision/OpenSceneGraph-3.6_particlesParticleSystem: Added support for GLES2 and upper (GL_QUADS -> GL_TRI…
Wed, 5 Sep 2018 18:01:33 +0100
Author : Robert Osfield
Fixed copy constructor
Wed, 5 Sep 2018 19:00:29 +0300
Author : Konstantin S. Matveyev
ParticleSystem: Using of GL_TRIANGLES for GLES2 and upper; GL_QUADS otherwise
Wed, 5 Sep 2018 14:04:57 +0100
Author : OpenSceneGraph git repository
Merge pull request #617 from aluaces/Image_scaleImage_typoFix typo in the initial check of Image::scaleImage().
Wed, 5 Sep 2018 13:27:35 +0200
Author : Alberto Luaces
Fix typo in the initial check of Image::scaleImage().
Wed, 5 Sep 2018 14:00:09 +0300
Author : Konstantin S. Matveyev
ParticleSystem: Added support for GLES2 and upper (GL_QUADS -> GL_TRIANGLES)
Tue, 4 Sep 2018 10:35:38 -0400
Author : Jason Beverage
Protect the _programSet in Shader with a mutex. This prevents thread safety issues when Shader objects are used in multiple programs.
Wed, 5 Sep 2018 09:33:24 +0100
Author : Robert Osfield
Updated ChangeLog
Tue, 4 Sep 2018 15:26:30 +0100
Author : Robert Osfield
Changed the ShapeDrawable::build() methpd so that it does run when the ShadpwDrawabe is a KdTree.
Tue, 4 Sep 2018 14:13:32 +0100
Author : Robert Osfield
Updated SO version as XmlNode::Input changes change the ABI
Tue, 4 Sep 2018 12:19:14 +0100
Author : Robert Osfield
Added support for reading UTF-8 encoded of xml files
Mon, 3 Sep 2018 12:30:02 +0100
Author : Robert Osfield
Changed the logic for whether to call setUpThreading() in setThreadingModel() to make it possible to changed threadings even if the threading model starts of as SingleThreaded
Mon, 3 Sep 2018 11:19:50 +0100
Author : Robert Osfield
Updated version number to 3.6.3 in prep for next naintainance release
Mon, 3 Sep 2018 10:16:45 +0100
Author : Robert Osfield
Merge branch 'OpenSceneGraph-3.6-TexStorage' into OpenSceneGraph-3.6
Mon, 3 Sep 2018 09:37:36 +0100
Author : Robert Osfield
Added reset of _stateset to prevent the releaseGLObjects calling release on th StateSet from the destructor
Mon, 3 Sep 2018 09:37:36 +0100
Author : Robert Osfield
Added reset of _stateset to prevent the releaseGLObjects calling release on th StateSet from the destructor
Tue, 28 Aug 2018 11:22:57 +0100
Author : Robert Osfield
Replaced the glSGetProcAddressARB code with the dlsym() usage as the NVidia driver looks to be returning non NULL pointers for invalid function names.
Tue, 28 Aug 2018 11:22:57 +0100
Author : Robert Osfield
Replaced the glSGetProcAddressARB code with the dlsym() usage as the NVidia driver looks to be returning non NULL pointers for invalid function names.
Wed, 22 Aug 2018 11:13:11 +0100
Author : Robert Osfield
Enabled point sprite validty modes.
Wed, 22 Aug 2018 11:13:11 +0100
Author : Robert Osfield
Enabled point sprite validty modes.
Wed, 22 Aug 2018 10:42:18 +0100
Author : Robert Osfield
Merged fix for PointSprite modes validity checks from master.
Wed, 22 Aug 2018 10:42:18 +0100
Author : Robert Osfield
Merged fix for PointSprite modes validity checks from master.
Tue, 21 Aug 2018 09:38:03 -0400
Author : plevy
Change GL_RGBA16F to GL_RGBA16F_ARB to fix Windows BuildChange GL_RGBA16F to GL_RGBA16F_ARB to fix Windows build.
Tue, 21 Aug 2018 09:38:03 -0400
Author : plevy
Change GL_RGBA16F to GL_RGBA16F_ARB to fix Windows BuildChange GL_RGBA16F to GL_RGBA16F_ARB to fix Windows build.
Tue, 21 Aug 2018 09:19:50 +0100
Author : Robert Osfield
Replaced GL_RGBA32F with GL_RGBA32F_ARB to fix Windows build
Tue, 21 Aug 2018 09:19:50 +0100
Author : Robert Osfield
Replaced GL_RGBA32F with GL_RGBA32F_ARB to fix Windows build
Mon, 20 Aug 2018 10:08:09 +0100
Author : OpenSceneGraph git repository
Merge pull request #606 from mp3butcher/OpenSceneGraph-3.6-TexStorageOpen scene graph 3.6 tex storage
Mon, 20 Aug 2018 05:10:11 +0200
Author : mp3butcher
complete TexStorage support
Mon, 20 Aug 2018 04:50:14 +0200
Author : mp3butcher
add more extensions
Sun, 19 Aug 2018 22:46:10 +0200
Author : mp3butcher
remove redondant variable and test
Fri, 17 Aug 2018 16:51:55 +0100
Author : Robert Osfield
Removed check as this is better outside of the function
Fri, 17 Aug 2018 12:20:59 +0100
Author : Robert Osfield
Created a GLenum Texture::selectSizedInternalFormat(const osg::Image* image=0) const method to help clean up set up of glTexStorage. Fixed typo.
Fri, 17 Aug 2018 10:31:46 +0100
Author : Robert Osfield
Merged changes to InternalPixelRelations sizedInternalFormats[] from master
Thu, 16 Aug 2018 19:23:17 +0100
Author : Robert Osfield
Fixed memory leak associated with VertexArrayStte objects not getting released on destruction of Geometry/Drawables.
Wed, 8 Aug 2018 14:42:04 +0100
Author : Robert Osfield
From Chris White, Cygwin build fix
Wed, 8 Aug 2018 15:05:53 +0300
Author : Vic-Min
Renamed USE_DEPRECATED_API to OSG_USE_DEPRECATED_API
Tue, 31 Jul 2018 16:58:41 +0100
Author : OpenSceneGraph git repository
Merge pull request #583 from emminizer/flt-registry-cacheOpenFlight: Replace internal caches with osgDB::ObjectCache use. Fix…
Tue, 31 Jul 2018 11:45:33 -0400
Author : Daniel Emminizer
OpenFlight: Replace internal caches with osgDB::ObjectCache use. Fixes unbounded memory growth when using readNode(std::istream&, ...) method.
Tue, 31 Jul 2018 09:13:20 +0100
Author : Robert Osfield
Removed unneccessary FIX ME statement.
Fri, 27 Jul 2018 17:34:30 +0100
Author : Robert Osfield
Fixed check against dataType changes
Wed, 25 Nov 2015 09:36:15 +1100
Author : Alex Burton
updated osgviewerWX to remove deprecated calls in wxWidgets 3.x
Mon, 9 Jul 2018 17:55:38 +0100
Author : OpenSceneGraph git repository
Merge pull request #573 from emminizer/fix-flt-typoFLT: Fix texture unit typo and code style from PR 568.
Mon, 9 Jul 2018 06:34:41 -0400
Author : Daniel Emminizer
FLT: Fix texture unit typo and code style from PR 568.
Fri, 29 Jun 2018 10:56:35 +0100
Author : Robert Osfield
Updated ChangeLog for 3.6.2 release
Fri, 29 Jun 2018 10:56:01 +0100 Fri, 29 Jun 2018 10:56:01 +0100
Author : Robert Osfield Author : Robert Osfield
Updated date for 3.6.2 releases Updated date for 3.6.2 releases

View File

@@ -25,7 +25,7 @@ If details below are not sufficient then head over to the openscenegraph.org to
Robert Osfield. Robert Osfield.
Project Lead. Project Lead.
29th June 2018. 14th September 2018.
--- ---
@@ -116,4 +116,4 @@ Be sure to set the THIRDPARTY_PATH to the path containing your thirdparty depend
Once this completes an XCode project will have been generated in the osg root folder. Open the generated Xcode project, select the example_osgViewerIPhone target. In 'General' tab set a development team. In the 'Build Settings' tab search for 'Other Linker Flags', then for each target type (debug, release etc) that you want to use open the list of arguments and delete the 'OpenGL' line and the '-framework' line above it. This is because cmake has tried to add the desktop OpenGL library which we don't want. Once this completes an XCode project will have been generated in the osg root folder. Open the generated Xcode project, select the example_osgViewerIPhone target. In 'General' tab set a development team. In the 'Build Settings' tab search for 'Other Linker Flags', then for each target type (debug, release etc) that you want to use open the list of arguments and delete the 'OpenGL' line and the '-framework' line above it. This is because cmake has tried to add the desktop OpenGL library which we don't want.
Once this is done you should be able to build and deploy the `example_osgViewerIPhone` target on your device. Once this is done you should be able to build and deploy the `example_osgViewerIPhone` target on your device.

View File

@@ -45,6 +45,8 @@ class MyGraphicsContext {
traits->doubleBuffer = false; traits->doubleBuffer = false;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->pbuffer = true; traits->pbuffer = true;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
_gc = osg::GraphicsContext::createGraphicsContext(traits.get()); _gc = osg::GraphicsContext::createGraphicsContext(traits.get());

View File

@@ -249,6 +249,8 @@ int main( int argc, char **argv )
traits->width = 1 << 12; traits->width = 1 << 12;
traits->height = 1 << 12; traits->height = 1 << 12;
traits->pbuffer = true; traits->pbuffer = true;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
} }
osg::ref_ptr<osg::GraphicsContext> pbuffer = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> pbuffer = osg::GraphicsContext::createGraphicsContext(traits.get());
if (pbuffer.valid()) if (pbuffer.valid())

View File

@@ -209,6 +209,8 @@ osgViewer::View* createView(osg::ref_ptr<osg::Node> scenegraph, osg::ref_ptr<osg
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
gc = osg::GraphicsContext::createGraphicsContext(traits.get()); gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!gc) if (!gc)
@@ -267,7 +269,11 @@ int main(int argc, char** argv)
} }
unsigned int width, height; unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); osg::GraphicsContext::ScreenIdentifier main_screen_id;
main_screen_id.readDISPLAY();
main_screen_id.setUndefinedScreenDetailsToDefaultScreen();
wsi->getScreenResolution(main_screen_id, width, height);
unsigned int x=0, y=0; unsigned int x=0, y=0;
while(arguments.read("--window", x, y, width, height)) {} while(arguments.read("--window", x, y, width, height)) {}
@@ -283,6 +289,8 @@ int main(int argc, char** argv)
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
gc = osg::GraphicsContext::createGraphicsContext(traits.get()); gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!gc) if (!gc)

View File

@@ -83,7 +83,11 @@ void singleWindowMultipleCameras(osgViewer::Viewer& viewer)
} }
unsigned int width, height; unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); osg::GraphicsContext::ScreenIdentifier main_screen_id;
main_screen_id.readDISPLAY();
main_screen_id.setUndefinedScreenDetailsToDefaultScreen();
wsi->getScreenResolution(main_screen_id, width, height);
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->x = 0; traits->x = 0;
@@ -93,6 +97,8 @@ void singleWindowMultipleCameras(osgViewer::Viewer& viewer)
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (gc.valid()) if (gc.valid())
@@ -134,7 +140,11 @@ void multipleWindowMultipleCameras(osgViewer::Viewer& viewer, bool multipleScree
} }
unsigned int width, height; unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); osg::GraphicsContext::ScreenIdentifier main_screen_id;
main_screen_id.readDISPLAY();
main_screen_id.setUndefinedScreenDetailsToDefaultScreen();
wsi->getScreenResolution(main_screen_id, width, height);
unsigned int numCameras = 6; unsigned int numCameras = 6;
@@ -151,6 +161,8 @@ void multipleWindowMultipleCameras(osgViewer::Viewer& viewer, bool multipleScree
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (gc.valid()) if (gc.valid())

View File

@@ -971,9 +971,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
{ {
createNewCatchable(); createNewCatchable();
} }
break;
} }
case(osgGA::GUIEventAdapter::KEYDOWN): case(osgGA::GUIEventAdapter::KEYDOWN):
{ {
@@ -987,6 +985,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
_rightKeyPressed=true; _rightKeyPressed=true;
return true; return true;
} }
break;
} }
case(osgGA::GUIEventAdapter::KEYUP): case(osgGA::GUIEventAdapter::KEYUP):
{ {
@@ -1000,6 +999,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
_rightKeyPressed=false; _rightKeyPressed=false;
return true; return true;
} }
break;
} }
case(osgGA::GUIEventAdapter::DRAG): case(osgGA::GUIEventAdapter::DRAG):
case(osgGA::GUIEventAdapter::MOVE): case(osgGA::GUIEventAdapter::MOVE):

View File

@@ -289,7 +289,11 @@ int main( int argc, char **argv )
} }
unsigned int width, height; unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); osg::GraphicsContext::ScreenIdentifier main_screen_id;
main_screen_id.readDISPLAY();
main_screen_id.setUndefinedScreenDetailsToDefaultScreen();
wsi->getScreenResolution(main_screen_id, width, height);
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->x = 100; traits->x = 100;
@@ -299,6 +303,8 @@ int main( int argc, char **argv )
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (gc.valid()) if (gc.valid())

View File

@@ -40,33 +40,101 @@
#include <string> #include <string>
#include <vector> #include <vector>
void create_specular_highlights(osg::Node *node) int main(int argc, char *argv[])
{ {
osg::StateSet *ss = node->getOrCreateStateSet(); // use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// construct the viewer.
osgViewer::Viewer viewer;
osg::ref_ptr<osg::TextureCubeMap> tcm = new osg::TextureCubeMap;
// create and setup the texture object
osg::TextureCubeMap *tcm = new osg::TextureCubeMap;
tcm->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP); tcm->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP);
tcm->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP); tcm->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP);
tcm->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP); tcm->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP);
tcm->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);
tcm->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
// generate the six highlight map images (light direction = [1, 1, -1]) if (arguments.read("--no-mip-map"))
osgUtil::HighlightMapGenerator *mapgen = new osgUtil::HighlightMapGenerator( {
osg::Vec3(1, 1, -1), // light direction tcm->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);
osg::Vec4(1, 0.9f, 0.8f, 1), // light color tcm->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
8); // specular exponent }
else
{
tcm->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);
tcm->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
}
mapgen->generateMap(); if (arguments.read("--hardware-mip-map") || arguments.read("--hmp"))
{
OSG_NOTICE<<"tcm->setUseHardwareMipMapGeneration(true)"<<std::endl;
tcm->setUseHardwareMipMapGeneration(true);
}
// assign the six images to the texture object std::string filename;
tcm->setImage(osg::TextureCubeMap::POSITIVE_X, mapgen->getImage(osg::TextureCubeMap::POSITIVE_X)); if (arguments.read("--posx", filename)) tcm->setImage(osg::TextureCubeMap::POSITIVE_X, osgDB::readImageFile(filename));
tcm->setImage(osg::TextureCubeMap::NEGATIVE_X, mapgen->getImage(osg::TextureCubeMap::NEGATIVE_X)); if (arguments.read("--negx", filename)) tcm->setImage(osg::TextureCubeMap::NEGATIVE_X, osgDB::readImageFile(filename));
tcm->setImage(osg::TextureCubeMap::POSITIVE_Y, mapgen->getImage(osg::TextureCubeMap::POSITIVE_Y)); if (arguments.read("--posy", filename)) tcm->setImage(osg::TextureCubeMap::POSITIVE_Y, osgDB::readImageFile(filename));
tcm->setImage(osg::TextureCubeMap::NEGATIVE_Y, mapgen->getImage(osg::TextureCubeMap::NEGATIVE_Y)); if (arguments.read("--negy", filename)) tcm->setImage(osg::TextureCubeMap::NEGATIVE_Y, osgDB::readImageFile(filename));
tcm->setImage(osg::TextureCubeMap::POSITIVE_Z, mapgen->getImage(osg::TextureCubeMap::POSITIVE_Z)); if (arguments.read("--posz", filename)) tcm->setImage(osg::TextureCubeMap::POSITIVE_Z, osgDB::readImageFile(filename));
tcm->setImage(osg::TextureCubeMap::NEGATIVE_Z, mapgen->getImage(osg::TextureCubeMap::NEGATIVE_Z)); if (arguments.read("--negz", filename)) tcm->setImage(osg::TextureCubeMap::NEGATIVE_Z, osgDB::readImageFile(filename));
int numValidImages = 0;
if (tcm->getImage(osg::TextureCubeMap::POSITIVE_X)) ++numValidImages;
if (tcm->getImage(osg::TextureCubeMap::NEGATIVE_X)) ++numValidImages;
if (tcm->getImage(osg::TextureCubeMap::POSITIVE_Y)) ++numValidImages;
if (tcm->getImage(osg::TextureCubeMap::NEGATIVE_Y)) ++numValidImages;
if (tcm->getImage(osg::TextureCubeMap::POSITIVE_Z)) ++numValidImages;
if (tcm->getImage(osg::TextureCubeMap::NEGATIVE_Z)) ++numValidImages;
if (numValidImages!=6)
{
// generate the six highlight map images (light direction = [1, 1, -1])
osgUtil::HighlightMapGenerator *mapgen = new osgUtil::HighlightMapGenerator(
osg::Vec3(1, 1, -1), // light direction
osg::Vec4(1, 0.9f, 0.8f, 1), // light color
8); // specular exponent
mapgen->generateMap();
// assign the six images to the texture object
if (!tcm->getImage(osg::TextureCubeMap::POSITIVE_X)) tcm->setImage(osg::TextureCubeMap::POSITIVE_X, mapgen->getImage(osg::TextureCubeMap::POSITIVE_X));
if (!tcm->getImage(osg::TextureCubeMap::NEGATIVE_X)) tcm->setImage(osg::TextureCubeMap::NEGATIVE_X, mapgen->getImage(osg::TextureCubeMap::NEGATIVE_X));
if (!tcm->getImage(osg::TextureCubeMap::POSITIVE_Y)) tcm->setImage(osg::TextureCubeMap::POSITIVE_Y, mapgen->getImage(osg::TextureCubeMap::POSITIVE_Y));
if (!tcm->getImage(osg::TextureCubeMap::NEGATIVE_Y)) tcm->setImage(osg::TextureCubeMap::NEGATIVE_Y, mapgen->getImage(osg::TextureCubeMap::NEGATIVE_Y));
if (!tcm->getImage(osg::TextureCubeMap::POSITIVE_Z)) tcm->setImage(osg::TextureCubeMap::POSITIVE_Z, mapgen->getImage(osg::TextureCubeMap::POSITIVE_Z));
if (!tcm->getImage(osg::TextureCubeMap::NEGATIVE_Z)) tcm->setImage(osg::TextureCubeMap::NEGATIVE_Z, mapgen->getImage(osg::TextureCubeMap::NEGATIVE_Z));
}
float LODBias;
if (arguments.read("--lod",LODBias))
{
tcm->setLODBias(LODBias);
}
osg::ref_ptr<osg::Program> program = new osg::Program;
std::string shaderFilename;
while (arguments.read("-s", shaderFilename))
{
osg::ref_ptr<osg::Shader> shader = osgDB::readRefShaderFile(shaderFilename);
if (shader) program->addShader(shader);
}
// load the nodes from the commandline arguments.
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
// if not loaded assume no arguments passed in, try use default mode instead.
if (!rootnode) rootnode = osgDB::readRefNodeFile("cessna.osgt");
if (!rootnode)
{
osg::notify(osg::NOTICE)<<"Please specify a model filename on the command line."<<std::endl;
return 1;
}
osg::StateSet *ss = rootnode->getOrCreateStateSet();
// enable texturing, replacing any textures in the subgraphs // enable texturing, replacing any textures in the subgraphs
ss->setTextureAttributeAndModes(0, tcm, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON); ss->setTextureAttributeAndModes(0, tcm, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
@@ -84,31 +152,13 @@ void create_specular_highlights(osg::Node *node)
te->setSource1_RGB(osg::TexEnvCombine::PRIMARY_COLOR); te->setSource1_RGB(osg::TexEnvCombine::PRIMARY_COLOR);
te->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR); te->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
ss->setTextureAttributeAndModes(0, te, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON); ss->setTextureAttributeAndModes(0, te, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
}
int main(int argc, char *argv[]) if (program->getNumShaders()>0)
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// construct the viewer.
osgViewer::Viewer viewer;
// load the nodes from the commandline arguments.
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
// if not loaded assume no arguments passed in, try use default mode instead.
if (!rootnode) rootnode = osgDB::readRefNodeFile("cessna.osgt");
if (!rootnode)
{ {
osg::notify(osg::NOTICE)<<"Please specify a model filename on the command line."<<std::endl; ss->setAttribute(program.get());
return 1; ss->addUniform(new osg::Uniform("baseTexture",0));
} }
// create specular highlights
create_specular_highlights(rootnode.get());
// run optimization over the scene graph // run optimization over the scene graph
osgUtil::Optimizer optimzer; osgUtil::Optimizer optimzer;
optimzer.optimize(rootnode); optimzer.optimize(rootnode);

View File

@@ -79,7 +79,11 @@ struct CommandLineOptions
return; return;
} }
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); osg::GraphicsContext::ScreenIdentifier main_screen_id;
main_screen_id.readDISPLAY();
main_screen_id.setUndefinedScreenDetailsToDefaultScreen();
wsi->getScreenResolution(main_screen_id, width, height);
distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius); distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius);
} }
@@ -274,6 +278,8 @@ void setDomeFaces(osgViewer::Viewer& viewer, CommandLineOptions& options)
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!gc) if (!gc)
@@ -502,6 +508,8 @@ void setDomeCorrection(osgViewer::Viewer& viewer, CommandLineOptions& options)
traits->windowDecoration = false; traits->windowDecoration = false;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!gc) if (!gc)

View File

@@ -12,11 +12,6 @@
void textInfo(osgText::Text* text) void textInfo(osgText::Text* text)
{ {
const osgText::Text::TextureGlyphQuadMap& tgqm = text->getTextureGlyphQuadMap();
const osgText::Text::TextureGlyphQuadMap::const_iterator tgqmi = tgqm.begin();
osgText::String& s = text->getText(); osgText::String& s = text->getText();
for(unsigned int i = 0; i < s.size(); i++) for(unsigned int i = 0; i < s.size(); i++)

View File

@@ -722,6 +722,8 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
traits->windowDecoration = decoration; traits->windowDecoration = decoration;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
ref_ptr<GraphicsContext> gc = GraphicsContext::createGraphicsContext(traits.get()); ref_ptr<GraphicsContext> gc = GraphicsContext::createGraphicsContext(traits.get());
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(gc.get()); osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(gc.get());

View File

@@ -48,7 +48,7 @@ class MoveEarthySkyWithEyePointTransform : public osg::Transform
{ {
public: public:
/** Get the transformation matrix which moves from local coords to world coords.*/ /** Get the transformation matrix which moves from local coords to world coords.*/
virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const
{ {
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv); osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
if (cv) if (cv)
@@ -63,7 +63,7 @@ public:
virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const
{ {
std::cout<<"computing transform"<<std::endl; std::cout<<"computing transform"<<std::endl;
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv); osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
if (cv) if (cv)
{ {
@@ -99,7 +99,7 @@ osg::Group* createModel()
// add the sky and base layer. // add the sky and base layer.
transform->addChild(makeSky()); // bin number -2 so drawn first. transform->addChild(makeSky()); // bin number -2 so drawn first.
transform->addChild(makeBase()); // bin number -1 so draw second. transform->addChild(makeBase()); // bin number -1 so draw second.
// add the transform to the earth sky. // add the transform to the earth sky.
clearNode->addChild(transform); clearNode->addChild(transform);
@@ -138,14 +138,14 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->write(std::cout); arguments.getApplicationUsage()->write(std::cout);
return 1; return 1;
} }
bool customWindows = false; bool customWindows = false;
while(arguments.read("-2")) customWindows = true; while(arguments.read("-2")) customWindows = true;
if (customWindows) if (customWindows)
{ {
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
if (!wsi) if (!wsi)
{ {
osg::notify(osg::NOTICE)<<"View::setUpViewAcrossAllScreens() : Error, no WindowSystemInterface available, cannot create windows."<<std::endl; osg::notify(osg::NOTICE)<<"View::setUpViewAcrossAllScreens() : Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
return 0; return 0;
@@ -159,6 +159,8 @@ int main( int argc, char **argv )
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (gc.valid()) if (gc.valid())
@@ -186,17 +188,17 @@ int main( int argc, char **argv )
viewer.addSlave(camera.get(), osg::Matrixd(), osg::Matrixd::scale(aspectRatioScale,1.0,1.0)); viewer.addSlave(camera.get(), osg::Matrixd(), osg::Matrixd::scale(aspectRatioScale,1.0,1.0));
} }
} }
else else
{ {
viewer.setUpViewAcrossAllScreens(); viewer.setUpViewAcrossAllScreens();
} }
// set up the camera manipulation with our custom manipultor // set up the camera manipulation with our custom manipultor
viewer.setCameraManipulator(new GliderManipulator()); viewer.setCameraManipulator(new GliderManipulator());
// pass the scene graph to the viewer // pass the scene graph to the viewer
viewer.setSceneData( createModel() ); viewer.setSceneData( createModel() );
return viewer.run(); return viewer.run();

View File

@@ -57,7 +57,7 @@ class ContextTest : public MemoryTest
_width(width), _width(width),
_height(height), _height(height),
_pbuffer(pbuffer) {} _pbuffer(pbuffer) {}
virtual osg::GraphicsContext* allocate() virtual osg::GraphicsContext* allocate()
{ {
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
@@ -65,9 +65,11 @@ class ContextTest : public MemoryTest
traits->height = _height; traits->height = _height;
traits->windowDecoration = true; traits->windowDecoration = true;
traits->pbuffer = _pbuffer; traits->pbuffer = _pbuffer;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> window = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> window = osg::GraphicsContext::createGraphicsContext(traits.get());
if (window.valid()) if (window.valid())
{ {
if (window->realize()) if (window->realize())
{ {
@@ -82,15 +84,15 @@ class ContextTest : public MemoryTest
else else
{ {
std::cerr<<"Error: Unable to create graphics context, problem with running osgViewer-"<<osgViewerGetVersion()<<", cannot create windows/pbuffers."<<std::endl; std::cerr<<"Error: Unable to create graphics context, problem with running osgViewer-"<<osgViewerGetVersion()<<", cannot create windows/pbuffers."<<std::endl;
if (_pbuffer) throw "Failed to create PixelBuffer"; if (_pbuffer) throw "Failed to create PixelBuffer";
else throw "Failed to create GraphicsWindow"; else throw "Failed to create GraphicsWindow";
} }
} }
protected: protected:
int _width; int _width;
int _height; int _height;
bool _pbuffer; bool _pbuffer;
@@ -102,19 +104,19 @@ class ContextTest : public MemoryTest
class StateAttributeObject : public GLObject class StateAttributeObject : public GLObject
{ {
public: public:
StateAttributeObject(osg::StateAttribute* sa): _attribute(sa) {} StateAttributeObject(osg::StateAttribute* sa): _attribute(sa) {}
void apply(osg::RenderInfo& renderInfo) void apply(osg::RenderInfo& renderInfo)
{ {
_attribute->apply(*renderInfo.getState()); _attribute->apply(*renderInfo.getState());
if (renderInfo.getState()->checkGLErrors(_attribute.get())) if (renderInfo.getState()->checkGLErrors(_attribute.get()))
{ {
throw "OpenGL error"; throw "OpenGL error";
} }
} }
osg::ref_ptr<osg::StateAttribute> _attribute; osg::ref_ptr<osg::StateAttribute> _attribute;
}; };
@@ -129,40 +131,40 @@ class TextureTest : public GLMemoryTest
_width(width), _width(width),
_height(height), _height(height),
_depth(depth) {} _depth(depth) {}
virtual GLObject* allocate() virtual GLObject* allocate()
{ {
if (_depth>1) if (_depth>1)
{ {
osg::ref_ptr<osg::Image> image = new osg::Image; osg::ref_ptr<osg::Image> image = new osg::Image;
image->allocateImage(_width, _height, _depth, GL_RGBA, GL_UNSIGNED_BYTE); image->allocateImage(_width, _height, _depth, GL_RGBA, GL_UNSIGNED_BYTE);
osg::ref_ptr<osg::Texture3D> texture = new osg::Texture3D; osg::ref_ptr<osg::Texture3D> texture = new osg::Texture3D;
texture->setImage(image.get()); texture->setImage(image.get());
texture->setResizeNonPowerOfTwoHint(false); texture->setResizeNonPowerOfTwoHint(false);
return new StateAttributeObject(texture.get()); return new StateAttributeObject(texture.get());
} }
if (_height>1) if (_height>1)
{ {
osg::ref_ptr<osg::Image> image = new osg::Image; osg::ref_ptr<osg::Image> image = new osg::Image;
image->allocateImage(_width, _height, 1, GL_RGBA, GL_UNSIGNED_BYTE); image->allocateImage(_width, _height, 1, GL_RGBA, GL_UNSIGNED_BYTE);
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D; osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
texture->setImage(image.get()); texture->setImage(image.get());
texture->setResizeNonPowerOfTwoHint(false); texture->setResizeNonPowerOfTwoHint(false);
return new StateAttributeObject(texture.get()); return new StateAttributeObject(texture.get());
} }
if (_width>1) if (_width>1)
{ {
osg::ref_ptr<osg::Image> image = new osg::Image; osg::ref_ptr<osg::Image> image = new osg::Image;
image->allocateImage(_width, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE); image->allocateImage(_width, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE);
osg::ref_ptr<osg::Texture1D> texture = new osg::Texture1D; osg::ref_ptr<osg::Texture1D> texture = new osg::Texture1D;
texture->setImage(image.get()); texture->setImage(image.get());
texture->setResizeNonPowerOfTwoHint(false); texture->setResizeNonPowerOfTwoHint(false);
return new StateAttributeObject(texture.get()); return new StateAttributeObject(texture.get());
} }
else else
@@ -170,10 +172,10 @@ class TextureTest : public GLMemoryTest
throw "Invalid texture size of 0,0,0"; throw "Invalid texture size of 0,0,0";
} }
} }
protected: protected:
int _width; int _width;
int _height; int _height;
int _depth; int _depth;
@@ -191,7 +193,7 @@ class FboTest : public GLMemoryTest
_width(width), _width(width),
_height(height), _height(height),
_depth(depth) {} _depth(depth) {}
virtual GLObject* allocate() virtual GLObject* allocate()
{ {
osg::ref_ptr<osg::FrameBufferObject> fbo = new osg::FrameBufferObject; osg::ref_ptr<osg::FrameBufferObject> fbo = new osg::FrameBufferObject;
@@ -201,10 +203,10 @@ class FboTest : public GLMemoryTest
return new StateAttributeObject(fbo.get()); return new StateAttributeObject(fbo.get());
} }
protected: protected:
int _width; int _width;
int _height; int _height;
int _depth; int _depth;
@@ -218,19 +220,19 @@ class FboTest : public GLMemoryTest
class DrawableObject : public GLObject class DrawableObject : public GLObject
{ {
public: public:
DrawableObject(osg::Drawable* drawable): _drawable(drawable) {} DrawableObject(osg::Drawable* drawable): _drawable(drawable) {}
void apply(osg::RenderInfo& renderInfo) void apply(osg::RenderInfo& renderInfo)
{ {
_drawable->draw(renderInfo); _drawable->draw(renderInfo);
if (renderInfo.getState()->checkGLErrors("Drawable")) if (renderInfo.getState()->checkGLErrors("Drawable"))
{ {
throw "OpenGL error"; throw "OpenGL error";
} }
} }
osg::ref_ptr<osg::Drawable> _drawable; osg::ref_ptr<osg::Drawable> _drawable;
}; };
@@ -240,20 +242,20 @@ class DrawableObject : public GLObject
class GeometryTest : public GLMemoryTest class GeometryTest : public GLMemoryTest
{ {
public: public:
enum GLObjectType enum GLObjectType
{ {
VERTEX_ARRAY, VERTEX_ARRAY,
DISPLAY_LIST, DISPLAY_LIST,
VERTEX_BUFFER_OBJECT VERTEX_BUFFER_OBJECT
}; };
GeometryTest(GLObjectType type, int width=64, int height=64): GeometryTest(GLObjectType type, int width=64, int height=64):
_glObjectType(type), _glObjectType(type),
_width(width), _width(width),
_height(height) {} _height(height) {}
virtual GLObject* allocate() virtual GLObject* allocate()
{ {
unsigned int numVertices = _width * _height; unsigned int numVertices = _width * _height;
@@ -279,11 +281,11 @@ class GeometryTest : public GLMemoryTest
quads->push_back(i + (j+1)*_width); quads->push_back(i + (j+1)*_width);
} }
} }
osg::Geometry* geometry = new osg::Geometry; osg::Geometry* geometry = new osg::Geometry;
geometry->setVertexArray(vertices); geometry->setVertexArray(vertices);
geometry->addPrimitiveSet(quads); geometry->addPrimitiveSet(quads);
switch(_glObjectType) switch(_glObjectType)
{ {
case(VERTEX_ARRAY): case(VERTEX_ARRAY):
@@ -302,10 +304,10 @@ class GeometryTest : public GLMemoryTest
return new DrawableObject(geometry); return new DrawableObject(geometry);
} }
protected: protected:
GLObjectType _glObjectType; GLObjectType _glObjectType;
int _width; int _width;
int _height; int _height;
@@ -314,7 +316,7 @@ class GeometryTest : public GLMemoryTest
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" tests OpenGL and Windowing memory scalability.."); arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" tests OpenGL and Windowing memory scalability..");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","List command line options."); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","List command line options.");
@@ -351,7 +353,7 @@ int main( int argc, char **argv )
ContextTests contextTests; ContextTests contextTests;
GLMemoryTests glMemoryTests; GLMemoryTests glMemoryTests;
int width, height, depth; int width, height, depth;
while(arguments.read("--pbuffer",width,height)) { contextTests.push_back(new ContextTest(width, height, true)); } while(arguments.read("--pbuffer",width,height)) { contextTests.push_back(new ContextTest(width, height, true)); }
while(arguments.read("--pbuffer")) { contextTests.push_back(new ContextTest(512, 512, true)); } while(arguments.read("--pbuffer")) { contextTests.push_back(new ContextTest(512, 512, true)); }
@@ -396,20 +398,20 @@ int main( int argc, char **argv )
return 1; return 1;
} }
#endif #endif
typedef std::list< osg::ref_ptr<osg::GraphicsContext> > Contexts; typedef std::list< osg::ref_ptr<osg::GraphicsContext> > Contexts;
typedef std::list< osg::ref_ptr<GLObject> > GLObjects; typedef std::list< osg::ref_ptr<GLObject> > GLObjects;
Contexts allocatedContexts; Contexts allocatedContexts;
GLObjects glObjects; GLObjects glObjects;
if (contextTests.empty()) if (contextTests.empty())
{ {
if (glMemoryTests.empty()) if (glMemoryTests.empty())
{ {
std::cout<<"No tests specified, please specify test using the command line options below."<<std::endl<<std::endl; std::cout<<"No tests specified, please specify test using the command line options below."<<std::endl<<std::endl;
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1; return 1;
} }
else else
{ {
@@ -421,14 +423,14 @@ int main( int argc, char **argv )
// use printf's below as C++'s ostream classes use more memory and are more likely to fail when everything // use printf's below as C++'s ostream classes use more memory and are more likely to fail when everything
// goes wrong with memory allocations. // goes wrong with memory allocations.
int numContextIterations = 0; int numContextIterations = 0;
int numGLObjectIterations = 0; int numGLObjectIterations = 0;
int numGLObjectsApplied = 0; int numGLObjectsApplied = 0;
try try
{ {
for(; numGLObjectIterations<maxNumGLIterations; ++numGLObjectIterations) for(; numGLObjectIterations<maxNumGLIterations; ++numGLObjectIterations)
{ {
for(GLMemoryTests::iterator itr = glMemoryTests.begin(); for(GLMemoryTests::iterator itr = glMemoryTests.begin();
itr != glMemoryTests.end(); itr != glMemoryTests.end();
++itr) ++itr)
@@ -437,7 +439,7 @@ int main( int argc, char **argv )
if (glObject.valid()) glObjects.push_back(glObject.get()); if (glObject.valid()) glObjects.push_back(glObject.get());
} }
} }
for(;numContextIterations<maxNumContextIterations; ++numContextIterations) for(;numContextIterations<maxNumContextIterations; ++numContextIterations)
{ {
printf("GraphicsContext %i\n",numContextIterations); printf("GraphicsContext %i\n",numContextIterations);
@@ -451,10 +453,10 @@ int main( int argc, char **argv )
allocatedContexts.push_back(context); allocatedContexts.push_back(context);
context->makeCurrent(); context->makeCurrent();
osg::RenderInfo renderInfo; osg::RenderInfo renderInfo;
renderInfo.setState(context->getState()); renderInfo.setState(context->getState());
for(GLObjects::iterator gitr = glObjects.begin(); for(GLObjects::iterator gitr = glObjects.begin();
gitr != glObjects.end(); gitr != glObjects.end();
++gitr) ++gitr)
@@ -466,9 +468,9 @@ int main( int argc, char **argv )
(*gitr)->apply(renderInfo); (*gitr)->apply(renderInfo);
++numGLObjectsApplied; ++numGLObjectsApplied;
} }
context->releaseContext(); context->releaseContext();
printf("\n\n"); fflush(stdout); printf("\n\n"); fflush(stdout);
} }
} }
@@ -489,7 +491,7 @@ int main( int argc, char **argv )
printf("\nSuccessful completion, contexts created = %i, gl objects applied = %i\n",numContextIterations, numGLObjectsApplied); printf("\nSuccessful completion, contexts created = %i, gl objects applied = %i\n",numContextIterations, numGLObjectsApplied);
printf("Duration = %f seconds.\n\n",osg::Timer::instance()->delta_s(startTick, endTick)); printf("Duration = %f seconds.\n\n",osg::Timer::instance()->delta_s(startTick, endTick));
return 0; return 0;
} }

View File

@@ -641,7 +641,11 @@ int main(int argc, char** argv)
if (wsi) if (wsi)
{ {
unsigned int width, height; unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); osg::GraphicsContext::ScreenIdentifier main_screen_id;
main_screen_id.readDISPLAY();
main_screen_id.setUndefinedScreenDetailsToDefaultScreen();
wsi->getScreenResolution(main_screen_id, width, height);
screenAspectRatio = float(width) / float(height); screenAspectRatio = float(width) / float(height);
} }

View File

@@ -91,7 +91,11 @@ int main( int argc, char **argv )
} }
unsigned int width, height; unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); osg::GraphicsContext::ScreenIdentifier main_screen_id;
main_screen_id.readDISPLAY();
main_screen_id.setUndefinedScreenDetailsToDefaultScreen();
wsi->getScreenResolution(main_screen_id, width, height);
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->x = 100; traits->x = 100;
@@ -101,6 +105,8 @@ int main( int argc, char **argv )
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (gc.valid()) if (gc.valid())

View File

@@ -109,8 +109,9 @@ bool PickHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapte
user_event->setName("osc_test_1"); user_event->setName("osc_test_1");
_device->sendEvent(*user_event); _device->sendEvent(*user_event);
return true;
} }
return false;
} }
default: default:
@@ -443,6 +444,8 @@ int main( int argc, char **argv )
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->windowName = "Receiver / view two"; traits->windowName = "Receiver / view two";
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
@@ -509,6 +512,8 @@ int main( int argc, char **argv )
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->windowName = "Sender / view one"; traits->windowName = "Sender / view one";
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());

View File

@@ -644,6 +644,7 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
} }
_album->setVisibility(); _album->setVisibility();
return true;
} }

View File

@@ -712,6 +712,8 @@ int main(int argc, char** argv)
traits->pbuffer = true; traits->pbuffer = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
pbuffer = osg::GraphicsContext::createGraphicsContext(traits.get()); pbuffer = osg::GraphicsContext::createGraphicsContext(traits.get());
if (pbuffer.valid()) if (pbuffer.valid())

View File

@@ -182,7 +182,11 @@ void singleWindowSideBySideCameras(osgViewer::Viewer& viewer)
} }
unsigned int width, height; unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); osg::GraphicsContext::ScreenIdentifier main_screen_id;
main_screen_id.readDISPLAY();
main_screen_id.setUndefinedScreenDetailsToDefaultScreen();
wsi->getScreenResolution(main_screen_id, width, height);
@@ -198,6 +202,8 @@ void singleWindowSideBySideCameras(osgViewer::Viewer& viewer)
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (gc.valid()) if (gc.valid())

View File

@@ -87,6 +87,8 @@ int main( int argc, char** argv )
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->glContextVersion = version; traits->glContextVersion = version;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr< osg::GraphicsContext > gc = osg::GraphicsContext::createGraphicsContext( traits.get() ); osg::ref_ptr< osg::GraphicsContext > gc = osg::GraphicsContext::createGraphicsContext( traits.get() );
if( !gc.valid() ) if( !gc.valid() )
{ {

View File

@@ -142,6 +142,8 @@ int main( int argc, char **argv )
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->pbuffer = false; traits->pbuffer = false;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!gc || !gc->valid()) if (!gc || !gc->valid())

View File

@@ -146,7 +146,11 @@ int main(int argc, char** argv)
unsigned int width, height; unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); osg::GraphicsContext::ScreenIdentifier main_screen_id;
main_screen_id.readDISPLAY();
main_screen_id.setUndefinedScreenDetailsToDefaultScreen();
wsi->getScreenResolution(main_screen_id, width, height);
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->x = 0; traits->x = 0;
@@ -155,6 +159,8 @@ int main(int argc, char** argv)
traits->height = height; traits->height = height;
traits->windowDecoration = false; traits->windowDecoration = false;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!gc) if (!gc)

View File

@@ -140,7 +140,8 @@ END_EVENT_TABLE()
OSGCanvas::OSGCanvas(wxWindow *parent, wxWindowID id, OSGCanvas::OSGCanvas(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name, int *attributes) const wxPoint& pos, const wxSize& size, long style, const wxString& name, int *attributes)
: wxGLCanvas(parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name, attributes) : wxGLCanvas(parent, id, attributes, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name)
,_context(this)
{ {
// default cursor to standard // default cursor to standard
_oldCursor = *wxSTANDARD_CURSOR; _oldCursor = *wxSTANDARD_CURSOR;
@@ -150,6 +151,11 @@ OSGCanvas::~OSGCanvas()
{ {
} }
void OSGCanvas::SetContextCurrent()
{
_context.SetCurrent(*this);
}
void OSGCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) ) void OSGCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
{ {
/* must always be here */ /* must always be here */
@@ -158,8 +164,6 @@ void OSGCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
void OSGCanvas::OnSize(wxSizeEvent& event) void OSGCanvas::OnSize(wxSizeEvent& event)
{ {
// this is also necessary to update the context on some platforms
wxGLCanvas::OnSize(event);
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...) // set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
int width, height; int width, height;
@@ -337,7 +341,7 @@ void GraphicsWindowWX::useCursor(bool cursorOn)
bool GraphicsWindowWX::makeCurrentImplementation() bool GraphicsWindowWX::makeCurrentImplementation()
{ {
_canvas->SetCurrent(); _canvas->SetContextCurrent();
return true; return true;
} }

View File

@@ -38,12 +38,14 @@ public:
void UseCursor(bool value); void UseCursor(bool value);
void SetContextCurrent();
private: private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
osg::ref_ptr<osgViewer::GraphicsWindow> _graphics_window; osg::ref_ptr<osgViewer::GraphicsWindow> _graphics_window;
wxCursor _oldCursor; wxCursor _oldCursor;
wxGLContext _context;
}; };
class GraphicsWindowWX : public osgViewer::GraphicsWindow class GraphicsWindowWX : public osgViewer::GraphicsWindow

View File

@@ -25,6 +25,7 @@ class EscapeHandler : public osgGA::GUIEventHandler
return true; return true;
} }
break;
} }
default: default:
@@ -95,7 +96,7 @@ int main(int argc,char** argv)
// add a custom escape handler, but disable the standard viewer one to enable the vnc images to handle // add a custom escape handler, but disable the standard viewer one to enable the vnc images to handle
// the escape without it getting caught by the viewer. // the escape without it getting caught by the viewer.
viewer.addEventHandler(new EscapeHandler); viewer.addEventHandler(new EscapeHandler);
viewer.setKeyEventSetsDone(0); viewer.setKeyEventSetsDone(0);
return viewer.run(); return viewer.run();

View File

@@ -58,6 +58,8 @@ int main( int argc, char **argv )
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
@@ -82,6 +84,8 @@ int main( int argc, char **argv )
traits->windowDecoration = true; traits->windowDecoration = true;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->sharedContext = 0; traits->sharedContext = 0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());

View File

@@ -365,11 +365,21 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
void (GL_APIENTRY * glUniformMatrix4x3dv)( GLint location, GLsizei count, GLboolean transpose, const GLdouble* value ); void (GL_APIENTRY * glUniformMatrix4x3dv)( GLint location, GLsizei count, GLboolean transpose, const GLdouble* value );
void (GL_APIENTRY * glGetActiveAtomicCounterBufferiv)( GLuint program, GLuint bufferIndex, GLenum pname, GLint* params ); void (GL_APIENTRY * glGetActiveAtomicCounterBufferiv)( GLuint program, GLuint bufferIndex, GLenum pname, GLint* params );
void (GL_APIENTRY * glDispatchCompute)( GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ ); void (GL_APIENTRY * glDispatchCompute)( GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ );
GLuint64 (GL_APIENTRY* glGetTextureHandle)(GLint texture);
void (GL_APIENTRY* glMakeTextureHandleResident)(GLuint64 handle); // ARB_bindless_texture
void (GL_APIENTRY* glMakeTextureHandleNonResident)(GLuint64 handle); GLuint64 (GL_APIENTRY* glGetTextureHandle)(GLuint texture);
void (GL_APIENTRY* glUniformHandleui64)(GLint location, GLuint64 handle); GLuint64 (GL_APIENTRY* glGetTextureSamplerHandle)(GLuint texture, GLuint sampler);
GLboolean (GL_APIENTRY* glIsTextureHandleResident)(GLuint64 handle); void (GL_APIENTRY* glMakeTextureHandleResident)(GLuint64 handle);
void (GL_APIENTRY* glMakeTextureHandleNonResident)(GLuint64 handle);
GLboolean (GL_APIENTRY* glIsTextureHandleResident)(GLuint64 handle);
GLuint64 (GL_APIENTRY* glGetImageHandle)(GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
void (GL_APIENTRY* glMakeImageHandleResident)(GLuint64 handle);
void (GL_APIENTRY* glMakeImageHandleNonResident)(GLuint64 handle);
GLboolean (GL_APIENTRY* glIsImageHandleResident)(GLuint64 handle);
void (GL_APIENTRY* glUniformHandleui64)(GLint location, GLuint64 handle);
void (GL_APIENTRY* glUniformHandleuiv64)(GLint location, GLsizei count, GLuint64 *handles);
void (GL_APIENTRY* glProgramUniformHandleui64)(GLuint program, GLint location, GLuint64 handle);
void (GL_APIENTRY* glProgramUniformHandleuiv64)(GLuint program, GLint location, GLsizei count, GLuint64 *handles);
// Buffer Object extensions // Buffer Object extensions
bool isBufferObjectSupported; bool isBufferObjectSupported;
@@ -538,7 +548,17 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
isNonPowerOfTwoTextureMipMappedSupported; isNonPowerOfTwoTextureMipMappedSupported;
} }
void (GL_APIENTRY * glTexStorage2D) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); ///immutable texture storage and texture view
void (GL_APIENTRY * glTexStorage1D) (GLenum target, GLsizei numMipmapLevels, GLenum internalformat, GLsizei width);
void (GL_APIENTRY * glTextureStorage1D) (GLuint texture, GLsizei numMipmapLevels, GLenum internalformat, GLsizei width);
void (GL_APIENTRY * glTexStorage2D) (GLenum target, GLsizei numMipmapLevels, GLenum internalformat, GLsizei width, GLsizei height);
void (GL_APIENTRY * glTextureStorage2D) (GLuint texture, GLsizei numMipmapLevels, GLenum internalformat, GLsizei width, GLsizei height);
void (GL_APIENTRY * glTexStorage3D) ( GLenum target, GLsizei numMipmapLevels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
void (GL_APIENTRY * glTextureStorage3D) ( GLuint texture, GLsizei numMipmapLevels,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth);
void (GL_APIENTRY * glTexStorage2DMultisample) ( GLenum target, GLsizei numSamples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
void (GL_APIENTRY * glTexStorage3DMultisample) ( GLenum target, GLsizei numSamples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
void (GL_APIENTRY * glTextureView) ( GLuint texture, GLenum target, GLuint orig, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
void (GL_APIENTRY * glCompressedTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); void (GL_APIENTRY * glCompressedTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
void (GL_APIENTRY * glCompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); void (GL_APIENTRY * glCompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
void (GL_APIENTRY * glGetCompressedTexImage) (GLenum target, GLint level, GLvoid *data); void (GL_APIENTRY * glGetCompressedTexImage) (GLenum target, GLint level, GLvoid *data);
@@ -557,8 +577,6 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
void (GL_APIENTRY * glTexImage3D) ( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); void (GL_APIENTRY * glTexImage3D) ( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
void (GL_APIENTRY * glTexSubImage3D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); void (GL_APIENTRY * glTexSubImage3D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
void (GL_APIENTRY * glTexStorage3D) ( GLenum target, GLsizei numMipmapLevels,GLenum sizedInternalFormat,GLsizei width,GLsizei height,GLsizei depth);
void (GL_APIENTRY * glTextureStorage3D) ( GLuint texture, GLsizei numMipmapLevels,GLenum sizedInternalFormat,GLsizei width,GLsizei height,GLsizei depth);
void (GL_APIENTRY * glCopyTexSubImage3D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); void (GL_APIENTRY * glCopyTexSubImage3D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
void (GL_APIENTRY * glCompressedTexImage3D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); void (GL_APIENTRY * glCompressedTexImage3D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);

View File

@@ -327,7 +327,7 @@ class OSG_EXPORT Matrixd
inline Vec4f operator* ( const Vec4f& v ) const; inline Vec4f operator* ( const Vec4f& v ) const;
inline Vec4d operator* ( const Vec4d& v ) const; inline Vec4d operator* ( const Vec4d& v ) const;
#ifdef USE_DEPRECATED_API #ifdef OSG_USE_DEPRECATED_API
inline void set(const Quat& q) { makeRotate(q); } /// deprecated, replace with makeRotate(q) inline void set(const Quat& q) { makeRotate(q); } /// deprecated, replace with makeRotate(q)
inline void get(Quat& q) const { q = getRotate(); } /// deprecated, replace with getRotate() inline void get(Quat& q) const { q = getRotate(); } /// deprecated, replace with getRotate()
#endif #endif

View File

@@ -328,7 +328,7 @@ class OSG_EXPORT Matrixf
inline Vec4f operator* ( const Vec4f& v ) const; inline Vec4f operator* ( const Vec4f& v ) const;
inline Vec4d operator* ( const Vec4d& v ) const; inline Vec4d operator* ( const Vec4d& v ) const;
#ifdef USE_DEPRECATED_API #ifdef OSG_USE_DEPRECATED_API
inline void set(const Quat& q) { makeRotate(q); } inline void set(const Quat& q) { makeRotate(q); }
inline void get(Quat& q) const { q = getRotate(); } inline void get(Quat& q) const { q = getRotate(); }
#endif #endif

View File

@@ -306,6 +306,7 @@ class OSG_EXPORT Shader : public osg::Object
/** osg::Programs that this osg::Shader is attached to */ /** osg::Programs that this osg::Shader is attached to */
typedef std::set< osg::Program* > ProgramSet; typedef std::set< osg::Program* > ProgramSet;
ProgramSet _programSet; ProgramSet _programSet;
OpenThreads::Mutex _programSetMutex;
mutable osg::buffered_value< osg::ref_ptr<ShaderObjects> > _pcsList; mutable osg::buffered_value< osg::ref_ptr<ShaderObjects> > _pcsList;
private: private:

View File

@@ -652,8 +652,10 @@ class OSG_EXPORT Texture : public osg::StateAttribute
/** Get the internal texture format type. */ /** Get the internal texture format type. */
inline InternalFormatType getInternalFormatType() const { return _internalFormatType; } inline InternalFormatType getInternalFormatType() const { return _internalFormatType; }
class TextureObject; /* select the size internal format to use based on Image when available or Texture format settings.*/
GLenum selectSizedInternalFormat(const osg::Image* image=0) const;
class TextureObject;
/** return true if the texture image data has been modified and the associated GL texture object needs to be updated.*/ /** return true if the texture image data has been modified and the associated GL texture object needs to be updated.*/
virtual bool isDirty(unsigned int /*contextID*/) const { return false; } virtual bool isDirty(unsigned int /*contextID*/) const { return false; }

View File

@@ -123,7 +123,7 @@ public:
bool operator == (const observer_ptr& wp) const { return _reference == wp._reference; } bool operator == (const observer_ptr& wp) const { return _reference == wp._reference; }
bool operator != (const observer_ptr& wp) const { return _reference != wp._reference; } bool operator != (const observer_ptr& wp) const { return _reference != wp._reference; }
bool operator < (const observer_ptr& wp) const { return _reference < wp._reference; } bool operator < (const observer_ptr& wp) const { return _reference < wp._reference; }
bool operator > (const observer_ptr& wp) const { return _reference > wp._reference; } bool operator > (const observer_ptr& wp) const { return wp._reference < _reference; }
// Non-strict interface, for compatibility // Non-strict interface, for compatibility
// comparison operator for const T*. // comparison operator for const T*.

View File

@@ -551,21 +551,24 @@ public:
}; };
template<typename C, typename P> template<typename C, typename P>
class ObjectSerializer : public TemplateSerializer<P*> class ObjectSerializer : public BaseSerializer
{ {
public: public:
typedef TemplateSerializer<P*> ParentType;
typedef const P* (C::*Getter)() const; typedef const P* (C::*Getter)() const;
typedef void (C::*Setter)( P* ); typedef void (C::*Setter)( P* );
ObjectSerializer( const char* name, P* def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf) ObjectSerializer( const char* name, P* def, Getter gf, Setter sf ) :
BaseSerializer(READ_WRITE_PROPERTY),
_name(name), _defaultValue(def), _getter(gf), _setter(sf)
{ {
ParentType::setUsage( _getter!=0, _setter!=0); setUsage( _getter!=0, _setter!=0);
} }
virtual bool set(osg::Object& obj, void* value) { C& object = OBJECT_CAST<C&>(obj); (object.*_setter)( dynamic_cast<P*>(*(reinterpret_cast<osg::Object**>(value))) ); return true; } virtual bool set(osg::Object& obj, void* value) { C& object = OBJECT_CAST<C&>(obj); (object.*_setter)( dynamic_cast<P*>(*(reinterpret_cast<osg::Object**>(value))) ); return true; }
virtual bool get(const osg::Object& obj, void* value) { const C& object = OBJECT_CAST<const C&>(obj);*(reinterpret_cast<const osg::Object**>(value )) = dynamic_cast<const osg::Object*>((object.*_getter)()); return true; } virtual bool get(const osg::Object& obj, void* value) { const C& object = OBJECT_CAST<const C&>(obj);*(reinterpret_cast<const osg::Object**>(value )) = dynamic_cast<const osg::Object*>((object.*_getter)()); return true; }
virtual const std::string& getName() const { return _name; }
virtual bool read( InputStream& is, osg::Object& obj ) virtual bool read( InputStream& is, osg::Object& obj )
{ {
C& object = OBJECT_CAST<C&>(obj); C& object = OBJECT_CAST<C&>(obj);
@@ -579,7 +582,7 @@ public:
(object.*_setter)( value.get() ); (object.*_setter)( value.get() );
} }
} }
else if ( is.matchString(ParentType::_name) ) else if ( is.matchString(_name) )
{ {
is >> hasObject; is >> hasObject;
if ( hasObject ) if ( hasObject )
@@ -606,9 +609,9 @@ public:
os.writeObject( value ); os.writeObject( value );
} }
} }
else if ( ParentType::_defaultValue!=value ) else if ( _defaultValue!=value )
{ {
os << os.PROPERTY((ParentType::_name).c_str()) << hasObject; os << os.PROPERTY(_name.c_str()) << hasObject;
if ( hasObject ) if ( hasObject )
{ {
os << os.BEGIN_BRACKET << std::endl; os << os.BEGIN_BRACKET << std::endl;
@@ -621,8 +624,10 @@ public:
} }
public: public:
Getter _getter; std::string _name;
Setter _setter; osg::ref_ptr<P> _defaultValue;
Getter _getter;
Setter _setter;
}; };
template<typename C, typename P> template<typename C, typename P>

View File

@@ -105,9 +105,9 @@ class OSGDB_EXPORT XmlNode : public osg::Referenced
size_type currentPosition() const { return _currentPos; } size_type currentPosition() const { return _currentPos; }
int get() { if (_currentPos<_buffer.size()) return _buffer[_currentPos++]; else return -1; } int get() { if (_currentPos<_buffer.size()) return static_cast<unsigned char>(_buffer[_currentPos++]); else return -1; }
int operator [] (size_type i) const { if ((_currentPos+i)<_buffer.size()) return _buffer[_currentPos+i]; else return -1; } int operator [] (size_type i) const { if ((_currentPos+i)<_buffer.size()) return static_cast<unsigned char>(_buffer[_currentPos+i]); else return -1; }
void operator ++ () { if (_currentPos<_buffer.size()) ++_currentPos; } void operator ++ () { if (_currentPos<_buffer.size()) ++_currentPos; }
@@ -129,12 +129,56 @@ class OSGDB_EXPORT XmlNode : public osg::Referenced
bool match(const std::string& str) { return (_currentPos<_buffer.size()) ? _buffer.compare(_currentPos, str.size(), str)==0 : false; } bool match(const std::string& str) { return (_currentPos<_buffer.size()) ? _buffer.compare(_currentPos, str.size(), str)==0 : false; }
enum Encoding
{
ENCODING_ASCII,
ENCODING_UTF8
};
void setEncoding(Encoding encoding) { _encoding = encoding; }
Encoding getEncoding() const { return _encoding; }
inline void copyCharacterToString(std::string& str)
{
if (_currentPos>=_buffer.size()) return;
switch (_encoding)
{
case(ENCODING_UTF8) :
{
int char0 = static_cast<unsigned char>(_buffer[_currentPos]); ++_currentPos;
str.push_back(char0);
if (char0 < 0x80 || _currentPos>=_buffer.size()) break; // 1-byte character
str.push_back(_buffer[_currentPos]); ++_currentPos;
if (char0<0xe0 || _currentPos<_buffer.size()) break; // 2-byte character
str.push_back(_buffer[_currentPos]); ++_currentPos;
if (char0<0xf0 || _currentPos>=_buffer.size()) break; // 3-byte character
str.push_back(_buffer[_currentPos]); ++_currentPos;
if (char0<0xf8 || _currentPos>=_buffer.size()) break; // 4-byte character
if (_currentPos>=_buffer.size()) break;
str.push_back(_buffer[_currentPos]); ++_currentPos; // 5-byte character?
break;
}
case(ENCODING_ASCII) :
default:
str.push_back(_buffer[_currentPos]);
++_currentPos;
return;
}
}
private: private:
size_type _currentPos; size_type _currentPos;
std::ifstream _fin; std::ifstream _fin;
std::string _buffer; std::string _buffer;
Encoding _encoding;
}; };

View File

@@ -162,7 +162,6 @@ class OSGGA_EXPORT CameraManipulator : public GUIEventHandler
/** /**
Start/restart the manipulator. Start/restart the manipulator.
FIXME: what does this actually mean? Provide examples.
*/ */
virtual void init(const GUIEventAdapter& ,GUIActionAdapter&) {} virtual void init(const GUIEventAdapter& ,GUIActionAdapter&) {}

View File

@@ -28,7 +28,7 @@
#include <osgText/KerningType> #include <osgText/KerningType>
#include <osgText/Style> #include <osgText/Style>
#include <OpenThreads/Mutex> #include <OpenThreads/ReentrantMutex>
namespace osgText { namespace osgText {
@@ -126,6 +126,8 @@ protected:
typedef std::vector< osg::ref_ptr<TextureInfo> > TextureInfoList; typedef std::vector< osg::ref_ptr<TextureInfo> > TextureInfoList;
TextureInfoList _textureInfoList; TextureInfoList _textureInfoList;
mutable OpenThreads::ReentrantMutex _textureInfoListMutex;
}; };
class OSGTEXT_EXPORT GlyphGeometry : public osg::Referenced class OSGTEXT_EXPORT GlyphGeometry : public osg::Referenced

View File

@@ -20,6 +20,11 @@ SET(TARGET_SRC
../common/Version.cpp ../common/Version.cpp
../common/Atomic.cpp ../common/Atomic.cpp
) )
IF(CYGWIN) # define for pthread_{yield,getconcurrency,setconcurrency}
ADD_DEFINITIONS(-D_GNU_SOURCE)
ENDIF()
IF(ANDROID) IF(ANDROID)
ADD_DEFINITIONS(-D_GNU_SOURCE) ADD_DEFINITIONS(-D_GNU_SOURCE)
SET(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE") SET(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE")

View File

@@ -256,7 +256,8 @@ Drawable::Drawable(const Drawable& drawable,const CopyOp& copyop):
Drawable::~Drawable() Drawable::~Drawable()
{ {
dirtyGLObjects(); _stateset = 0;
Drawable::releaseGLObjects();
} }
osg::MatrixList Drawable::getWorldMatrices(const osg::Node* haltTraversalAtNode) const osg::MatrixList Drawable::getWorldMatrices(const osg::Node* haltTraversalAtNode) const
@@ -340,7 +341,26 @@ void Drawable::releaseGLObjects(State* state) const
} }
else else
{ {
const_cast<Drawable*>(this)->dirtyGLObjects(); #ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
for(unsigned int i=0;i<_globjList.size();++i)
{
if (_globjList[i] != 0)
{
Drawable::deleteDisplayList(i,_globjList[i], getGLObjectSizeHint());
_globjList[i] = 0;
}
}
#endif
for(unsigned int i=0; i<_vertexArrayStateList.size(); ++i)
{
VertexArrayState* vas = _vertexArrayStateList[i].get();
if (vas)
{
vas->release();
_vertexArrayStateList[i] = 0;
}
}
} }
} }
@@ -434,9 +454,8 @@ void Drawable::setUseVertexBufferObjects(bool flag)
void Drawable::dirtyGLObjects() void Drawable::dirtyGLObjects()
{ {
unsigned int i;
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE #ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
for(i=0;i<_globjList.size();++i) for(unsigned int i=0;i<_globjList.size();++i)
{ {
if (_globjList[i] != 0) if (_globjList[i] != 0)
{ {
@@ -446,7 +465,7 @@ void Drawable::dirtyGLObjects()
} }
#endif #endif
for(i=0; i<_vertexArrayStateList.size(); ++i) for(unsigned int i=0; i<_vertexArrayStateList.size(); ++i)
{ {
VertexArrayState* vas = _vertexArrayStateList[i].get(); VertexArrayState* vas = _vertexArrayStateList[i].get();
if (vas) vas->dirty(); if (vas) vas->dirty();

View File

@@ -399,17 +399,6 @@ OSG_INIT_SINGLETON_PROXY(GLExtensionDisableStringInitializationProxy, osg::getGL
#elif defined (__linux__) #elif defined (__linux__)
typedef void (*__GLXextFuncPtr)(void);
typedef __GLXextFuncPtr (*GetProcAddressARBProc)(const char*);
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
static GetProcAddressARBProc s_glXGetProcAddressARB = convertPointerType<GetProcAddressARBProc, void*>(dlsym(0, "glXGetProcAddressARB"));
if (s_glXGetProcAddressARB)
{
return convertPointerType<void*, __GLXextFuncPtr>((s_glXGetProcAddressARB)(funcName));
}
#endif
return dlsym(0, funcName); return dlsym(0, funcName);
#elif defined (__QNX__) #elif defined (__QNX__)
@@ -913,18 +902,6 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
{ {
maxTextureSize = osg_max_size; maxTextureSize = osg_max_size;
} }
setGLExtensionFuncPtr(glTexStorage2D,"glTexStorage2D","glTexStorage2DARB", validContext);
setGLExtensionFuncPtr(glCompressedTexImage2D,"glCompressedTexImage2D","glCompressedTexImage2DARB", validContext);
setGLExtensionFuncPtr(glCompressedTexSubImage2D,"glCompressedTexSubImage2D","glCompressedTexSubImage2DARB", validContext);
setGLExtensionFuncPtr(glGetCompressedTexImage,"glGetCompressedTexImage","glGetCompressedTexImageARB", validContext);;
setGLExtensionFuncPtr(glTexImage2DMultisample, "glTexImage2DMultisample", "glTexImage2DMultisampleARB", validContext);
setGLExtensionFuncPtr(glTexParameterIiv, "glTexParameterIiv", "glTexParameterIivARB", "glTexParameterIivEXT", validContext);
setGLExtensionFuncPtr(glTexParameterIuiv, "glTexParameterIuiv", "glTexParameterIuivARB", "glTexParameterIuivEXT", validContext);
setGLExtensionFuncPtr(glBindImageTexture, "glBindImageTexture", "glBindImageTextureARB", validContext);
isTextureMaxLevelSupported = (glVersion >= 1.2f); isTextureMaxLevelSupported = (glVersion >= 1.2f);
isTextureStorageEnabled = validContext && ((glVersion >= 4.2f) || isGLExtensionSupported(contextID, "GL_ARB_texture_storage")); isTextureStorageEnabled = validContext && ((glVersion >= 4.2f) || isGLExtensionSupported(contextID, "GL_ARB_texture_storage"));
@@ -939,6 +916,27 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
} }
} }
setGLExtensionFuncPtr(glTexStorage1D,"glTexStorage1D","glTexStorage1DARB", validContext);
setGLExtensionFuncPtr(glTextureStorage1D,"glTextureStorage1D","glTextureStorage1DARB", validContext);
setGLExtensionFuncPtr(glTexStorage2D,"glTexStorage2D","glTexStorage2DARB", validContext);
setGLExtensionFuncPtr(glTextureStorage2D,"glTextureStorage2D","glTextureStorage2DARB", validContext);
setGLExtensionFuncPtr(glTexStorage3D, "glTexStorage3D","glTexStorage3DEXT", validContext);
setGLExtensionFuncPtr(glTextureStorage3D, "glTextureStorage3D","glTextureStorage3DEXT", validContext);
setGLExtensionFuncPtr(glTexStorage2DMultisample, "glTextureStorage2DMultisample","glTextureStorage2DMultisampleEXT", validContext);
setGLExtensionFuncPtr(glTexStorage3DMultisample, "glTextureStorage3DMultisample","glTextureStorage3DMultisampleEXT", validContext);
setGLExtensionFuncPtr(glTextureView, "glTextureView","glTextureViewEXT", validContext);
setGLExtensionFuncPtr(glCompressedTexImage2D,"glCompressedTexImage2D","glCompressedTexImage2DARB", validContext);
setGLExtensionFuncPtr(glCompressedTexSubImage2D,"glCompressedTexSubImage2D","glCompressedTexSubImage2DARB", validContext);
setGLExtensionFuncPtr(glGetCompressedTexImage,"glGetCompressedTexImage","glGetCompressedTexImageARB", validContext);;
setGLExtensionFuncPtr(glTexImage2DMultisample, "glTexImage2DMultisample", "glTexImage2DMultisampleARB", validContext);
setGLExtensionFuncPtr(glTexParameterIiv, "glTexParameterIiv", "glTexParameterIivARB", "glTexParameterIivEXT", validContext);
setGLExtensionFuncPtr(glTexParameterIuiv, "glTexParameterIuiv", "glTexParameterIuivARB", "glTexParameterIuivEXT", validContext);
setGLExtensionFuncPtr(glBindImageTexture, "glBindImageTexture", "glBindImageTextureARB", validContext);
// Texture3D extensions // Texture3D extensions
isTexture3DFast = validContext && (OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_EXT_texture3D")); isTexture3DFast = validContext && (OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_EXT_texture3D"));
@@ -950,8 +948,6 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
setGLExtensionFuncPtr(glTexImage3D, "glTexImage3D","glTexImage3DEXT", validContext); setGLExtensionFuncPtr(glTexImage3D, "glTexImage3D","glTexImage3DEXT", validContext);
setGLExtensionFuncPtr(glTexSubImage3D, "glTexSubImage3D","glTexSubImage3DEXT", validContext); setGLExtensionFuncPtr(glTexSubImage3D, "glTexSubImage3D","glTexSubImage3DEXT", validContext);
setGLExtensionFuncPtr(glTexStorage3D, "glTexStorage3D","glTexStorage3DEXT", validContext);
setGLExtensionFuncPtr(glTextureStorage3D, "glTextureStorage3D","glTextureStorage3DEXT", validContext);
setGLExtensionFuncPtr(glCompressedTexImage3D, "glCompressedTexImage3D","glCompressedTexImage3DARB", validContext); setGLExtensionFuncPtr(glCompressedTexImage3D, "glCompressedTexImage3D","glCompressedTexImage3DARB", validContext);
setGLExtensionFuncPtr(glCompressedTexSubImage3D, "glCompressedTexSubImage3D","glCompressedTexSubImage3DARB", validContext); setGLExtensionFuncPtr(glCompressedTexSubImage3D, "glCompressedTexSubImage3D","glCompressedTexSubImage3DARB", validContext);
@@ -971,12 +967,21 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
maxLayerCount = 0; maxLayerCount = 0;
if (validContext) glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &maxLayerCount); if (validContext) glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &maxLayerCount);
// Bindless textures // ARB_bindless_texture
setGLExtensionFuncPtr(glGetTextureHandle, "glGetTextureHandle", "glGetTextureHandleARB","glGetTextureHandleNV", validContext); setGLExtensionFuncPtr(glGetTextureHandle, "glGetTextureHandle", "glGetTextureHandleARB","glGetTextureHandleNV", validContext);
setGLExtensionFuncPtr(glGetTextureSamplerHandle, "glGetTextureSamplerHandle","glGetTextureSamplerHandleARB", "glGetTextureSamplerHandleNV", validContext);
setGLExtensionFuncPtr(glMakeTextureHandleResident, "glMakeTextureHandleResident", "glMakeTextureHandleResidentARB","glMakeTextureHandleResidentNV", validContext); setGLExtensionFuncPtr(glMakeTextureHandleResident, "glMakeTextureHandleResident", "glMakeTextureHandleResidentARB","glMakeTextureHandleResidentNV", validContext);
setGLExtensionFuncPtr(glMakeTextureHandleNonResident, "glMakeTextureHandleNonResident", "glMakeTextureHandleNonResidentARB", "glMakeTextureHandleNonResidentNV",validContext); setGLExtensionFuncPtr(glMakeTextureHandleNonResident, "glMakeTextureHandleNonResident", "glMakeTextureHandleNonResidentARB", "glMakeTextureHandleNonResidentNV",validContext);
setGLExtensionFuncPtr(glUniformHandleui64, "glUniformHandleui64", "glUniformHandleui64ARB","glUniformHandleui64NV", validContext);
setGLExtensionFuncPtr(glIsTextureHandleResident, "glIsTextureHandleResident","glIsTextureHandleResidentARB", "glIsTextureHandleResidentNV", validContext); setGLExtensionFuncPtr(glIsTextureHandleResident, "glIsTextureHandleResident","glIsTextureHandleResidentARB", "glIsTextureHandleResidentNV", validContext);
setGLExtensionFuncPtr(glGetImageHandle, "glGetImageHandle","glGetImageHandleARB", "glGetImageHandleNV", validContext);
setGLExtensionFuncPtr(glMakeImageHandleResident, "glMakeImageHandleResident","glMakeImageHandleResidentARB", "glMakeImageHandleResidentNV", validContext);
setGLExtensionFuncPtr(glMakeImageHandleNonResident, "glMakeImageHandleNonResident","glMakeImageHandleNonResidentARB", "glMakeImageHandleNonResidentNV", validContext);
setGLExtensionFuncPtr(glIsImageHandleResident, "glIsImageHandleResident","glIsImageHandleResidentARB", "glIsImageHandleResidentNV", validContext);
setGLExtensionFuncPtr(glUniformHandleui64, "glUniformHandleui64", "glUniformHandleui64ARB","glUniformHandleui64NV", validContext);
setGLExtensionFuncPtr(glUniformHandleuiv64, "glUniformHandleuiv64","glUniformHandleuiv64ARB", "glUniformHandleuiv64NV", validContext);
setGLExtensionFuncPtr(glProgramUniformHandleui64, "glProgramUniformHandleui64","glProgramUniformHandleui64ARB", "glProgramUniformHandleui64NV", validContext);
setGLExtensionFuncPtr(glProgramUniformHandleuiv64, "glProgramUniformHandleuiv64","glProgramUniformHandleuiv64ARB", "glProgramUniformHandleuiv64NV", validContext);
// Blending // Blending
isBlendColorSupported = validContext && isBlendColorSupported = validContext &&
@@ -1054,9 +1059,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
isPointSpriteSupported = validContext && (OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES || isGLExtensionSupported(contextID, "GL_ARB_point_sprite") || isGLExtensionSupported(contextID, "GL_OES_point_sprite") || isGLExtensionSupported(contextID, "GL_NV_point_sprite")); isPointSpriteSupported = validContext && (OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES || isGLExtensionSupported(contextID, "GL_ARB_point_sprite") || isGLExtensionSupported(contextID, "GL_OES_point_sprite") || isGLExtensionSupported(contextID, "GL_NV_point_sprite"));
isPointSpriteModeSupported = isPointSpriteSupported && !OSG_GL3_FEATURES; isPointSpriteModeSupported = isPointSpriteSupported && !OSG_GL3_FEATURES;
isPointSpriteCoordOriginSupported = validContext && (OSG_GL3_FEATURES || (glVersion >= 2.0f)); isPointSpriteCoordOriginSupported = validContext && (OSG_GL3_FEATURES || (glVersion >= 2.0f));

View File

@@ -82,10 +82,8 @@ Geometry::Geometry(const Geometry& geometry,const CopyOp& copyop):
Geometry::~Geometry() Geometry::~Geometry()
{ {
// do dirty here to keep the getGLObjectSizeHint() estimate on the ball _stateset = 0;
dirtyGLObjects(); Geometry::releaseGLObjects();
// no need to delete, all automatically handled by ref_ptr :-)
} }
#define ARRAY_NOT_EMPTY(array) (array!=0 && array->getNumElements()!=0) #define ARRAY_NOT_EMPTY(array) (array!=0 && array->getNumElements()!=0)

View File

@@ -1518,7 +1518,7 @@ void Image::swap(osg::Image& rhs)
void Image::scaleImage(int s,int t,int r, GLenum newDataType) void Image::scaleImage(int s,int t,int r, GLenum newDataType)
{ {
if (_s==s && _t==t && _r==r) return; if (_s==s && _t==t && _r==r && _dataType==newDataType) return;
if (_data==NULL) if (_data==NULL)
{ {

View File

@@ -492,6 +492,8 @@ KdTree::KdTree(const KdTree& rhs, const osg::CopyOp& copyop):
Shape(rhs, copyop), Shape(rhs, copyop),
_degenerateCount(rhs._degenerateCount), _degenerateCount(rhs._degenerateCount),
_vertices(rhs._vertices), _vertices(rhs._vertices),
_primitiveIndices(rhs._primitiveIndices),
_vertexIndices(rhs._vertexIndices),
_kdNodes(rhs._kdNodes) _kdNodes(rhs._kdNodes)
{ {
} }

View File

@@ -483,6 +483,7 @@ Shader::PerContextShader* Shader::getPCS(osg::State& state) const
bool Shader::addProgramRef( Program* program ) bool Shader::addProgramRef( Program* program )
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> lk(_programSetMutex);
ProgramSet::iterator itr = _programSet.find(program); ProgramSet::iterator itr = _programSet.find(program);
if( itr != _programSet.end() ) return false; if( itr != _programSet.end() ) return false;
@@ -492,6 +493,7 @@ bool Shader::addProgramRef( Program* program )
bool Shader::removeProgramRef( Program* program ) bool Shader::removeProgramRef( Program* program )
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> lk(_programSetMutex);
ProgramSet::iterator itr = _programSet.find(program); ProgramSet::iterator itr = _programSet.find(program);
if( itr == _programSet.end() ) return false; if( itr == _programSet.end() ) return false;
@@ -507,6 +509,7 @@ void Shader::dirtyShader()
if( _pcsList[cxt].valid() ) _pcsList[cxt]->requestCompile(); if( _pcsList[cxt].valid() ) _pcsList[cxt]->requestCompile();
} }
OpenThreads::ScopedLock<OpenThreads::Mutex> lk(_programSetMutex);
// Also mark Programs that depend on us as needing relink. // Also mark Programs that depend on us as needing relink.
for( ProgramSet::iterator itr = _programSet.begin(); for( ProgramSet::iterator itr = _programSet.begin();
itr != _programSet.end(); ++itr ) itr != _programSet.end(); ++itr )

View File

@@ -13,6 +13,7 @@
#include <osg/ShapeDrawable> #include <osg/ShapeDrawable>
#include <osg/GL> #include <osg/GL>
#include <osg/Notify> #include <osg/Notify>
#include <osg/KdTree>
using namespace osg; using namespace osg;
@@ -76,6 +77,9 @@ void ShapeDrawable::setTessellationHints(TessellationHints* hints)
void ShapeDrawable::build() void ShapeDrawable::build()
{ {
// we can't create a tessellation for a KdTree
if (dynamic_cast<KdTree*>(_shape.get())!=0) return;
// reset all the properties. // reset all the properties.
setVertexArray(0); setVertexArray(0);
setNormalArray(0); setNormalArray(0);

View File

@@ -18,6 +18,7 @@
#include <osg/Drawable> #include <osg/Drawable>
#include <osg/ApplicationUsage> #include <osg/ApplicationUsage>
#include <osg/ContextData> #include <osg/ContextData>
#include <osg/PointSprite>
#include <osg/os_utils> #include <osg/os_utils>
#include <sstream> #include <sstream>
@@ -285,6 +286,17 @@ void State::initializeExtensionProcs()
} }
} }
// set the validity of Modes
{
bool pointSpriteModeValid = _glExtensions->isPointSpriteModeSupported;
#if defined( OSG_GLES1_AVAILABLE ) //point sprites don't exist on es 2.0
setModeValidity(GL_POINT_SPRITE_OES, pointSpriteModeValid);
#else
setModeValidity(GL_POINT_SPRITE_ARB, pointSpriteModeValid);
#endif
}
_extensionProcsInitialized = true; _extensionProcsInitialized = true;

View File

@@ -137,6 +137,7 @@ InternalPixelRelations sizedInternalFormats[] = {
, { GL_RGBA8 , GL_RGBA , GL_UNSIGNED_BYTE } , { GL_RGBA8 , GL_RGBA , GL_UNSIGNED_BYTE }
, { GL_RGBA16 , GL_RGBA , GL_UNSIGNED_SHORT }
, { GL_RGB10_A2 , GL_RGBA , GL_UNSIGNED_INT_10_10_10_2 } , { GL_RGB10_A2 , GL_RGBA , GL_UNSIGNED_INT_10_10_10_2 }
, { GL_RGB10_A2 , GL_RGBA , GL_UNSIGNED_INT_2_10_10_10_REV } , { GL_RGB10_A2 , GL_RGBA , GL_UNSIGNED_INT_2_10_10_10_REV }
, { GL_RGBA12 , GL_RGBA , GL_UNSIGNED_SHORT } , { GL_RGBA12 , GL_RGBA , GL_UNSIGNED_SHORT }
@@ -149,8 +150,8 @@ InternalPixelRelations sizedInternalFormats[] = {
, { GL_RGB5_A1 , GL_RGBA , GL_UNSIGNED_INT_10_10_10_2 } , { GL_RGB5_A1 , GL_RGBA , GL_UNSIGNED_INT_10_10_10_2 }
, { GL_RGB5_A1 , GL_RGBA , GL_UNSIGNED_INT_2_10_10_10_REV } , { GL_RGB5_A1 , GL_RGBA , GL_UNSIGNED_INT_2_10_10_10_REV }
// , { GL_RGBA16F , GL_RGBA , GL_HALF_FLOAT } // , { GL_RGBA16F , GL_RGBA , GL_HALF_FLOAT }
// , { GL_RGBA16F , GL_RGBA , GL_FLOAT } , { GL_RGBA16F_ARB , GL_RGBA , GL_FLOAT }
// , { GL_RGBA32F , GL_RGBA , GL_FLOAT } , { GL_RGBA32F_ARB , GL_RGBA , GL_FLOAT }
, { GL_SRGB8 , GL_RGB , GL_UNSIGNED_BYTE } , { GL_SRGB8 , GL_RGB , GL_UNSIGNED_BYTE }
, { GL_SRGB8_ALPHA8 , GL_RGBA , GL_UNSIGNED_BYTE } , { GL_SRGB8_ALPHA8 , GL_RGBA , GL_UNSIGNED_BYTE }
@@ -227,7 +228,7 @@ GLenum assumeSizedInternalFormat(GLint internalFormat, GLenum type)
return 0; return 0;
} }
bool isCompressedInternalFormatSupportedByTexStorrage(GLint internalFormat) bool isCompressedInternalFormatSupportedByTexStorage(GLint internalFormat)
{ {
const size_t formatsCount = sizeof(compressedInternalFormats) / sizeof(compressedInternalFormats[0]); const size_t formatsCount = sizeof(compressedInternalFormats) / sizeof(compressedInternalFormats[0]);
@@ -2082,6 +2083,43 @@ bool Texture::areAllTextureObjectsLoaded() const
return true; return true;
} }
GLenum Texture::selectSizedInternalFormat(const osg::Image* image) const
{
if (image)
{
bool compressed_image = isCompressedInternalFormat((GLenum)image->getPixelFormat());
//calculate sized internal format
if(compressed_image)
{
if(isCompressedInternalFormatSupportedByTexStorage(_internalFormat))
{
return _internalFormat;
}
else
{
return 0;
}
}
else
{
if(isSizedInternalFormat(_internalFormat))
{
return _internalFormat;
}
else
{
return assumeSizedInternalFormat((GLenum)image->getInternalTextureFormat(), (GLenum)image->getDataType());
}
}
}
else
{
if (isSizedInternalFormat(_internalFormat)) return _internalFormat;
return assumeSizedInternalFormat(_internalFormat, (_sourceType!=0) ? _sourceType : GL_UNSIGNED_BYTE);
}
}
void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* image, GLsizei inwidth, GLsizei inheight,GLsizei numMipmapLevels) const void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* image, GLsizei inwidth, GLsizei inheight,GLsizei numMipmapLevels) const
{ {
@@ -2272,49 +2310,21 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
int width = inwidth; int width = inwidth;
int height = inheight; int height = inheight;
bool useTexStorrage = extensions->isTextureStorageEnabled; GLenum texStoragesizedInternalFormat = extensions->isTextureStorageEnabled && extensions->isTexStorage2DSupported() && (_borderWidth==0) ? selectSizedInternalFormat(image) : 0;
GLenum sizedInternalFormat = 0;
if(useTexStorrage) if (texStoragesizedInternalFormat!=0)
{
if(extensions->isTexStorage2DSupported() && _borderWidth == 0)
{
//calculate sized internal format
if(!compressed_image)
{
if(isSizedInternalFormat(_internalFormat))
{
sizedInternalFormat = _internalFormat;
}
else
{
sizedInternalFormat = assumeSizedInternalFormat((GLenum)image->getInternalTextureFormat(), (GLenum)image->getDataType());
}
}
else
{
if(isCompressedInternalFormatSupportedByTexStorrage(_internalFormat))
{
sizedInternalFormat = _internalFormat;
}
}
}
useTexStorrage &= sizedInternalFormat != 0;
}
if(useTexStorrage)
{ {
if (getTextureTarget()==GL_TEXTURE_CUBE_MAP) if (getTextureTarget()==GL_TEXTURE_CUBE_MAP)
{ {
if (target==GL_TEXTURE_CUBE_MAP_POSITIVE_X) if (target==GL_TEXTURE_CUBE_MAP_POSITIVE_X)
{ {
extensions->glTexStorage2D(GL_TEXTURE_CUBE_MAP, numMipmapLevels, sizedInternalFormat, width, height); // only allocate on first face image
extensions->glTexStorage2D(GL_TEXTURE_CUBE_MAP, numMipmapLevels, texStoragesizedInternalFormat, width, height);
} }
} }
else else
{ {
extensions->glTexStorage2D(target, numMipmapLevels, sizedInternalFormat, width, height); extensions->glTexStorage2D(target, numMipmapLevels, texStoragesizedInternalFormat, width, height);
} }
if( !compressed_image ) if( !compressed_image )

View File

@@ -230,18 +230,30 @@ void Texture1D::apply(State& state) const
} }
else if ( (_textureWidth!=0) && (_internalFormat!=0) ) else if ( (_textureWidth!=0) && (_internalFormat!=0) )
{ {
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_1D,_numMipmapLevels,_internalFormat,_textureWidth,1,1,0); // no image present, but dimensions at set so lets create the texture
GLExtensions * extensions = state.get<GLExtensions>();
GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled ? selectSizedInternalFormat() : 0;
if (texStorageSizedInternalFormat!=0)
{
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_1D, _numMipmapLevels, texStorageSizedInternalFormat, _textureWidth, 1, 1, 0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_1D, state);
textureObject->bind(); extensions->glTexStorage1D( GL_TEXTURE_1D, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth);
}
else
{
GLenum internalFormat = _sourceFormat ? _sourceFormat : _internalFormat;
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_1D, _numMipmapLevels, internalFormat, _textureWidth, 1, 1, 0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_1D, state);
applyTexParameters(GL_TEXTURE_1D,state); glTexImage1D( GL_TEXTURE_1D, 0, _internalFormat,
// no image present, but dimensions are set so lets create the texture
glTexImage1D( GL_TEXTURE_1D, 0, _internalFormat,
_textureWidth, _borderWidth, _textureWidth, _borderWidth,
_sourceFormat ? _sourceFormat : _internalFormat, internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE, _sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0); 0);
}
if (_readPBuffer.valid()) if (_readPBuffer.valid())
{ {

View File

@@ -243,6 +243,7 @@ void Texture2D::apply(State& state) const
} }
else if (_image.valid() && _image->data()) else if (_image.valid() && _image->data())
{ {
GLExtensions * extensions = state.get<GLExtensions>();
// keep the image around at least till we go out of scope. // keep the image around at least till we go out of scope.
osg::ref_ptr<osg::Image> image = _image; osg::ref_ptr<osg::Image> image = _image;
@@ -253,7 +254,10 @@ void Texture2D::apply(State& state) const
// compute the dimensions of the texture. // compute the dimensions of the texture.
computeRequiredTextureDimensions(state,*image,_textureWidth, _textureHeight, _numMipmapLevels); computeRequiredTextureDimensions(state,*image,_textureWidth, _textureHeight, _numMipmapLevels);
textureObject = generateAndAssignTextureObject(contextID,GL_TEXTURE_2D,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,_borderWidth); GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled && (_borderWidth==0) ? selectSizedInternalFormat(_image.get()) : 0;
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_2D, _numMipmapLevels,
texStorageSizedInternalFormat!=0 ? texStorageSizedInternalFormat : _internalFormat,
_textureWidth, _textureHeight, 1, _borderWidth);
textureObject->bind(); textureObject->bind();
@@ -293,18 +297,30 @@ void Texture2D::apply(State& state) const
} }
else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_internalFormat!=0) ) else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_internalFormat!=0) )
{ {
textureObject = generateAndAssignTextureObject(contextID,GL_TEXTURE_2D,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,_borderWidth);
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D,state);
// no image present, but dimensions at set so lets create the texture // no image present, but dimensions at set so lets create the texture
glTexImage2D( GL_TEXTURE_2D, 0, _internalFormat, GLExtensions * extensions = state.get<GLExtensions>();
_textureWidth, _textureHeight, _borderWidth, GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled && (_borderWidth==0) ? selectSizedInternalFormat() : 0;
_sourceFormat ? _sourceFormat : _internalFormat, if (texStorageSizedInternalFormat!=0)
_sourceType ? _sourceType : GL_UNSIGNED_BYTE, {
0); textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_2D, _numMipmapLevels, texStorageSizedInternalFormat, _textureWidth, _textureHeight, 1, _borderWidth);
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D, state);
extensions->glTexStorage2D( GL_TEXTURE_2D, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat,
_textureWidth, _textureHeight);
}
else
{
GLenum internalFormat = _sourceFormat ? _sourceFormat : _internalFormat;
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_2D, _numMipmapLevels, internalFormat, _textureWidth, _textureHeight, 1, _borderWidth);
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D, state);
glTexImage2D( GL_TEXTURE_2D, 0, _internalFormat,
_textureWidth, _textureHeight, _borderWidth,
internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0);
}
if (_readPBuffer.valid()) if (_readPBuffer.valid())
{ {

View File

@@ -336,42 +336,53 @@ void Texture2DArray::apply(State& state) const
// compute the internal texture format, this set the _internalFormat to an appropriate value. // compute the internal texture format, this set the _internalFormat to an appropriate value.
computeInternalFormat(); computeInternalFormat();
GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled && (_borderWidth==0) ? selectSizedInternalFormat(_images[0].get()) : 0;
// compute the dimensions of the texture. // compute the dimensions of the texture.
computeRequiredTextureDimensions(state,*_images[0],_textureWidth, _textureHeight, _numMipmapLevels); computeRequiredTextureDimensions(state,*_images[0],_textureWidth, _textureHeight, _numMipmapLevels);
// create texture object // create texture object
textureObject = generateAndAssignTextureObject( textureObject = generateAndAssignTextureObject(
contextID, GL_TEXTURE_2D_ARRAY,_numMipmapLevels, _internalFormat, _textureWidth, _textureHeight, textureDepth,0); contextID, GL_TEXTURE_2D_ARRAY, _numMipmapLevels,
texStorageSizedInternalFormat!=0 ? texStorageSizedInternalFormat : _internalFormat,
_textureWidth, _textureHeight, textureDepth,0);
// bind texture // bind texture
textureObject->bind(); textureObject->bind();
applyTexParameters(GL_TEXTURE_2D_ARRAY, state); applyTexParameters(GL_TEXTURE_2D_ARRAY, state);
// First we need to allocate the texture memory // First we need to allocate the texture memory
int sourceFormat = _sourceFormat ? _sourceFormat : _internalFormat; if(texStorageSizedInternalFormat!=0)
if( isCompressedInternalFormat( sourceFormat ) &&
sourceFormat == _internalFormat &&
extensions->isCompressedTexImage3DSupported() )
{ {
extensions->glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY, 0, _internalFormat, extensions->glTexStorage3D(GL_TEXTURE_2D_ARRAY, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight, textureDepth);
_textureWidth, _textureHeight, textureDepth, _borderWidth,
_images[0]->getImageSizeInBytes() * textureDepth,
0);
} }
else else
{ {
int sourceFormat = _sourceFormat ? _sourceFormat : _internalFormat;
if( isCompressedInternalFormat( sourceFormat ) &&
sourceFormat == _internalFormat &&
extensions->isCompressedTexImage3DSupported() )
{
extensions->glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY, 0, _internalFormat,
_textureWidth, _textureHeight, textureDepth, _borderWidth,
_images[0]->getImageSizeInBytes() * textureDepth,
0);
}
else
{
// Override compressed source format with safe GL_RGBA value which not generate error // Override compressed source format with safe GL_RGBA value which not generate error
// We can safely do this as source format is not important when source data is NULL // We can safely do this as source format is not important when source data is NULL
if( isCompressedInternalFormat( sourceFormat ) ) if( isCompressedInternalFormat( sourceFormat ) )
sourceFormat = GL_RGBA; sourceFormat = GL_RGBA;
extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY, 0, _internalFormat, extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY, 0, _internalFormat,
_textureWidth, _textureHeight, textureDepth, _borderWidth, _textureWidth, _textureHeight, textureDepth, _borderWidth,
sourceFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE, sourceFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0); 0);
}
} }
// For certain we have to manually allocate memory for mipmaps if images are compressed // For certain we have to manually allocate memory for mipmaps if images are compressed
// if not allocated OpenGL will produce errors on mipmap upload. // if not allocated OpenGL will produce errors on mipmap upload.
// I have not tested if this is necessary for plain texture formats but // I have not tested if this is necessary for plain texture formats but
@@ -430,19 +441,28 @@ void Texture2DArray::apply(State& state) const
else if ( (_textureWidth > 0) && (_textureHeight > 0) && (_textureDepth > 0) && (_internalFormat!=0) ) else if ( (_textureWidth > 0) && (_textureHeight > 0) && (_textureDepth > 0) && (_internalFormat!=0) )
{ {
// generate texture // generate texture
GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled ? selectSizedInternalFormat() : 0;
textureObject = generateAndAssignTextureObject( textureObject = generateAndAssignTextureObject(
contextID, GL_TEXTURE_2D_ARRAY,_numMipmapLevels,_internalFormat, _textureWidth, _textureHeight, _textureDepth,0); contextID, GL_TEXTURE_2D_ARRAY, _numMipmapLevels,
texStorageSizedInternalFormat!=0 ? texStorageSizedInternalFormat :_internalFormat,
_textureWidth, _textureHeight, _textureDepth, 0);
textureObject->bind(); textureObject->bind();
applyTexParameters(GL_TEXTURE_2D_ARRAY,state); applyTexParameters(GL_TEXTURE_2D_ARRAY,state);
extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY, 0, _internalFormat, if (texStorageSizedInternalFormat!=0)
{
extensions->glTexStorage3D( GL_TEXTURE_2D_ARRAY, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight, _textureDepth);
}
else
extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY, 0, _internalFormat,
_textureWidth, _textureHeight, _textureDepth, _textureWidth, _textureHeight, _textureDepth,
_borderWidth, _borderWidth,
_sourceFormat ? _sourceFormat : _internalFormat, _sourceFormat ? _sourceFormat : _internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE, _sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0); 0);
} }
// nothing before, so just unbind the texture target // nothing before, so just unbind the texture target

View File

@@ -102,29 +102,32 @@ void Texture2DMultisample::apply(State& state) const
} }
else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_numSamples!=0) ) else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_numSamples!=0) )
{ {
textureObject = generateAndAssignTextureObject( // no image present, but dimensions at set so lets create the texture
contextID, GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled && (_borderWidth==0) ? selectSizedInternalFormat() : 0;
getTextureTarget(), if (texStorageSizedInternalFormat!=0)
1, {
_internalFormat, textureObject = generateAndAssignTextureObject(contextID, getTextureTarget(), 1, texStorageSizedInternalFormat, _textureWidth, _textureHeight, 1, 0);
_textureWidth, textureObject->bind();
_textureHeight,
1,
_borderWidth);
textureObject->bind(); extensions->glTexStorage2DMultisample( GL_TEXTURE_2D_MULTISAMPLE, _numSamples, texStorageSizedInternalFormat, _textureWidth, _textureHeight, _fixedsamplelocations);
}
else
{
textureObject = generateAndAssignTextureObject(contextID, getTextureTarget(), 1, _internalFormat, _textureWidth, _textureHeight, 1, _borderWidth);
textureObject->bind();
extensions->glTexImage2DMultisample( getTextureTarget(), extensions->glTexImage2DMultisample( GL_TEXTURE_2D_MULTISAMPLE,
_numSamples, _numSamples,
_internalFormat, _internalFormat,
_textureWidth, _textureWidth,
_textureHeight, _textureHeight,
_fixedsamplelocations ); _fixedsamplelocations );
}
} }
else else
{ {
glBindTexture( getTextureTarget(), 0 ); glBindTexture( GL_TEXTURE_2D_MULTISAMPLE, 0 );
} }
} }

View File

@@ -315,20 +315,30 @@ void Texture3D::apply(State& state) const
} }
else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_textureDepth!=0) && (_internalFormat!=0) ) else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_textureDepth!=0) && (_internalFormat!=0) )
{ {
textureObject = generateAndAssignTextureObject(
contextID,GL_TEXTURE_3D,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,_textureDepth,0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_3D,state);
// no image present, but dimensions at set so lets create the texture // no image present, but dimensions at set so lets create the texture
extensions->glTexImage3D( GL_TEXTURE_3D, 0, _internalFormat, GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled ? selectSizedInternalFormat() : 0;
if (texStorageSizedInternalFormat!=0)
{
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_3D, _numMipmapLevels, texStorageSizedInternalFormat, _textureWidth, _textureHeight, _textureDepth,0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_3D, state);
extensions->glTexStorage3D( GL_TEXTURE_3D, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight, _textureDepth);
}
else
{
GLenum internalFormat = _sourceFormat ? _sourceFormat : _internalFormat;
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_3D, _numMipmapLevels, internalFormat, _textureWidth, _textureHeight, _textureDepth,0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_3D, state);
extensions->glTexImage3D( GL_TEXTURE_3D, 0, _internalFormat,
_textureWidth, _textureHeight, _textureDepth, _textureWidth, _textureHeight, _textureDepth,
_borderWidth, _borderWidth,
_sourceFormat ? _sourceFormat : _internalFormat, internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE, _sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0); 0);
}
if (_readPBuffer.valid()) if (_readPBuffer.valid())
{ {

View File

@@ -293,8 +293,12 @@ void TextureCubeMap::apply(State& state) const
_textureWidth = _textureHeight = minimum( _textureWidth , _textureHeight ); _textureWidth = _textureHeight = minimum( _textureWidth , _textureHeight );
} }
GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled && (_borderWidth==0) ? selectSizedInternalFormat(_images[0].get()) : 0;
textureObject = generateAndAssignTextureObject( textureObject = generateAndAssignTextureObject(
contextID,GL_TEXTURE_CUBE_MAP,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,0); contextID, GL_TEXTURE_CUBE_MAP, _numMipmapLevels,
texStorageSizedInternalFormat!=0 ? texStorageSizedInternalFormat : _internalFormat,
_textureWidth, _textureHeight, 1, 0);
textureObject->bind(); textureObject->bind();
@@ -335,22 +339,33 @@ void TextureCubeMap::apply(State& state) const
} }
else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_internalFormat!=0) ) else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_internalFormat!=0) )
{ {
GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled && (_borderWidth==0) ? selectSizedInternalFormat() : 0;
textureObject = generateAndAssignTextureObject( textureObject = generateAndAssignTextureObject(
contextID,GL_TEXTURE_CUBE_MAP,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,0); contextID, GL_TEXTURE_CUBE_MAP, _numMipmapLevels,
texStorageSizedInternalFormat!=0 ? texStorageSizedInternalFormat : _internalFormat,
_textureWidth, _textureHeight, 1, 0);
textureObject->bind(); textureObject->bind();
applyTexParameters(GL_TEXTURE_CUBE_MAP,state); applyTexParameters(GL_TEXTURE_CUBE_MAP,state);
for (int n=0; n<6; n++) if(texStorageSizedInternalFormat!=0)
{ {
// no image present, but dimensions at set so less create the texture extensions->glTexStorage2D(GL_TEXTURE_CUBE_MAP, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight);
glTexImage2D( faceTarget[n], 0, _internalFormat,
_textureWidth, _textureHeight, _borderWidth,
_sourceFormat ? _sourceFormat : _internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0);
} }
else
for (int n=0; n<6; n++)
{
// no image present, but dimensions at set so less create the texture
glTexImage2D( faceTarget[n], 0, _internalFormat,
_textureWidth, _textureHeight, _borderWidth,
_sourceFormat ? _sourceFormat : _internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0);
}
} }
else else

View File

@@ -231,7 +231,7 @@ void TextureRectangle::apply(State& state) const
} }
else if (_image.valid() && _image->data()) else if (_image.valid() && _image->data())
{ {
GLExtensions * extensions = state.get<GLExtensions>();
// keep the image around at least till we go out of scope. // keep the image around at least till we go out of scope.
osg::ref_ptr<osg::Image> image = _image; osg::ref_ptr<osg::Image> image = _image;
@@ -239,11 +239,16 @@ void TextureRectangle::apply(State& state) const
// compute the internal texture format, this set the _internalFormat to an appropriate value. // compute the internal texture format, this set the _internalFormat to an appropriate value.
computeInternalFormat(); computeInternalFormat();
//get sizedInternalFormat if TexStorage available
GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled && (_borderWidth==0) ? selectSizedInternalFormat(image.get()) : 0;
_textureWidth = image->s(); _textureWidth = image->s();
_textureHeight = image->t(); _textureHeight = image->t();
textureObject = generateAndAssignTextureObject( textureObject = generateAndAssignTextureObject(
contextID,GL_TEXTURE_RECTANGLE,1,_internalFormat,_textureWidth,_textureHeight,1,0); contextID, GL_TEXTURE_RECTANGLE, 1,
texStorageSizedInternalFormat!=0 ? texStorageSizedInternalFormat : _internalFormat,
_textureWidth, _textureHeight, 1, 0);
textureObject->bind(); textureObject->bind();
@@ -268,19 +273,30 @@ void TextureRectangle::apply(State& state) const
} }
else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_internalFormat!=0) ) else if ( (_textureWidth!=0) && (_textureHeight!=0) && (_internalFormat!=0) )
{ {
textureObject = generateAndAssignTextureObject(
contextID,GL_TEXTURE_RECTANGLE,0,_internalFormat,_textureWidth,_textureHeight,1,0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_RECTANGLE,state);
// no image present, but dimensions at set so lets create the texture // no image present, but dimensions at set so lets create the texture
glTexImage2D( GL_TEXTURE_RECTANGLE, 0, _internalFormat, GLExtensions * extensions = state.get<GLExtensions>();
GLenum texStorageSizedInternalFormat = extensions->isTextureStorageEnabled ? selectSizedInternalFormat() : 0;
if (texStorageSizedInternalFormat!=0)
{
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_RECTANGLE, 0, texStorageSizedInternalFormat, _textureWidth, _textureHeight, 1, 0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_RECTANGLE, state);
extensions->glTexStorage2D( GL_TEXTURE_RECTANGLE, 1, texStorageSizedInternalFormat, _textureWidth, _textureHeight);
}
else
{
GLenum internalFormat = _sourceFormat ? _sourceFormat : _internalFormat;
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_RECTANGLE, 0, internalFormat, _textureWidth, _textureHeight, 1, 0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_RECTANGLE, state);
glTexImage2D( GL_TEXTURE_RECTANGLE, 0, _internalFormat,
_textureWidth, _textureHeight, _borderWidth, _textureWidth, _textureHeight, _borderWidth,
_sourceFormat ? _sourceFormat : _internalFormat, internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE, _sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0); 0);
}
if (_readPBuffer.valid()) if (_readPBuffer.valid())
{ {

View File

@@ -17,6 +17,7 @@
#include <osgDB/ConvertBase64> #include <osgDB/ConvertBase64>
#include <osgDB/FileUtils> #include <osgDB/FileUtils>
#include <osgDB/WriteFile> #include <osgDB/WriteFile>
#include <osgDB/FileNameUtils>
#include <osgDB/ObjectWrapper> #include <osgDB/ObjectWrapper>
#include <osgDB/fstream> #include <osgDB/fstream>
#include <sstream> #include <sstream>
@@ -581,35 +582,61 @@ void OutputStream::writeImage( const osg::Image* img )
if ( isBinary() ) if ( isBinary() )
{ {
std::string fullPath = osgDB::findDataFile( img->getFileName(), _options.get() ); std::string fullPath = osgDB::findDataFile( img->getFileName(), _options.get() );
osgDB::ifstream infile( fullPath.c_str(), std::ios::in|std::ios::binary ); if (fullPath.empty()==false)
if ( infile )
{ {
infile.seekg( 0, std::ios::end ); osgDB::ifstream infile( fullPath.c_str(), std::ios::in|std::ios::binary );
unsigned int size = infile.tellg();
writeSize(size); if ( infile )
if ( size>0 )
{ {
char* data = new char[size]; infile.seekg( 0, std::ios::end );
if ( !data ) unsigned int size = infile.tellg();
{ writeSize(size);
throwException( "OutputStream::writeImage(): Out of memory." );
if ( getException() ) return;
}
infile.seekg( 0, std::ios::beg ); if ( size>0 )
infile.read( data, size ); {
writeCharArray( data, size ); char* data = new char[size];
delete[] data; if ( !data )
{
throwException( "OutputStream::writeImage(): Out of memory." );
if ( getException() ) return;
}
infile.seekg( 0, std::ios::beg );
infile.read( data, size );
writeCharArray( data, size );
delete[] data;
}
infile.close();
}
else
{
OSG_WARN << "OutputStream::writeImage(): Failed to open image file "
<< img->getFileName() << std::endl;
*this << (unsigned int)0;
} }
infile.close();
} }
else else
{ {
OSG_WARN << "OutputStream::writeImage(): Failed to open image file " std::string ext = osgDB::getFileExtension( img->getFileName() );
<< img->getFileName() << std::endl; osgDB::ReaderWriter* writer =
*this << (unsigned int)0; osgDB::Registry::instance()->getReaderWriterForExtension( ext );
if ( writer )
{
std::stringstream outputStream;
writer->writeImage(*img, outputStream, getOptions());
std::string data (outputStream.str());
unsigned int size = data.size();
writeSize(size);
writeCharArray( data.c_str(), size );
}
else
{
OSG_WARN << "OutputStream::writeImage(): Failed to find a plugin to write the image file "
<< img->getFileName() << std::endl;
*this << (unsigned int)0;
}
} }
} }
break; break;
case IMAGE_EXTERNAL: case IMAGE_EXTERNAL:

View File

@@ -101,13 +101,15 @@ void XmlNode::ControlMap::setUpControlMappings()
} }
XmlNode::Input::Input(): XmlNode::Input::Input():
_currentPos(0) _currentPos(0),
_encoding(ENCODING_ASCII)
{ {
} }
XmlNode::Input::Input(const Input&): XmlNode::Input::Input(const Input& rhs):
ControlMap(), ControlMap(),
_currentPos(0) _currentPos(0),
_encoding(rhs._encoding)
{ {
} }
@@ -251,6 +253,11 @@ bool XmlNode::read(Input& input)
commentNode->contents = input.substr(0, end); commentNode->contents = input.substr(0, end);
if (end!=std::string::npos) if (end!=std::string::npos)
{ {
if (commentNode->contents.find("encoding=\"UTF-8\"")!=std::string::npos)
{
input.setEncoding(Input::ENCODING_UTF8);
}
OSG_INFO<<"Valid information record ["<<commentNode->contents<<"]"<<std::endl; OSG_INFO<<"Valid information record ["<<commentNode->contents<<"]"<<std::endl;
input += (end+2); input += (end+2);
} }
@@ -273,8 +280,7 @@ bool XmlNode::read(Input& input)
int c = 0; int c = 0;
while ((c=input[0])>=0 && c!=' ' && c!='\n' && c!='\r' && c!='>' && c!='/') while ((c=input[0])>=0 && c!=' ' && c!='\n' && c!='\r' && c!='>' && c!='/')
{ {
childNode->name.push_back(c); input.copyCharacterToString(childNode->name);
++input;
} }
while ((c=input[0])>=0 && c!='>' && c!='/') while ((c=input[0])>=0 && c!='>' && c!='/')
@@ -295,8 +301,7 @@ bool XmlNode::read(Input& input)
readAndReplaceControl(option, input); readAndReplaceControl(option, input);
else else
{ {
option.push_back(c); input.copyCharacterToString(option);
++input;
} }
} }
option.push_back(input[0]); option.push_back(input[0]);
@@ -306,8 +311,7 @@ bool XmlNode::read(Input& input)
{ {
while((c=input[0])>=0 && c!='>' && c!='/' && c!='"' && c!='\'' && c!='=' && c!=' ' && c!='\n' && c!='\r') while((c=input[0])>=0 && c!='>' && c!='/' && c!='"' && c!='\'' && c!='=' && c!=' ' && c!='\n' && c!='\r')
{ {
option.push_back(c); input.copyCharacterToString(option);
++input;
} }
} }
@@ -327,8 +331,7 @@ bool XmlNode::read(Input& input)
readAndReplaceControl(value, input); readAndReplaceControl(value, input);
else else
{ {
value.push_back(c); input.copyCharacterToString(value);
++input;
} }
} }
++input; ++input;
@@ -342,8 +345,7 @@ bool XmlNode::read(Input& input)
readAndReplaceControl(value, input); readAndReplaceControl(value, input);
else else
{ {
value.push_back(c); input.copyCharacterToString(value);
++input;
} }
} }
++input; ++input;
@@ -353,8 +355,7 @@ bool XmlNode::read(Input& input)
++input; ++input;
while((c=input[0])>=0 && c!=' ' && c!='\n' && c!='\r' && c!='"' && c!='\'' && c!='>') while((c=input[0])>=0 && c!=' ' && c!='\n' && c!='\r' && c!='"' && c!='\'' && c!='>')
{ {
value.push_back(c); input.copyCharacterToString(value);
++input;
} }
} }
} }
@@ -414,8 +415,7 @@ bool XmlNode::read(Input& input)
} }
else else
{ {
contents.push_back( c ); input.copyCharacterToString(contents);
++input;
} }
} }

View File

@@ -394,29 +394,53 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo
case osgParticle::Particle::HEXAGON: case osgParticle::Particle::HEXAGON:
case osgParticle::Particle::QUAD: case osgParticle::Particle::QUAD:
{ {
vertices.push_back(xpos-p1-p2); const osg::Vec3 c0(xpos-p1-p2);
colors.push_back(color); const osg::Vec2 t0(s_coord, t_coord);
texcoords.push_back(osg::Vec2(s_coord, t_coord)); const osg::Vec3 c1(xpos+p1-p2);
const osg::Vec2 t1(s_coord+s_tile, t_coord);
const osg::Vec3 c2(xpos+p1+p2);
const osg::Vec2 t2(s_coord+s_tile, t_coord+t_tile);
const osg::Vec3 c3(xpos-p1+p2);
const osg::Vec2 t3(s_coord, t_coord+t_tile);
vertices.push_back(xpos+p1-p2); // First 3 points (and texcoords) of quad or triangle
colors.push_back(color); vertices.push_back(c0);
texcoords.push_back(osg::Vec2(s_coord+s_tile, t_coord)); vertices.push_back(c1);
vertices.push_back(c2);
texcoords.push_back(t0);
texcoords.push_back(t1);
texcoords.push_back(t2);
vertices.push_back(xpos+p1+p2); #if !defined(OSG_GLES2_AVAILABLE)
colors.push_back(color); const unsigned int count = 4;
texcoords.push_back(osg::Vec2(s_coord+s_tile, t_coord+t_tile)); const GLenum mode = GL_QUADS;
vertices.push_back(xpos-p1+p2); // Last point (and texcoord) of quad
colors.push_back(color); vertices.push_back(c3);
texcoords.push_back(osg::Vec2(s_coord, t_coord+t_tile)); texcoords.push_back(t3);
#else
// No GL_QUADS mode on GLES2 and upper
const unsigned int count = 6;
const GLenum mode = GL_TRIANGLES;
if (!primitives.empty() && primitives.back().first==GL_QUADS) // Second triangle
vertices.push_back(c2);
vertices.push_back(c3);
vertices.push_back(c0);
texcoords.push_back(t2);
texcoords.push_back(t3);
texcoords.push_back(t0);
#endif
for (unsigned int j = 0; j < count; ++j)
colors.push_back(color);
if (!primitives.empty() && primitives.back().first == mode)
{ {
primitives.back().second+=4; primitives.back().second += count;
} }
else else
{ {
primitives.push_back(ArrayData::ModeCount(GL_QUADS,4)); primitives.push_back(ArrayData::ModeCount(mode, count));
} }
break; break;

View File

@@ -495,15 +495,15 @@ protected:
} }
// Is texture in local cache? // Is texture in local cache?
osg::StateSet* stateset = flt::Registry::instance()->getTextureFromLocalCache(pathname); osg::ref_ptr<osg::StateSet> stateset = flt::Registry::instance()->getTextureFromLocalCache(pathname);
// Read file if not in cache. // Read file if not in cache.
if (!stateset) if (!stateset.valid())
{ {
stateset = readTexture(pathname,document); stateset = readTexture(pathname,document);
// Add to texture cache. // Add to texture cache.
flt::Registry::instance()->addTextureToLocalCache(pathname,stateset); flt::Registry::instance()->addTextureToLocalCache(pathname,stateset.get());
} }
// Add to texture pool. // Add to texture pool.

View File

@@ -276,8 +276,8 @@ class FLTReaderWriter : public ReaderWriter
// in local cache? // in local cache?
{ {
osg::Node* node = flt::Registry::instance()->getExternalFromLocalCache(fileName); osg::ref_ptr<osg::Node> node = flt::Registry::instance()->getExternalFromLocalCache(fileName);
if (node) if (node.valid())
return ReadResult(node, ReaderWriter::ReadResult::FILE_LOADED_FROM_CACHE); return ReadResult(node, ReaderWriter::ReadResult::FILE_LOADED_FROM_CACHE);
} }
@@ -299,7 +299,6 @@ class FLTReaderWriter : public ReaderWriter
} }
} }
static int nestedExternalsLevel = 0;
if (rr.success()) if (rr.success())
{ {
// add to local cache. // add to local cache.
@@ -316,10 +315,8 @@ class FLTReaderWriter : public ReaderWriter
// read externals. // read externals.
if (rr.getNode()) if (rr.getNode())
{ {
nestedExternalsLevel++;
ReadExternalsVisitor visitor(local_opt.get()); ReadExternalsVisitor visitor(local_opt.get());
rr.getNode()->accept(visitor); rr.getNode()->accept(visitor);
nestedExternalsLevel--;
} }
} }
else else
@@ -334,10 +331,6 @@ class FLTReaderWriter : public ReaderWriter
rr.getNode()->accept(cbov); rr.getNode()->accept(cbov);
} }
// clear local cache.
if (nestedExternalsLevel==0)
flt::Registry::instance()->clearLocalCache();
return rr; return rr;
} }

View File

@@ -23,6 +23,8 @@
#include <queue> #include <queue>
#include <map> #include <map>
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <osgDB/ObjectCache>
#include <osgDB/Registry>
#include "Opcodes.h" #include "Opcodes.h"
#include "Record.h" #include "Record.h"
@@ -51,7 +53,6 @@ class Registry : public osg::Referenced
osg::Node* getExternalFromLocalCache(const std::string& filename); osg::Node* getExternalFromLocalCache(const std::string& filename);
void addTextureToLocalCache(const std::string& filename, osg::StateSet* stateset); void addTextureToLocalCache(const std::string& filename, osg::StateSet* stateset);
osg::StateSet* getTextureFromLocalCache(const std::string& filename); osg::StateSet* getTextureFromLocalCache(const std::string& filename);
void clearLocalCache();
protected: protected:
@@ -61,14 +62,6 @@ class Registry : public osg::Referenced
RecordProtoMap _recordProtoMap; RecordProtoMap _recordProtoMap;
ExternalQueue _externalReadQueue; ExternalQueue _externalReadQueue;
// External cache
typedef std::map<std::string, osg::ref_ptr<osg::Node> > ExternalCacheMap;
ExternalCacheMap _externalCacheMap;
// Texture cache
typedef std::map<std::string, osg::ref_ptr<osg::StateSet> > TextureCacheMap;
TextureCacheMap _textureCacheMap;
}; };
inline void Registry::addToExternalReadQueue(const std::string& filename, osg::Group* parent) inline void Registry::addToExternalReadQueue(const std::string& filename, osg::Group* parent)
@@ -78,34 +71,22 @@ inline void Registry::addToExternalReadQueue(const std::string& filename, osg::G
inline void Registry::addExternalToLocalCache(const std::string& filename, osg::Node* node) inline void Registry::addExternalToLocalCache(const std::string& filename, osg::Node* node)
{ {
_externalCacheMap[filename] = node; osgDB::Registry::instance()->addEntryToObjectCache(filename, node);
} }
inline osg::Node* Registry::getExternalFromLocalCache(const std::string& filename) inline osg::Node* Registry::getExternalFromLocalCache(const std::string& filename)
{ {
ExternalCacheMap::iterator itr = _externalCacheMap.find(filename); return dynamic_cast<osg::Node*>(osgDB::Registry::instance()->getFromObjectCache(filename));
if (itr != _externalCacheMap.end())
return (*itr).second.get();
return NULL;
} }
inline void Registry::addTextureToLocalCache(const std::string& filename, osg::StateSet* stateset) inline void Registry::addTextureToLocalCache(const std::string& filename, osg::StateSet* stateset)
{ {
_textureCacheMap[filename] = stateset; osgDB::Registry::instance()->addEntryToObjectCache(filename, stateset);
} }
inline osg::StateSet* Registry::getTextureFromLocalCache(const std::string& filename) inline osg::StateSet* Registry::getTextureFromLocalCache(const std::string& filename)
{ {
TextureCacheMap::iterator itr = _textureCacheMap.find(filename); return dynamic_cast<osg::StateSet*>(osgDB::Registry::instance()->getFromObjectCache(filename));
if (itr != _textureCacheMap.end())
return (*itr).second.get();
return NULL;
}
inline void Registry::clearLocalCache()
{
_externalCacheMap.clear();
_textureCacheMap.clear();
} }
/** Proxy class for automatic registration of reader/writers with the Registry.*/ /** Proxy class for automatic registration of reader/writers with the Registry.*/

View File

@@ -67,7 +67,7 @@ FltExportVisitor::isTextured( int unit, const osg::Geometry& geom ) const
bool texOn( ss->getTextureMode( unit, GL_TEXTURE_2D ) & osg::StateAttribute::ON ); bool texOn( ss->getTextureMode( unit, GL_TEXTURE_2D ) & osg::StateAttribute::ON );
#else #else
// In this mode, osg::Texture::getModeUsage() is undefined, so just detect if a texture is present // In this mode, osg::Texture::getModeUsage() is undefined, so just detect if a texture is present
bool texOn = (ss->getTextureAttribute(0, osg::StateAttribute::TEXTURE) != NULL); bool texOn( ss->getTextureAttribute( unit, osg::StateAttribute::TEXTURE ) != NULL );
#endif #endif
bool hasCoords( geom.getTexCoordArray( unit ) != NULL ); bool hasCoords( geom.getTexCoordArray( unit ) != NULL );

View File

@@ -5,9 +5,9 @@ SET(TARGET_SRC ReaderWriterEXR.cpp )
SET(TARGET_LIBRARIES_VARS ${OPENEXR_LIBRARIES_VARS} ${ILMBASE_LIBRARIES_VARS} ZLIB_LIBRARIES) SET(TARGET_LIBRARIES_VARS ${OPENEXR_LIBRARIES_VARS} ${ILMBASE_LIBRARIES_VARS} ZLIB_LIBRARIES)
IF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Remove -Wshadow flag as it barfs on ffmoeg headers REMOVE_CXX_FLAG(-Wshadow)
STRING(REGEX REPLACE "-Wshadow" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
ENDIF() ENDIF()
#### end var setup ### #### end var setup ###

View File

@@ -12,5 +12,11 @@ SET(TARGET_H
SET(TARGET_LIBRARIES_VARS GDAL_LIBRARY ) SET(TARGET_LIBRARIES_VARS GDAL_LIBRARY )
SET(TARGET_ADDED_LIBRARIES osgTerrain ) SET(TARGET_ADDED_LIBRARIES osgTerrain )
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
REMOVE_CXX_FLAG(-Wunused-result)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result")
ENDIF()
#### end var setup ### #### end var setup ###
SETUP_PLUGIN(gdal) SETUP_PLUGIN(gdal)

View File

@@ -239,7 +239,8 @@ void Surface::generate_stateset(unsigned int max_tex_units, bool force_arb_compr
break; break;
case Block::SUBTRACTIVE: case Block::SUBTRACTIVE:
OSG_WARN << "Warning: lwosg::Surface: 'Subtractive' blending mode is not supported, falling back to 'Difference' mode" << std::endl; OSG_WARN << "Warning: lwosg::Surface: 'Subtractive' blending mode is not supported." << std::endl;
break;
case Block::DIFFERENCE: case Block::DIFFERENCE:
tec->setCombine_RGB(osg::TexEnvCombine::SUBTRACT); tec->setCombine_RGB(osg::TexEnvCombine::SUBTRACT);
break; break;

View File

@@ -276,7 +276,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterTXP::local_readNode(const std::strin
std::string childInfoStr; std::string childInfoStr;
createChildrenLocationString(childrenChildLoc, childInfoStr); createChildrenLocationString(childrenChildLoc, childInfoStr);
char pagedLODfile[1024]; char pagedLODfile[1084];
sprintf(pagedLODfile,"%s\\subtiles%d_%dx%d_%d%s.txp", sprintf(pagedLODfile,"%s\\subtiles%d_%dx%d_%d%s.txp",
archive->getDir(), archive->getDir(),
loc.lod, loc.lod,
@@ -380,7 +380,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterTXP::local_readNode(const std::strin
if (tileLOD < (numLods-1)) if (tileLOD < (numLods-1))
{ {
char pagedLODfile[1024]; char pagedLODfile[1094];
sprintf(pagedLODfile,"%s\\subtiles%d_%dx%d_%d.txp", sprintf(pagedLODfile,"%s\\subtiles%d_%dx%d_%d.txp",
archive->getDir(), archive->getDir(),
tileLOD, tileLOD,

View File

@@ -294,7 +294,7 @@ osg::Node* TXPNode::addPagedLODTile(int x, int y)
// If you look at the code that calls it, it is effectively called only when // If you look at the code that calls it, it is effectively called only when
// lod = 0. So all is OK // lod = 0. So all is OK
int lod = 0; int lod = 0;
char pagedLODfile[1024]; char pagedLODfile[1070];
sprintf(pagedLODfile,"%s\\tile%d_%dx%d_%d.txp",_archive->getDir(),lod,x,y,_archive->getId()); sprintf(pagedLODfile,"%s\\tile%d_%dx%d_%d.txp",_archive->getDir(),lod,x,y,_archive->getId());

View File

@@ -63,7 +63,7 @@ void trpgr_Archive::SetDirectory(const char *in_dir)
// Open the given file and look for the file specific info // Open the given file and look for the file specific info
bool trpgr_Archive::OpenFile(const char *name) bool trpgr_Archive::OpenFile(const char *name)
{ {
char file[1024]; char file[1025];
sprintf(file,"%s" PATHSEPERATOR "%s",dir,name); sprintf(file,"%s" PATHSEPERATOR "%s",dir,name);
CloseFile(); CloseFile();
@@ -138,7 +138,7 @@ bool trpgr_Archive::ReadSubArchive(int row, int col, trpgEndian cpuNess)
trpgHeader blockHeader; trpgHeader blockHeader;
trpgr_Parser bparser; trpgr_Parser bparser;
char blockpath[1024]; char blockpath[1060];
//open the block archive //open the block archive
// the block archive will be in the base dir + \\cols\\row\\archive.txp // the block archive will be in the base dir + \\cols\\row\\archive.txp
sprintf(blockpath,"%s%s%d%s%d%sarchive.txp",dir,PATHSEPERATOR,col,PATHSEPERATOR,row,PATHSEPERATOR); sprintf(blockpath,"%s%s%d%s%d%sarchive.txp",dir,PATHSEPERATOR,col,PATHSEPERATOR,row,PATHSEPERATOR);
@@ -325,7 +325,7 @@ bool trpgr_Archive::ReadHeader(bool readAllBlocks)
tileTable.GetMode(tileMode); tileTable.GetMode(tileMode);
if (tileMode == trpgTileTable::Local) { if (tileMode == trpgTileTable::Local) {
if (tileCache) delete tileCache; if (tileCache) delete tileCache;
char fullBase[1024]; char fullBase[1060];
sprintf(fullBase,"%s" PATHSEPERATOR "tileFile",dir); sprintf(fullBase,"%s" PATHSEPERATOR "tileFile",dir);
tileCache = GetNewRAppFileCache(fullBase,"tpf"); tileCache = GetNewRAppFileCache(fullBase,"tpf");
} }
@@ -390,7 +390,7 @@ bool trpgr_Archive::ReadTile(uint32 x,uint32 y,uint32 lod,trpgMemReadBuffer &buf
bool trpgr_Archive::ReadExternalTile(uint32 x,uint32 y,uint32 lod,trpgMemReadBuffer &buf) bool trpgr_Archive::ReadExternalTile(uint32 x,uint32 y,uint32 lod,trpgMemReadBuffer &buf)
{ {
// Figure out the file name // Figure out the file name
char filename[1024]; char filename[1069];
int majorVer,minorVer; int majorVer,minorVer;
header.GetVersion(majorVer,minorVer); header.GetVersion(majorVer,minorVer);
if((majorVer >= TRPG_NOMERGE_VERSION_MAJOR) && (minorVer >= TRPG_NOMERGE_VERSION_MINOR)) { if((majorVer >= TRPG_NOMERGE_VERSION_MAJOR) && (minorVer >= TRPG_NOMERGE_VERSION_MINOR)) {
@@ -554,7 +554,7 @@ void trpgrImageHelper::Init(trpgEndian inNess,char *inDir,
// Set up the texture cache // Set up the texture cache
// It doesn't do anything until it's called anyway // It doesn't do anything until it's called anyway
char fullBase[1024]; char fullBase[1035];
sprintf(fullBase,"%s" PATHSEPERATOR "texFile",dir); sprintf(fullBase,"%s" PATHSEPERATOR "texFile",dir);
texCache = GetNewRAppFileCache(fullBase,"txf"); texCache = GetNewRAppFileCache(fullBase,"txf");
if(sepGeoTyp) { if(sepGeoTyp) {

View File

@@ -681,7 +681,7 @@ trpgrAppFile *trpgrAppFileCache::GetFile(trpgEndian ness,int id,int col,int row)
OpenFile &of = files[oldID]; OpenFile &of = files[oldID];
if (of.afile) if (of.afile)
delete of.afile; delete of.afile;
char fileName[1024]; char fileName[1056];
if(col==-1) { if(col==-1) {
sprintf(fileName,"%s_%d.%s",baseName,id,ext); sprintf(fileName,"%s_%d.%s",baseName,id,ext);
} }

View File

@@ -408,7 +408,7 @@ trpgLabelPropertyTable *trpgwArchive::GetLabelPropertyTable()
// Same as above, only gets a basename as well // Same as above, only gets a basename as well
bool trpgwArchive::OpenFile(const char *in_dir,const char *name) bool trpgwArchive::OpenFile(const char *in_dir,const char *name)
{ {
char filename[1024]; char filename[1025];
strncpy(dir,in_dir,1023); strncpy(dir,in_dir,1023);
@@ -773,7 +773,7 @@ bool trpgwArchive::IncrementTileFile()
} }
// Open the next one // Open the next one
char filename[1024]; char filename[1049];
sprintf(filename,"%s" PATHSEPERATOR "tileFile_%d.tpf",dir,tileFileCount++); sprintf(filename,"%s" PATHSEPERATOR "tileFile_%d.tpf",dir,tileFileCount++);
tileFile = GetNewWAppFile(ness,filename,true); tileFile = GetNewWAppFile(ness,filename,true);
if (!tileFile->isValid()) if (!tileFile->isValid())
@@ -802,7 +802,7 @@ bool trpgwArchive::DesignateTileFile(int id)
} }
// Open a named on // Open a named on
char filename[1024]; char filename[1049];
sprintf(filename,"%s" PATHSEPERATOR "tileFile_%d.tpf",dir,id); sprintf(filename,"%s" PATHSEPERATOR "tileFile_%d.tpf",dir,id);
tileFile = GetNewWAppFile(ness,filename); tileFile = GetNewWAppFile(ness,filename);
if (!tileFile->isValid()) if (!tileFile->isValid())
@@ -834,7 +834,7 @@ bool trpgwArchive::WriteTile(unsigned int x,unsigned int y,unsigned int lod, flo
// External tiles get their own individual files // External tiles get their own individual files
if (tileMode == TileExternal || tileMode == TileExternalSaved) { if (tileMode == TileExternal || tileMode == TileExternalSaved) {
// Make a new filename // Make a new filename
char filename[1024]; char filename[1069];
// Note: Windows specific // Note: Windows specific
sprintf(filename,"%s" PATHSEPERATOR "tile_%d_%d_%d.tpt",dir,x,y,lod); sprintf(filename,"%s" PATHSEPERATOR "tile_%d_%d_%d.tpt",dir,x,y,lod);
if (!(tfp = osgDB::fopen(filename,"wb"))) if (!(tfp = osgDB::fopen(filename,"wb")))
@@ -1502,7 +1502,7 @@ trpgwAppFile* trpgwImageHelper::GetNewWAppFile(trpgEndian inNess,const char *fil
*/ */
trpgwAppFile * trpgwImageHelper::IncrementTextureFile(bool geotyp) trpgwAppFile * trpgwImageHelper::IncrementTextureFile(bool geotyp)
{ {
char filename[1024]; char filename[1049];
trpgwAppFile *thefile = texFile; trpgwAppFile *thefile = texFile;
if(geotyp && separateGeoTypical) { if(geotyp && separateGeoTypical) {
@@ -1553,7 +1553,7 @@ bool trpgwImageHelper::DesignateTextureFile(int id)
texFile = NULL; texFile = NULL;
// Open one with the given base name // Open one with the given base name
char filename[1024]; char filename[1044];
sprintf(filename,"%s" PATHSEPERATOR "texFile_%d.txf",dir,id); sprintf(filename,"%s" PATHSEPERATOR "texFile_%d.txf",dir,id);
texFile = GetNewWAppFile(ness,filename); texFile = GetNewWAppFile(ness,filename);
if (!texFile->isValid()) if (!texFile->isValid())

View File

@@ -11,4 +11,8 @@ SET(TARGET_H
ADD_DEFINITIONS(-DZIP_STD) ADD_DEFINITIONS(-DZIP_STD)
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-implicit-fallthrough")
ENDIF()
SETUP_PLUGIN(zip) SETUP_PLUGIN(zip)

View File

@@ -328,21 +328,19 @@ Glyph* Font::getGlyph(const FontResolution& fontRes, unsigned int charcode)
FontResolution fontResUsed(0,0); FontResolution fontResUsed(0,0);
if (_implementation->supportsMultipleFontResolutions()) fontResUsed = fontRes; if (_implementation->supportsMultipleFontResolutions()) fontResUsed = fontRes;
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex);
FontSizeGlyphMap::iterator itr = _sizeGlyphMap.find(fontResUsed);
if (itr!=_sizeGlyphMap.end())
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex); GlyphMap& glyphmap = itr->second;
FontSizeGlyphMap::iterator itr = _sizeGlyphMap.find(fontResUsed); GlyphMap::iterator gitr = glyphmap.find(charcode);
if (itr!=_sizeGlyphMap.end()) if (gitr!=glyphmap.end()) return gitr->second.get();
{
GlyphMap& glyphmap = itr->second;
GlyphMap::iterator gitr = glyphmap.find(charcode);
if (gitr!=glyphmap.end()) return gitr->second.get();
}
} }
Glyph* glyph = _implementation->getGlyph(fontResUsed, charcode); Glyph* glyph = _implementation->getGlyph(fontResUsed, charcode);
if (glyph) if (glyph)
{ {
addGlyph(fontResUsed, charcode, glyph); _sizeGlyphMap[fontResUsed][charcode] = glyph;
return glyph; return glyph;
} }
else return 0; else return 0;
@@ -355,21 +353,18 @@ Glyph3D* Font::getGlyph3D(const FontResolution &fontRes, unsigned int charcode)
FontResolution fontResUsed(0,0); FontResolution fontResUsed(0,0);
if (_implementation->supportsMultipleFontResolutions()) fontResUsed = fontRes; if (_implementation->supportsMultipleFontResolutions()) fontResUsed = fontRes;
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex);
FontSizeGlyph3DMap::iterator itr = _sizeGlyph3DMap.find(fontResUsed);
if (itr!=_sizeGlyph3DMap.end())
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex); Glyph3DMap& glyphmap = itr->second;
FontSizeGlyph3DMap::iterator itr = _sizeGlyph3DMap.find(fontResUsed); Glyph3DMap::iterator gitr = glyphmap.find(charcode);
if (itr!=_sizeGlyph3DMap.end()) if (gitr!=glyphmap.end()) return gitr->second.get();
{
Glyph3DMap& glyphmap = itr->second;
Glyph3DMap::iterator gitr = glyphmap.find(charcode);
if (gitr!=glyphmap.end()) return gitr->second.get();
}
} }
Glyph3D* glyph = _implementation->getGlyph3D(fontResUsed, charcode); Glyph3D* glyph = _implementation->getGlyph3D(fontResUsed, charcode);
if (glyph) if (glyph)
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex);
_sizeGlyph3DMap[fontResUsed][charcode] = glyph; _sizeGlyph3DMap[fontResUsed][charcode] = glyph;
return glyph; return glyph;
} }

View File

@@ -464,6 +464,8 @@ float Glyph::getVerticalAdvance() const { return _verticalAdvance; }
void Glyph::setTextureInfo(ShaderTechnique technique, TextureInfo* info) void Glyph::setTextureInfo(ShaderTechnique technique, TextureInfo* info)
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_textureInfoListMutex);
if (technique>=_textureInfoList.size()) if (technique>=_textureInfoList.size())
{ {
_textureInfoList.resize(technique+1); _textureInfoList.resize(technique+1);
@@ -473,11 +475,15 @@ void Glyph::setTextureInfo(ShaderTechnique technique, TextureInfo* info)
const Glyph::TextureInfo* Glyph::getTextureInfo(ShaderTechnique technique) const const Glyph::TextureInfo* Glyph::getTextureInfo(ShaderTechnique technique) const
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_textureInfoListMutex);
return (technique<_textureInfoList.size()) ? _textureInfoList[technique].get() : 0; return (technique<_textureInfoList.size()) ? _textureInfoList[technique].get() : 0;
} }
Glyph::TextureInfo* Glyph::getOrCreateTextureInfo(ShaderTechnique technique) Glyph::TextureInfo* Glyph::getOrCreateTextureInfo(ShaderTechnique technique)
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_textureInfoListMutex);
if (technique>=_textureInfoList.size()) if (technique>=_textureInfoList.size())
{ {
_textureInfoList.resize(technique+1); _textureInfoList.resize(technique+1);

View File

@@ -513,7 +513,7 @@ bool TextBase::computeMatrix(osg::Matrix& matrix, osg::State* state) const
height = static_cast<value_type>(viewport->height()); height = static_cast<value_type>(viewport->height());
} }
osg::Matrix mvpw = rotate_matrix * modelview * projection * osg::Matrix::scale(width/2.0, height/2.0, 1.0); osg::Matrix mvpw = rotate_matrix * osg::Matrix::translate(_position) * modelview * projection * osg::Matrix::scale(width/2.0, height/2.0, 1.0);
osg::Vec3d origin = osg::Vec3d(0.0, 0.0, 0.0) * mvpw; osg::Vec3d origin = osg::Vec3d(0.0, 0.0, 0.0) * mvpw;
osg::Vec3d left = osg::Vec3d(1.0, 0.0, 0.0) * mvpw - origin; osg::Vec3d left = osg::Vec3d(1.0, 0.0, 0.0) * mvpw - origin;

View File

@@ -205,13 +205,11 @@ void ViewerBase::setThreadingModel(ThreadingModel threadingModel)
{ {
if (_threadingModel == threadingModel) return; if (_threadingModel == threadingModel) return;
bool needSetUpThreading = _threadsRunning;
if (_threadsRunning) stopThreading(); if (_threadsRunning) stopThreading();
_threadingModel = threadingModel; _threadingModel = threadingModel;
if (needSetUpThreading) setUpThreading(); if (isRealized() && _threadingModel!=SingleThreaded) setUpThreading();
} }
ViewerBase::ThreadingModel ViewerBase::suggestBestThreadingModel() ViewerBase::ThreadingModel ViewerBase::suggestBestThreadingModel()

View File

@@ -135,7 +135,7 @@ REGISTER_OBJECT_WRAPPER( DrawArraysIndirect,
osg::DrawArraysIndirect, osg::DrawArraysIndirect,
"osg::Object osg::BufferData osg::PrimitiveSet osg::DrawArraysIndirect" ) "osg::Object osg::BufferData osg::PrimitiveSet osg::DrawArraysIndirect" )
{ {
ADD_OBJECT_SERIALIZER( IndirectCommandArray, osg::IndirectCommandDrawArrays ,new osg::DefaultIndirectCommandDrawArrays()); ADD_OBJECT_SERIALIZER( IndirectCommandArray, osg::IndirectCommandDrawArrays, new osg::DefaultIndirectCommandDrawArrays());
ADD_UINT_SERIALIZER( FirstCommandToDraw, 0); ADD_UINT_SERIALIZER( FirstCommandToDraw, 0);
ADD_INT_SERIALIZER( Stride, 0); ADD_INT_SERIALIZER( Stride, 0);
} }