From 83af5e7a95ca5f43c57fb42970428e47a9dd8adc Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 27 Aug 2002 10:06:57 +0000 Subject: [PATCH] Added osgtexture3D demo, renamed osgtexture demo to osgtexture2D, and have added osgtexture1D demo which currently is simply copy of osgtexture2D. I will be modifying it to do 1D texturing next. Fixed a bug in osg::Texture3D relating to checking of existance of texturing. Merged some fixes to the pfb loader from Ulrich Hertlein. --- Make/debugtests.bat | 12 +- Make/makedefs | 6 +- Make/makedirdefs | 4 +- Make/osgtests.bat | 10 +- .../osgtexture1D.dsp} | 26 +- .../osgtexture2D.dsp} | 316 +----------- .../Demos/osgtexture3D/osgtexture3D.dsp | 95 ++++ VisualStudio/VisualStudio.dsw | 56 +- include/osg/Image | 13 +- .../{osgtexture => osgtexture1D}/Makefile | 4 +- .../Makefile.inst | 4 +- .../osgtexture1D.cpp} | 0 src/Demos/osgtexture2D/Makefile | 15 + src/Demos/osgtexture2D/Makefile.inst | 11 + src/Demos/osgtexture2D/osgtexture2D.cpp | 485 ++++++++++++++++++ src/Demos/osgtexture3D/Makefile | 15 + src/Demos/osgtexture3D/Makefile.inst | 11 + src/Demos/osgtexture3D/osgtexture3D.cpp | 237 +++++++++ src/osg/Image.cpp | 64 ++- src/osg/Texture3D.cpp | 6 +- src/osgPlugins/pfb/ConvertFromPerformer.cpp | 28 +- 21 files changed, 1067 insertions(+), 351 deletions(-) rename VisualStudio/Demos/{osgtexture/osgtexture.dsp => osgtexture1D/osgtexture1D.dsp} (79%) mode change 100755 => 100644 rename VisualStudio/Demos/{osgtexture/osgstereoimage.dsp => osgtexture2D/osgtexture2D.dsp} (69%) mode change 100755 => 100644 create mode 100644 VisualStudio/Demos/osgtexture3D/osgtexture3D.dsp rename src/Demos/{osgtexture => osgtexture1D}/Makefile (85%) rename src/Demos/{osgtexture => osgtexture1D}/Makefile.inst (81%) rename src/Demos/{osgtexture/osgtexture.cpp => osgtexture1D/osgtexture1D.cpp} (100%) create mode 100644 src/Demos/osgtexture2D/Makefile create mode 100644 src/Demos/osgtexture2D/Makefile.inst create mode 100644 src/Demos/osgtexture2D/osgtexture2D.cpp create mode 100644 src/Demos/osgtexture3D/Makefile create mode 100644 src/Demos/osgtexture3D/Makefile.inst create mode 100644 src/Demos/osgtexture3D/osgtexture3D.cpp diff --git a/Make/debugtests.bat b/Make/debugtests.bat index bacb21cd3..5169554d6 100755 --- a/Make/debugtests.bat +++ b/Make/debugtests.bat @@ -91,8 +91,16 @@ echo osgtext osgtext more memleaks.log -echo osgtexture reflect.rgb lz.rgb -osgtexture reflect.rgb lz.rgb +echo osgtexture1D reflect.rgb lz.rgb +osgtexture1D reflect.rgb lz.rgb +more memleaks.log + +echo osgtexture2D reflect.rgb lz.rgb +osgtexture2D reflect.rgb lz.rgb +more memleaks.log + +echo osgtexture3D +osgtexture3D more memleaks.log echo osgviews cow.osg diff --git a/Make/makedefs b/Make/makedefs index c70676274..8517a2491 100644 --- a/Make/makedefs +++ b/Make/makedefs @@ -306,7 +306,7 @@ ifeq ($(OS),Darwin) osgcluster osgconv osgcopy osgcube osggeometry \ osghangglide osgimpostor osgmultitexture osgoccluder \ osgparticle osgprerender osgreflect osgscribe osgstereoimage \ - osgtexture osgversion osgviews sgv + osgtexture1D osgtexture2D osgtexture3D osgversion osgviews sgv endif #### Cygwin/Mingw specific definitions @@ -440,8 +440,8 @@ ifeq ($(OS),MINGW) PLUGIN_DIRS = osg rgb lib3ds flt obj lwo bmp pic tga osgtgz tgz zip # txp DEMOS_DIRS = hangglide osgbillboard osgconv osgcopy osgcube osgimpostor\ - osgreflect osgscribe osgstereoimage osgtexture osgviews \ - osgversion sgv osghud osgtext + osgreflect osgscribe osgstereoimage osgtexture1D osgtexture2D osgtexture3D\ + osgviews osgversion sgv osghud osgtext # osgcluster endif diff --git a/Make/makedirdefs b/Make/makedirdefs index 19651b9d6..3ded395ff 100644 --- a/Make/makedirdefs +++ b/Make/makedirdefs @@ -90,7 +90,9 @@ DEMOS_DIRS = \ osgstereoimage\ osgsequence\ osgtext\ - osgtexture\ + osgtexture1D\ + osgtexture2D\ + osgtexture3D\ osgviews\ osgversion\ sgv diff --git a/Make/osgtests.bat b/Make/osgtests.bat index 3f956a497..b883b6ceb 100755 --- a/Make/osgtests.bat +++ b/Make/osgtests.bat @@ -67,8 +67,14 @@ osgstereoimage dog_left_eye.jpg dog_right_eye.jpg echo osgtext osgtext -echo osgtexture reflect.rgb lz.rgb -osgtexture reflect.rgb lz.rgb +echo osgtexture1D reflect.rgb lz.rgb +osgtexture1D reflect.rgb lz.rgb + +echo osgtexture2D reflect.rgb lz.rgb +osgtexture2D reflect.rgb lz.rgb + +echo osgtexture3D +osgtexture3D echo osgviews cow.osg osgviews cow.osg diff --git a/VisualStudio/Demos/osgtexture/osgtexture.dsp b/VisualStudio/Demos/osgtexture1D/osgtexture1D.dsp old mode 100755 new mode 100644 similarity index 79% rename from VisualStudio/Demos/osgtexture/osgtexture.dsp rename to VisualStudio/Demos/osgtexture1D/osgtexture1D.dsp index 69188d2b7..97ed74d24 --- a/VisualStudio/Demos/osgtexture/osgtexture.dsp +++ b/VisualStudio/Demos/osgtexture1D/osgtexture1D.dsp @@ -1,24 +1,24 @@ -# Microsoft Developer Studio Project File - Name="Demo osgtexture" - Package Owner=<4> +# Microsoft Developer Studio Project File - Name="Demo osgtexture1D" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=Demo osgtexture - Win32 Release +CFG=Demo osgtexture1D - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE -!MESSAGE NMAKE /f "osgtexture.mak". +!MESSAGE NMAKE /f "osgtexture1D.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE -!MESSAGE NMAKE /f "osgtexture.mak" CFG="Demo osgtexture - Win32 Release" +!MESSAGE NMAKE /f "osgtexture1D.mak" CFG="Demo osgtexture1D - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE -!MESSAGE "Demo osgtexture - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "Demo osgtexture - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "Demo osgtexture1D - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "Demo osgtexture1D - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -28,7 +28,7 @@ CFG=Demo osgtexture - Win32 Release CPP=cl.exe RSC=rc.exe -!IF "$(CFG)" == "Demo osgtexture - Win32 Release" +!IF "$(CFG)" == "Demo osgtexture1D - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 @@ -50,9 +50,9 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /pdb:none /machine:I386 /out:"../../../bin/osgtexture.exe" /libpath:"../../../lib" +# ADD LINK32 /nologo /subsystem:console /pdb:none /machine:I386 /out:"../../../bin/osgtexture1D.exe" /libpath:"../../../lib" -!ELSEIF "$(CFG)" == "Demo osgtexture - Win32 Debug" +!ELSEIF "$(CFG)" == "Demo osgtexture1D - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 @@ -74,18 +74,18 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"../../../bin/osgtextured.exe" /pdbtype:sept /libpath:"../../../lib" +# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"../../../bin/osgtexture1Dd.exe" /pdbtype:sept /libpath:"../../../lib" # SUBTRACT LINK32 /incremental:no !ENDIF # Begin Target -# Name "Demo osgtexture - Win32 Release" -# Name "Demo osgtexture - Win32 Debug" +# Name "Demo osgtexture1D - Win32 Release" +# Name "Demo osgtexture1D - Win32 Debug" # Begin Source File -SOURCE=..\..\..\src\Demos\osgtexture\osgtexture.cpp +SOURCE=..\..\..\src\Demos\osgtexture1D\osgtexture1D.cpp # End Source File # End Target # Begin Group "Resource Files" diff --git a/VisualStudio/Demos/osgtexture/osgstereoimage.dsp b/VisualStudio/Demos/osgtexture2D/osgtexture2D.dsp old mode 100755 new mode 100644 similarity index 69% rename from VisualStudio/Demos/osgtexture/osgstereoimage.dsp rename to VisualStudio/Demos/osgtexture2D/osgtexture2D.dsp index 705de090c..61cee0559 --- a/VisualStudio/Demos/osgtexture/osgstereoimage.dsp +++ b/VisualStudio/Demos/osgtexture2D/osgtexture2D.dsp @@ -1,383 +1,95 @@ -# Microsoft Developer Studio Project File - Name="osgstereoimage" - Package Owner=<4> - - - +# Microsoft Developer Studio Project File - Name="Demo osgtexture2D" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 - - - # ** DO NOT EDIT ** - - - - - - # TARGTYPE "Win32 (x86) Console Application" 0x0103 - - - - - - -CFG=osgstereoimage - Win32 Debug - - - +CFG=Demo osgtexture2D - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, - - - !MESSAGE use the Export Makefile command and run - - - !MESSAGE - - - -!MESSAGE NMAKE /f "osgstereoimage.mak". - - - +!MESSAGE NMAKE /f "osgtexture2D.mak". !MESSAGE - - - !MESSAGE You can specify a configuration when running NMAKE - - - !MESSAGE by defining the macro CFG on the command line. For example: - - - !MESSAGE - - - -!MESSAGE NMAKE /f "osgstereoimage.mak" CFG="Demo osgstereoimage - Win32 Debug" - - - +!MESSAGE NMAKE /f "osgtexture2D.mak" CFG="Demo osgtexture2D - Win32 Release" !MESSAGE - - - !MESSAGE Possible choices for configuration are: - - - !MESSAGE - - - -!MESSAGE "Demo osgstereoimage - Win32 Release" (based on "Win32 (x86) Console Application") - - - -!MESSAGE "Demo osgstereoimage - Win32 Debug" (based on "Win32 (x86) Console Application") - - - +!MESSAGE "Demo osgtexture2D - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "Demo osgtexture2D - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE - - - - - - # Begin Project - - - # PROP AllowPerConfigDependencies 0 - - - # PROP Scc_ProjName "" - - - # PROP Scc_LocalPath "" - - - CPP=cl.exe - - - RSC=rc.exe - - - - - - -!IF "$(CFG)" == "Demo osgstereoimage - Win32 Release" - - - - - - +!IF "$(CFG)" == "Demo osgtexture2D - Win32 Release" # PROP BASE Use_MFC 0 - - - # PROP BASE Use_Debug_Libraries 0 - - - # PROP BASE Output_Dir "Release" - - - # PROP BASE Intermediate_Dir "Release" - - - # PROP BASE Target_Dir "" - - - # PROP Use_MFC 0 - - - # PROP Use_Debug_Libraries 0 - - - # PROP Output_Dir "Release" - - - # PROP Intermediate_Dir "Release" - - - # PROP Ignore_Export_Lib 0 - - - # PROP Target_Dir "" - - - # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c - - - # ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c - - - # ADD BASE RSC /l 0x809 /d "NDEBUG" - - - # ADD RSC /l 0x809 /d "NDEBUG" - - - BSC32=bscmake.exe - - - # ADD BASE BSC32 /nologo - - - # ADD BSC32 /nologo - - - LINK32=link.exe - - - # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 /nologo /subsystem:console /pdb:none /machine:I386 /out:"../../../bin/osgtexture2D.exe" /libpath:"../../../lib" - - -# ADD LINK32 /nologo /subsystem:console /pdb:none /machine:I386 /out:"../../../bin/osgstereoimage.exe" /libpath:"../../../lib" - - - - - - - -!ELSEIF "$(CFG)" == "Demo osgstereoimage - Win32 Debug" - - - - - - +!ELSEIF "$(CFG)" == "Demo osgtexture2D - Win32 Debug" # PROP BASE Use_MFC 0 - - - # PROP BASE Use_Debug_Libraries 1 - - - # PROP BASE Output_Dir "Debug" - - - # PROP BASE Intermediate_Dir "Debug" - - - # PROP BASE Target_Dir "" - - - # PROP Use_MFC 0 - - - # PROP Use_Debug_Libraries 1 - - - # PROP Output_Dir "Debug" - - - # PROP Intermediate_Dir "Debug" - - - # PROP Ignore_Export_Lib 0 - - - # PROP Target_Dir "" - - - # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c - - - -# ADD CPP /nologo /MDd /W3 /Gm /vd0 /GR /GX /Zi /Od /I "../../../include" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_DEBUG" /D "FL_DLL" /FR /YX /FD /c - - - +# ADD CPP /nologo /MDd /W3 /Gm /vd0 /GR /GX /Zi /Od /I "../../../include" /D "_CONSOLE" /D "_MBCS" /D "FL_DLL" /D "WIN32" /D "_DEBUG" /FR /YX /FD /c # ADD BASE RSC /l 0x809 /d "_DEBUG" - - - # ADD RSC /l 0x809 /d "_DEBUG" - - - BSC32=bscmake.exe - - - # ADD BASE BSC32 /nologo - - - # ADD BSC32 /nologo - - - LINK32=link.exe - - - # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - - - -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"../../../bin/osgstereoimaged.exe" /pdbtype:sept /libpath:"../../../lib" - - - +# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"../../../bin/osgtexture2Dd.exe" /pdbtype:sept /libpath:"../../../lib" # SUBTRACT LINK32 /incremental:no - - - - - - !ENDIF - - - - - - # Begin Target - - - - - - -# Name "Demo osgstereoimage - Win32 Release" - - - -# Name "Demo osgstereoimage - Win32 Debug" - - - +# Name "Demo osgtexture2D - Win32 Release" +# Name "Demo osgtexture2D - Win32 Debug" # Begin Source File - - - - - - -SOURCE=..\..\..\src\Demos\osgstereoimage\osgstereoimage.cpp - - - +SOURCE=..\..\..\src\Demos\osgtexture2D\osgtexture2D.cpp # End Source File - - - # End Target - - - # Begin Group "Resource Files" - - - - - - # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" - - - # End Group - - - # End Project - - - - - -\c diff --git a/VisualStudio/Demos/osgtexture3D/osgtexture3D.dsp b/VisualStudio/Demos/osgtexture3D/osgtexture3D.dsp new file mode 100644 index 000000000..456800807 --- /dev/null +++ b/VisualStudio/Demos/osgtexture3D/osgtexture3D.dsp @@ -0,0 +1,95 @@ +# Microsoft Developer Studio Project File - Name="Demo osgtexture3D" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=Demo osgtexture3D - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "osgtexture3D.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "osgtexture3D.mak" CFG="Demo osgtexture3D - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Demo osgtexture3D - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "Demo osgtexture3D - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Demo osgtexture3D - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 /nologo /subsystem:console /pdb:none /machine:I386 /out:"../../../bin/osgtexture3D.exe" /libpath:"../../../lib" + +!ELSEIF "$(CFG)" == "Demo osgtexture3D - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /vd0 /GR /GX /Zi /Od /I "../../../include" /D "_CONSOLE" /D "_MBCS" /D "FL_DLL" /D "WIN32" /D "_DEBUG" /FR /YX /FD /c +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"../../../bin/osgtexture3Dd.exe" /pdbtype:sept /libpath:"../../../lib" +# SUBTRACT LINK32 /incremental:no + +!ENDIF + +# Begin Target + +# Name "Demo osgtexture3D - Win32 Release" +# Name "Demo osgtexture3D - Win32 Debug" +# Begin Source File + +SOURCE=..\..\..\src\Demos\osgtexture3D\osgtexture3D.cpp +# End Source File +# End Target +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Project diff --git a/VisualStudio/VisualStudio.dsw b/VisualStudio/VisualStudio.dsw index be31f3873..e23edf17a 100644 --- a/VisualStudio/VisualStudio.dsw +++ b/VisualStudio/VisualStudio.dsw @@ -636,7 +636,61 @@ Package=<4> ############################################################################### -Project: "Demo osgtexture"=.\Demos\osgtexture\osgtexture.dsp - Package Owner=<4> +Project: "Demo osgtexture1D"=.\Demos\osgtexture1D\osgtexture1D.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name Core osg + End Project Dependency + Begin Project Dependency + Project_Dep_Name Core osgDB + End Project Dependency + Begin Project Dependency + Project_Dep_Name Core osgGA + End Project Dependency + Begin Project Dependency + Project_Dep_Name Core osgGLUT + End Project Dependency + Begin Project Dependency + Project_Dep_Name Core osgUtil + End Project Dependency +}}} + +############################################################################### + +Project: "Demo osgtexture2D"=.\Demos\osgtexture2D\osgtexture2D.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name Core osg + End Project Dependency + Begin Project Dependency + Project_Dep_Name Core osgDB + End Project Dependency + Begin Project Dependency + Project_Dep_Name Core osgGA + End Project Dependency + Begin Project Dependency + Project_Dep_Name Core osgGLUT + End Project Dependency + Begin Project Dependency + Project_Dep_Name Core osgUtil + End Project Dependency +}}} + +############################################################################### + +Project: "Demo osgtexture3D"=.\Demos\osgtexture3D\osgtexture3D.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/include/osg/Image b/include/osg/Image index 89ddc91d9..2fe5a72d3 100644 --- a/include/osg/Image +++ b/include/osg/Image @@ -56,9 +56,9 @@ class SG_EXPORT Image : public Object /* allocated a pixel block of specified size and type.*/ - void createImage(int s,int t,int r, - GLenum format,GLenum type, - int packing=1); + void allocateImage(int s,int t,int r, + GLenum format,GLenum type, + int packing=1); /** set the image data and format. @@ -83,6 +83,13 @@ class SG_EXPORT Image : public Object /** Scale image to specified size. */ void scaleImage(const int s,const int t,const int r); + /** Copy a source Image into a subpart of this Image at specified position. + * Typically used to copy to an already allocated image, such as creating + * a 3D image from a stack 2D images. + * If the this Image is empty then image data is created to + * accomodate the imaging image in its offset position. + * If source is NULL then no operation happens, this Image is left unchanged.*/ + void copySubImage(int s_offset,int t_offset,int r_offset,osg::Image* source); /** Width of image.*/ diff --git a/src/Demos/osgtexture/Makefile b/src/Demos/osgtexture1D/Makefile similarity index 85% rename from src/Demos/osgtexture/Makefile rename to src/Demos/osgtexture1D/Makefile index 5a260a80a..6619b5a60 100644 --- a/src/Demos/osgtexture/Makefile +++ b/src/Demos/osgtexture1D/Makefile @@ -2,7 +2,7 @@ TOPDIR = ../../.. include $(TOPDIR)/Make/makedefs CXXFILES =\ - osgtexture.cpp\ + osgtexture1D.cpp\ LIBS += $(OSG_LIBS) $(GLUT_LIB) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) @@ -10,6 +10,6 @@ INSTFILES = \ $(CXXFILES)\ Makefile.inst=Makefile -EXEC = osgtexture +EXEC = osgtexture1D include $(TOPDIR)/Make/makerules diff --git a/src/Demos/osgtexture/Makefile.inst b/src/Demos/osgtexture1D/Makefile.inst similarity index 81% rename from src/Demos/osgtexture/Makefile.inst rename to src/Demos/osgtexture1D/Makefile.inst index 3698d4abd..94350a624 100644 --- a/src/Demos/osgtexture/Makefile.inst +++ b/src/Demos/osgtexture1D/Makefile.inst @@ -2,10 +2,10 @@ TOPDIR = ../.. include $(TOPDIR)/Make/makedefs CXXFILES =\ - osgtexture.cpp\ + osgtexture1D.cpp\ LIBS += $(OSG_LIBS) $(GLUT_LIB) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) -EXEC = osgtexture +EXEC = osgtexture1D include $(TOPDIR)/Make/makerules diff --git a/src/Demos/osgtexture/osgtexture.cpp b/src/Demos/osgtexture1D/osgtexture1D.cpp similarity index 100% rename from src/Demos/osgtexture/osgtexture.cpp rename to src/Demos/osgtexture1D/osgtexture1D.cpp diff --git a/src/Demos/osgtexture2D/Makefile b/src/Demos/osgtexture2D/Makefile new file mode 100644 index 000000000..151f145da --- /dev/null +++ b/src/Demos/osgtexture2D/Makefile @@ -0,0 +1,15 @@ +TOPDIR = ../../.. +include $(TOPDIR)/Make/makedefs + +CXXFILES =\ + osgtexture2D.cpp\ + +LIBS += $(OSG_LIBS) $(GLUT_LIB) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) + +INSTFILES = \ + $(CXXFILES)\ + Makefile.inst=Makefile + +EXEC = osgtexture2D + +include $(TOPDIR)/Make/makerules diff --git a/src/Demos/osgtexture2D/Makefile.inst b/src/Demos/osgtexture2D/Makefile.inst new file mode 100644 index 000000000..70e4a3bfa --- /dev/null +++ b/src/Demos/osgtexture2D/Makefile.inst @@ -0,0 +1,11 @@ +TOPDIR = ../.. +include $(TOPDIR)/Make/makedefs + +CXXFILES =\ + osgtexture2D.cpp\ + +LIBS += $(OSG_LIBS) $(GLUT_LIB) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) + +EXEC = osgtexture2D + +include $(TOPDIR)/Make/makerules diff --git a/src/Demos/osgtexture2D/osgtexture2D.cpp b/src/Demos/osgtexture2D/osgtexture2D.cpp new file mode 100644 index 000000000..04ee5daf8 --- /dev/null +++ b/src/Demos/osgtexture2D/osgtexture2D.cpp @@ -0,0 +1,485 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + + +// +// A simple demo demonstrating different texturing modes, +// including using of texture extensions. +// + + +typedef std::vector< osg::ref_ptr > ImageList; + +class Texture2DCallback : public osg::NodeCallback +{ + public: + Texture2DCallback(osg::Texture2D* texture):_texture(texture) + { + _filterRange.push_back(osg::Texture2D::LINEAR); + _filterRange.push_back(osg::Texture2D::LINEAR_MIPMAP_LINEAR); + _filterRange.push_back(osg::Texture2D::LINEAR_MIPMAP_NEAREST); + _filterRange.push_back(osg::Texture2D::NEAREST); + _filterRange.push_back(osg::Texture2D::NEAREST_MIPMAP_LINEAR); + _filterRange.push_back(osg::Texture2D::NEAREST_MIPMAP_NEAREST); + _currPos = 0; + _prevTime = 0.0; + } + + virtual ~Texture2DCallback() {} + + virtual void operator()(osg::Node*, osg::NodeVisitor* nv) + { + if (nv->getFrameStamp()) + { + double currTime = nv->getFrameStamp()->getReferenceTime(); + if (currTime-_prevTime>1.0) + { + std::cout<<"Updating texturing filter to "<setFilter(osg::Texture2D::MAG_FILTER,_filterRange[_currPos]); + _currPos++; + if (_currPos>=_filterRange.size()) _currPos=0; + _prevTime = currTime; + } + } + } + + osg::ref_ptr _texture; + std::vector _filterRange; + osg::uint _currPos; + double _prevTime; +}; + + +/** + * Function to read several images files (typically one) as specified + * on the command line, and return them in an ImageList + */ +ImageList getImagesFromFiles(std::vector& commandLine) +{ + + ImageList imageList; + + for(std::vector::iterator itr=commandLine.begin(); + itr!=commandLine.end(); + ++itr) + { + if ((*itr)[0]!='-') + { + // not an option so assume string is a filename. + osg::Image *image = osgDB::readImageFile( *itr ); + if (image) + { + imageList.push_back(image); + } + + } + } + + if (imageList.size()==0) + { + osg::notify(osg::WARN) << "No image data loaded."<setVertexArray(coords); + + osg::Vec3Array* norms = new osg::Vec3Array(1); + (*norms)[0].set(0.0f,-1.0f,0.0f); + geom->setNormalArray(norms); + geom->setNormalBinding(osg::Geometry::BIND_OVERALL); + + osg::Vec2Array* tcoords = new osg::Vec2Array(4); + (*tcoords)[0].set(0.0f,textureCoordMax); + (*tcoords)[1].set(0.0f,0.0f); + (*tcoords)[2].set(textureCoordMax,0.0f); + (*tcoords)[3].set(textureCoordMax,textureCoordMax); + geom->setTexCoordArray(0,tcoords); + + geom->addPrimitive(osgNew osg::DrawArrays(osg::Primitive::QUADS,0,4)); + + return geom; +} + +osg::Node* createTexturedItem(const osg::Vec3& offset,osg::Texture2D* texture,osg::Node* geometry) +{ + // create a tranform node to position each square in appropriate + // place and also to add individual texture set to it, so that + // that state is inherited down to its children. + osg::MatrixTransform* local_transform = new osg::MatrixTransform; + local_transform->postMult(osg::Matrix::translate(offset)); + + // create the StateSet to store the texture data + osg::StateSet* stateset = new osg::StateSet; + + stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON); + + // turn the face culling off so you can see the texture from + // all angles. + stateset->setMode(GL_CULL_FACE,osg::StateAttribute::OFF); + + // attach the setset to tranform node. + local_transform->setStateSet(stateset); + + // add the geode to the transform. + local_transform->addChild(geometry); + + return local_transform; +} + +osg::Node* createLayer(const osg::Vec3& offset,osg::Image* image,osg::Node* geometry,osg::Node* geometryRep) +{ + if (image==NULL) return NULL; + + osg::MatrixTransform* top_transform = new osg::MatrixTransform; + top_transform->postMult(osg::Matrix::translate(offset)); + + osg::Vec3 local_offset(0.0f,0.0f,0.0f); + osg::Vec3 local_delta(3.0f,0.0f,0.0f); + +// // use DrawPixels drawable to draw a pixel image. +// { +// +// osg::DrawPixels* drawimage = osgNew osg::DrawPixels; +// drawimage->setPosition(local_offset); +// drawimage->setImage(image); +// +// osg::Geode* geode = osgNew osg::Geode; +// geode->addDrawable(drawimage); +// +// // add the transform node to root group node. +// top_transform->addChild(geode); +// +// local_offset += local_delta; +// } + + + // defaults mipmapped texturing. + { + // create the texture attribute + osg::Texture2D* texture = new osg::Texture2D; + texture->setImage(image); + + // add the transform node to root group node. + top_transform->addChild(createTexturedItem(local_offset,texture,geometry)); + + local_offset += local_delta; + + // top_transform->setAppCallback(new TextureCallback(texture)); + + } + + + // bilinear + { + // create the texture attribute + osg::Texture2D* texture = new osg::Texture2D; + texture->setImage(image); + + // set up bilinear filtering. + texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR_MIPMAP_NEAREST); + texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); + + // add the transform node to root group node. + top_transform->addChild(createTexturedItem(local_offset,texture,geometry)); + + local_offset += local_delta; + + } + + // trilinear + { + // create the texture attribute + osg::Texture2D* texture = new osg::Texture2D; + texture->setImage(image); + + // set up trilinear filtering. + texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR_MIPMAP_LINEAR); + texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); + + // add the transform node to root group node. + top_transform->addChild(createTexturedItem(local_offset,texture,geometry)); + + local_offset += local_delta; + + } + + + // anisotropic + { + // create the texture attribute + osg::Texture2D* texture = new osg::Texture2D; + texture->setImage(image); + + // set up anistropic filtering. + texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR_MIPMAP_LINEAR); + texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); + texture->setMaxAnisotropy(2.0f); + + // add the transform node to root group node. + top_transform->addChild(createTexturedItem(local_offset,texture,geometry)); + + local_offset += local_delta; + + } + + // arb compression + { + // create the texture attribute + osg::Texture2D* texture = new osg::Texture2D; + texture->setImage(image); + + texture->setInternalFormatMode(osg::Texture2D::USE_ARB_COMPRESSION); + + // add the transform node to root group node. + top_transform->addChild(createTexturedItem(local_offset,texture,geometry)); + + local_offset += local_delta; + + } + + // s3tc_dxt1 compression + { + // create the texture attribute + osg::Texture2D* texture = new osg::Texture2D; + texture->setImage(image); + + texture->setInternalFormatMode(osg::Texture2D::USE_S3TC_DXT1_COMPRESSION); + + // add the transform node to root group node. + top_transform->addChild(createTexturedItem(local_offset,texture,geometry)); + + local_offset += local_delta; + + } + + // default wrap mode. (osg::Texture2D::CLAMP) + { + // create the texture attribute + osg::Texture2D* texture = new osg::Texture2D; + texture->setImage(image); + + // add the transform node to root group node. + top_transform->addChild(createTexturedItem(local_offset,texture,geometryRep)); + + local_offset += local_delta; + + } + + // clamp-to-edge mode. + { + // create the texture attribute + osg::Texture2D* texture = new osg::Texture2D; + texture->setImage(image); + + texture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE); + texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE); + + // add the transform node to root group node. + top_transform->addChild(createTexturedItem(local_offset,texture,geometryRep)); + + local_offset += local_delta; + + } + + // repeat wrap mode. + { + // create the texture attribute + osg::Texture2D* texture = new osg::Texture2D; + texture->setImage(image); + + texture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::REPEAT); + texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::REPEAT); + + // add the transform node to root group node. + top_transform->addChild(createTexturedItem(local_offset,texture,geometryRep)); + + local_offset += local_delta; + + } + + // mirror wrap mode. + { + // create the texture attribute + osg::Texture2D* texture = new osg::Texture2D; + texture->setImage(image); + + texture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::MIRROR); + texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::MIRROR); + + // add the transform node to root group node. + top_transform->addChild(createTexturedItem(local_offset,texture,geometryRep)); + + local_offset += local_delta; + + } + + return top_transform; +} + +osg::Node* createModelFromImages(ImageList& imageList) +{ + + if (imageList.empty()) return NULL; + + // create the root node which will hold the model. + osg::Group* root = new osg::Group(); + + // create a single drawable to be shared by each texture instance. + osg::Drawable* drawable_noTexCoodRep = createSquare(1.0f); + + // add the drawable into a single goede to be shared... + osg::Geode* geode_noTexCoodRep = new osg::Geode(); + geode_noTexCoodRep->addDrawable(drawable_noTexCoodRep); + + + // create a single drawable to be shared by each texture instance. + osg::Drawable* drawable_texCoodRep = createSquare(2.0f); + + // add the drawable into a single goede to be shared... + osg::Geode* geode_texCoodRep = new osg::Geode(); + geode_texCoodRep->addDrawable(drawable_texCoodRep); + + osg::Vec3 offset(0.0f,0.0f,0.0f); + osg::Vec3 delta(0.0f,0.0f,3.0f); + + // step through the image list processing each image in turn. + for(ImageList::iterator itr=imageList.begin(); + itr!=imageList.end(); + ++itr) + { + + // add the transform node to root group node. + root->addChild(createLayer(offset,itr->get(),geode_noTexCoodRep,geode_texCoodRep)); + + offset += delta; + + } + + return root; +} + + +void write_usage(std::ostream& out,const std::string& name) +{ + out << std::endl; + out <<"usage:"<< std::endl; + out <<" "< commandLine; + for(int i=1;i +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + + +// +// A simple demo demonstrating different texturing modes, +// including using of texture extensions. +// + + +typedef std::vector< osg::ref_ptr > ImageList; + + +class ConstructStateCallback : public osg::NodeCallback +{ + public: + ConstructStateCallback() {} + + osg::StateSet* constructState() + { + + // read 4 2d images + osg::ref_ptr image_0 = osgDB::readImageFile("lz.rgb"); + osg::ref_ptr image_1 = osgDB::readImageFile("reflect.rgb"); + osg::ref_ptr image_2 = osgDB::readImageFile("tank.rgb"); + osg::ref_ptr image_3 = osgDB::readImageFile("skymap.jpg"); + + if (!image_0 || !image_1 || !image_2 || !image_3) + { + return 0; + } + + if (image_0->getPixelFormat()!=image_1->getPixelFormat() || image_0->getPixelFormat()!=image_2->getPixelFormat() || image_0->getPixelFormat()!=image_3->getPixelFormat()) + { + return 0; + } + + + // scale them all to the same size. + image_0->scaleImage(256,256,1); + image_1->scaleImage(256,256,1); + image_2->scaleImage(256,256,1); + image_3->scaleImage(256,256,1); + + + // then allocated a 3d image to use for texturing. + osg::Image* image_3d = new osg::Image; + image_3d->allocateImage(256,256,4, + image_0->getPixelFormat(),image_0->getDataType()); + + // copy the 2d images into the 3d image. + image_3d->copySubImage(0,0,0,image_0.get()); + image_3d->copySubImage(0,0,1,image_1.get()); + image_3d->copySubImage(0,0,2,image_2.get()); + image_3d->copySubImage(0,0,3,image_3.get()); + + image_3d->setInternalTextureFormat(image_0->getInternalTextureFormat()); + + // set up the 3d texture itself, + // note, well set the filtering up so that mip mapping is disabled, + // gluBuild3DMipsmaps doesn't do a very good job of handled the + // inbalanced dimensions of the 256x256x4 texture. + osg::Texture3D* texture3D = new osg::Texture3D; + texture3D->setFilter(osg::Texture3D::MIN_FILTER,osg::Texture3D::LINEAR); + texture3D->setFilter(osg::Texture3D::MAG_FILTER,osg::Texture3D::LINEAR); + texture3D->setImage(image_3d); + + + // create a texgen to generate a R texture coordinate, the geometry + // itself will supply the S & T texture coordinates. + // in the animateStateSet callback well alter this R value to + // move the texture through the 3d texture, 3d texture filtering + // will do the blending for us. + osg::TexGen* texgen = new osg::TexGen; + texgen->setMode(osg::TexGen::OBJECT_LINEAR); + texgen->setPlane(osg::TexGen::R, osg::Vec4(0.0f,0.0f,0.0f,0.2f)); + + // create the StateSet to store the texture data + osg::StateSet* stateset = new osg::StateSet; + stateset->setTextureMode(0,GL_TEXTURE_GEN_R,osg::StateAttribute::ON); + stateset->setTextureAttribute(0,texgen); + stateset->setTextureAttributeAndModes(0,texture3D,osg::StateAttribute::ON); + + return stateset; + } + + void animateState(osg::StateSet* stateset) + { + // here we simply get any existing texgen, and then increment its + // plane, pushing the R coordinate through the texture. + osg::StateAttribute* attribute = stateset->getTextureAttribute(0,osg::StateAttribute::TEXGEN); + osg::TexGen* texgen = dynamic_cast(attribute); + if (texgen) + { + texgen->setPlane(osg::TexGen::R, texgen->getPlane(osg::TexGen::R)+osg::Vec4(0.0f,0.0f,0.0f,0.001f)); + } + + } + + virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) + { + + osg::StateSet* stateset = node->getStateSet(); + if (stateset) + { + // we have an exisitng stateset, so lets animate it. + animateState(stateset); + } + else + { + // no state exist yet, so we must be in the first + // pass, so lets create our stateset with all the + // textures in it. + stateset = constructState(); + if (stateset) node->setStateSet(stateset); + } + + // note, callback is repsonsible for scenegraph traversal so + // should always include call the traverse(node,nv) to ensure + // that the rest of cullbacks and the scene graph are traversed. + traverse(node,nv); + } +}; + +/** create 2,2 square with center at 0,0,0 and aligned along the XZ plan */ +osg::Drawable* createSquare(float textureCoordMax=1.0f) +{ + // set up the Geometry. + osg::Geometry* geom = new osg::Geometry; + + osg::Vec3Array* coords = new osg::Vec3Array(4); + (*coords)[0].set(-1.0f,0.0f,1.0f); + (*coords)[1].set(-1.0f,0.0f,-1.0f); + (*coords)[2].set(1.0f,0.0f,-1.0f); + (*coords)[3].set(1.0f,0.0f,1.0f); + geom->setVertexArray(coords); + + osg::Vec3Array* norms = new osg::Vec3Array(1); + (*norms)[0].set(0.0f,-1.0f,0.0f); + geom->setNormalArray(norms); + geom->setNormalBinding(osg::Geometry::BIND_OVERALL); + + osg::Vec2Array* tcoords = new osg::Vec2Array(4); + (*tcoords)[0].set(0.0f,textureCoordMax); + (*tcoords)[1].set(0.0f,0.0f); + (*tcoords)[2].set(textureCoordMax,0.0f); + (*tcoords)[3].set(textureCoordMax,textureCoordMax); + geom->setTexCoordArray(0,tcoords); + + geom->addPrimitive(osgNew osg::DrawArrays(osg::Primitive::QUADS,0,4)); + + return geom; +} + +osg::Node* createModel() +{ + + // create the geometry of the model, just a simple 2d quad right now. + osg::Geode* geode = new osg::Geode; + geode->addDrawable(createSquare()); + + // normally we'd create the stateset's to contain all the textures + // etc here, but, the above technique uses osg::Image::scaleImage and + // osg::Image::copySubImage() which are implemented with OpenGL utility + // library, which unfortunately can't be used until we have a valid + // OpenGL context, and at this point in initilialization we don't have + // a valid OpenGL context, so we have to delay creation of state until + // there is a valid OpenGL context. I'll manage this by using an + // app callback which will create the state during the first traversal. + // A bit hacky, and my plan is to reimplement the osg::scaleImage and + // osg::Image::copySubImage() without using GLU which will get round + // this current limitation. + geode->setAppCallback(new ConstructStateCallback()); + + return geode; + +} + + +int main( int argc, char **argv ) +{ + + // initialize the GLUT + glutInit( &argc, argv ); + + // create the commandline args. + std::vector commandLine; + for(int i=1;ir(),t_offset+source->t(),r_offset+source->t(), + source->getPixelFormat(),source->getDataType(), + source->getPacking()); + } + + if (s_offset>=_s || t_offset>=_t || r_offset>=_r) + { + notify(WARN)<<"Warning: offsets passed to Image::copySubImage(..) outside destination image, operation ignored."<getPixelFormat()) + { + notify(WARN)<<"Warning: image with an incompatible pixel formats passed to Image::copySubImage(..), operation ignored."<getPacking()); + glPixelStorei(GL_PACK_ROW_LENGTH,_s); + + glPixelStorei(GL_UNPACK_ALIGNMENT,_packing); + + GLint status = gluScaleImage(_pixelFormat, + source->s(), + source->t(), + source->getDataType(), + source->data(), + source->s(), + source->t(), + _dataType, + data_destination); + + glPixelStorei(GL_PACK_ROW_LENGTH,0); + + if (status!=0) + { + notify(WARN) << "Error Image::scaleImage() do not succeed : errorString = "<=0 || isGLExtensionSupported("GL_EXT_texture3D"); - if (s_texturing_supported) + if (!s_texturing_supported) { notify(WARN)<<"Warning: Texture3D::apply(..) failed, 3D texturing is not support by your OpenGL drivers."<ensureValidSizeForTexturing(); glPixelStorei(GL_UNPACK_ALIGNMENT,image->getPacking()); - - if( _min_filter == LINEAR || _min_filter == NEAREST ) { diff --git a/src/osgPlugins/pfb/ConvertFromPerformer.cpp b/src/osgPlugins/pfb/ConvertFromPerformer.cpp index 459ca5e58..c75b04f10 100644 --- a/src/osgPlugins/pfb/ConvertFromPerformer.cpp +++ b/src/osgPlugins/pfb/ConvertFromPerformer.cpp @@ -1125,19 +1125,19 @@ osg::Material* ConvertFromPerformer::visitMaterial(osg::StateSet* osgStateSet,pf } -static osg:::Texture2D::FilterMode getTexfilter(int filter, int pftype) +static osg::Texture2D::FilterMode getTexfilter(int filter, int pftype) { if (filter == PFTEX_MINFILTER) { if (pftype & PFTEX_LINEAR) - return osg:::Texture2D::NEAREST_MIPMAP_LINEAR; + return osg::Texture2D::NEAREST_MIPMAP_LINEAR; else if (pftype & PFTEX_BILINEAR) - return osg:::Texture2D::LINEAR_MIPMAP_NEAREST; + return osg::Texture2D::LINEAR_MIPMAP_NEAREST; else if (pftype & PFTEX_TRILINEAR) - return osg:::Texture2D::LINEAR_MIPMAP_LINEAR; + return osg::Texture2D::LINEAR_MIPMAP_LINEAR; - return osg:::Texture2D::NEAREST_MIPMAP_LINEAR; + return osg::Texture2D::NEAREST_MIPMAP_LINEAR; } else @@ -1147,7 +1147,7 @@ static osg:::Texture2D::FilterMode getTexfilter(int filter, int pftype) // not quite sure what is supposed to be interpret the Peformer // filter modes here so will simple go with OpenGL default. - return osg:::Texture2D::LINEAR; + return osg::Texture2D::LINEAR; } } @@ -1173,26 +1173,26 @@ osg::Texture2D* ConvertFromPerformer::visitTexture(osg::StateSet* osgStateSet,pf int repeat_t = tex->getRepeat(PFTEX_WRAP_T); if (repeat_r==PFTEX_CLAMP) - osgTexture->setWrap(osg:::Texture2D::WRAP_R,osg:::Texture2D::CLAMP); + osgTexture->setWrap(osg::Texture2D::WRAP_R,osg::Texture2D::CLAMP); else - osgTexture->setWrap(osg:::Texture2D::WRAP_R,osg:::Texture2D::REPEAT); + osgTexture->setWrap(osg::Texture2D::WRAP_R,osg::Texture2D::REPEAT); if (repeat_s==PFTEX_CLAMP) - osgTexture->setWrap(osg:::Texture2D::WRAP_S,osg:::Texture2D::CLAMP); + osgTexture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP); else - osgTexture->setWrap(osg:::Texture2D::WRAP_S,osg:::Texture2D::REPEAT); + osgTexture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::REPEAT); if (repeat_t==PFTEX_CLAMP) - osgTexture->setWrap(osg:::Texture2D::WRAP_T,osg:::Texture2D::CLAMP); + osgTexture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP); else - osgTexture->setWrap(osg:::Texture2D::WRAP_T,osg:::Texture2D::REPEAT); + osgTexture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::REPEAT); // filter #if 1 - osgTexture->setFilter(osg:::Texture2D::MIN_FILTER, + osgTexture->setFilter(osg::Texture2D::MIN_FILTER, getTexfilter(PFTEX_MINFILTER, tex->getFilter(PFTEX_MINFILTER))); - osgTexture->setFilter(osg:::Texture2D::MAG_FILTER, + osgTexture->setFilter(osg::Texture2D::MAG_FILTER, getTexfilter(PFTEX_MAGFILTER, tex->getFilter(PFTEX_MAGFILTER))); #endif