#include <OSGDVRSimpleLUTShader.h>
Inheritance diagram for osg::DVRSimpleLUTShader:

Volume Rendering | |
| *virtual bool | initialize (DVRVolume *volume, DrawActionBase *action) |
| Callback to set up shader - register textures here. | |
| virtual void | activate (DVRVolume *volume, DrawActionBase *action) |
| Callback before any slice is rendered - setup per volume. | |
| virtual void | brickActivate (DVRVolume *volume, DrawActionBase *action, Brick *brick) |
| Callback before any brick - state setup per brick. | |
| virtual void | deactivate (DVRVolume *volume, DrawActionBase *action) |
| Callback after all rendering of the volume is done. | |
| virtual void | cleanup (DVRVolume *volume, DrawActionBase *action) |
| Callback to clean up shader resources. | |
Sync | |
| *void | executeSyncImpl (DVRSimpleLUTShaderBase *pOther, const BitVector &whichField) |
| virtual void | executeSync (FieldContainer &other, const BitVector &whichField) |
Public Types | |
| typedef DVRSimpleLUTShaderPtr | Ptr |
| enum | { LutModeFieldId = Inherited::NextFieldId, ActiveLutModeFieldId = LutModeFieldId + 1, NextFieldId = ActiveLutModeFieldId + 1 } |
Public Member Functions | |
Sync | |
| *virtual void | changed (BitVector whichField, UInt32 from) |
| react to field changes | |
Output | |
| *virtual void | dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const |
| output the instance for debug purposes | |
FieldContainer Get | |
| *virtual FieldContainerType & | getType (void) |
| virtual const FieldContainerType & | getType (void) const |
| virtual UInt32 | getContainerSize (void) const |
Binary Access | |
| *virtual UInt32 | getBinSize (const BitVector &whichField) |
| virtual void | copyToBin (BinaryDataHandler &pMem, const BitVector &whichField) |
| virtual void | copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField) |
Copy | |
| *virtual FieldContainerPtr | shallowCopy (void) const |
Volume Rendering | |
| virtual void | renderSlice (DVRVolume *volume, DrawActionBase *action, Real32 *data, UInt32 vertices, UInt32 values) |
| virtual void | renderSlice (DVRVolume *volume, DrawActionBase *action, DVRRenderSlice *clippedSlice) |
| virtual bool | hasRenderCallback (void) |
| virtual bool | useMTSlabs (void) |
Static Public Member Functions | |
Class Get | |
| *static FieldContainerType & | getClassType (void) |
| access the type of the class | |
| static UInt32 | getClassTypeId (void) |
| access the numerical type of the class | |
Construction | |
| *static DVRSimpleLUTShaderPtr | create (void) |
| create a new instance of the class | |
| static DVRSimpleLUTShaderPtr | createEmpty (void) |
| create an empty new instance of the class, do not copy the prototype | |
Static Public Attributes | |
| static const osg::BitVector | LutModeFieldMask |
| static const osg::BitVector | ActiveLutModeFieldMask |
| static const osg::BitVector | MTInfluenceMask |
| static const BitVector | NextFieldMask |
Protected Types | |
| enum | LutMode { LM_AUTO = 0, LM_TABLE_SGI, LM_PALETTE_EXT, LM_DEPENDENT, LM_FRAGPROG, LM_RELOAD, LM_NO } |
Protected Member Functions | |
Constructors | |
| * | DVRSimpleLUTShader (void) |
| Constructor. | |
| DVRSimpleLUTShader (const DVRSimpleLUTShader &source) | |
| Copy Constructor. | |
Destructors | |
| *virtual | ~DVRSimpleLUTShader (void) |
| Destructor. | |
Protected Attributes | |
| UInt8 | m_nTexturePaletteMode |
| Int8 | m_nTextureMode |
| FragmentProgramChunkPtr | m_pFragProg |
| TextureChunkPtr | m_pDepTexture |
| Int32 | m_nTextureId |
Private Types | |
| typedef DVRSimpleLUTShaderBase | Inherited |
Private Member Functions | |
| void | operator= (const DVRSimpleLUTShader &source) |
Static Private Member Functions | |
| static void | initMethod (void) |
| initialize the static features of the class, e.g. action callbacks | |
Static Private Attributes | |
| static char | _fragProg2D [] |
| static char | _fragProg3D [] |
| static char | _fragProg2DMulti [] |
| static UInt32 | _sgiTexColorTable |
| static UInt32 | _extPalettedTexture |
| static UInt32 | _extSharedPalettedTexture |
| static UInt32 | _arbMultitexture |
| static UInt32 | _nvTextureShader2 |
| static UInt32 | _arbFragmentProgram |
| static UInt32 | _nvRegisterCombiners |
| static UInt32 | _funcColorTableSGI |
| static UInt32 | _funcColorTableEXT |
| static UInt32 | _funcActiveTextureARB |
| static UInt32 | _funcFinalCombinerInputNV |
| static UInt32 | _funcCombinerInputNV |
| static UInt32 | _funcCombinerOutputNV |
Friends | |
| class | FieldContainer |
| class | DVRSimpleLUTShaderBase |
Definition at line 57 of file OSGDVRSimpleLUTShader.h.
|
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Reimplemented in osg::DVRMtexLUTShader, and osg::DVRMtexLUTShaderBase. Definition at line 62 of file OSGDVRSimpleLUTShader.h. |
|
|
Reimplemented from osg::DVRSimpleShaderBase. Reimplemented in osg::DVRMtexLUTShaderBase. Definition at line 91 of file OSGDVRSimpleLUTShaderBase.h. |
|
|
Definition at line 120 of file OSGDVRSimpleLUTShader.h. 00121 { 00122 LM_AUTO = 0, 00123 LM_TABLE_SGI, 00124 LM_PALETTE_EXT, 00125 LM_DEPENDENT, 00126 LM_FRAGPROG, 00127 LM_RELOAD, 00128 LM_NO 00129 };
|
|
|
Reimplemented from osg::FieldContainer. Definition at line 93 of file OSGDVRSimpleLUTShaderBase.h. 00094 { 00095 LutModeFieldId = Inherited::NextFieldId, 00096 ActiveLutModeFieldId = LutModeFieldId + 1, 00097 NextFieldId = ActiveLutModeFieldId + 1 00098 };
|
|
|
|
Definition at line 168 of file OSGDVRSimpleLUTShader.cpp. 00168 : 00169 Inherited (source), 00170 m_nTexturePaletteMode( LM_NO), 00171 m_nTextureMode ( -1), 00172 m_pFragProg (NullFC), 00173 m_pDepTexture (NullFC) 00174 { 00175 }
|
|
|
Definition at line 179 of file OSGDVRSimpleLUTShader.cpp. References destroyDependentTexture(), m_pFragProg, osg::NullFC, and osg::subRefCP(). 00180 { 00181 if(m_pFragProg != NullFC) 00182 { 00183 subRefCP(m_pFragProg); 00184 00185 m_pFragProg = NullFC; 00186 } 00187 00188 destroyDependentTexture(); 00189 }
|
|
||||||||||||
|
Reimplemented from osg::DVRSimpleShader. Reimplemented in osg::DVRMtexLUTShader. Definition at line 593 of file OSGDVRSimpleLUTShader.cpp. References osg::DVRSimpleShader::changed(), FDEBUG, FWARNING, LM_AUTO, osg::DVRSimpleLUTShaderBase::LutModeFieldMask, and osg::DVRSimpleLUTShaderBase::setActiveLutMode(). Referenced by osg::DVRMtexLUTShader::changed(). 00594 { 00595 FDEBUG(("DVRSimpleLUTShader::changed\n")); 00596 FWARNING(("DVRSimpleLUTShader::changed\n")); 00597 00598 // trigger re-initialization 00599 if(whichField & LutModeFieldMask) 00600 { 00601 setActiveLutMode(LM_AUTO); 00602 } 00603 00604 Inherited::changed(whichField, origin); 00605 }
|
|
||||||||||||
|
Reimplemented from osg::DVRSimpleShader. Reimplemented in osg::DVRMtexLUTShader. Definition at line 608 of file OSGDVRSimpleLUTShader.cpp. References SLOG. 00610 { 00611 SLOG << "Dump DVRSimpleLUTShader NI" << std::endl; 00612 }
|
|
||||||||||||
|
! Should fix uninizialized textures Reimplemented from osg::DVRSimpleShader. Reimplemented in osg::DVRMtexLUTShader. Definition at line 616 of file OSGDVRSimpleLUTShader.cpp. References osg::beginEditCP(), DVRVOLUME_PARAMETER, osg::endEditCP(), FWARNING, osg::DVRSimpleLUTShaderBase::getLutMode(), getPaletteFormat(), osg::DVRVolume::getTextureManager(), osg::DVRVolume::getTextureMode(), osg::DrawActionBase::getWindow(), GLenum, isModeSupported(), LM_AUTO, LM_NO, osg::DVRSimpleShader::m_nTextureId, m_nTexturePaletteMode, osg::NullFC, osg::TextureManager::registerTexture(), osg::TextureManager::reloadTexture(), selectMode(), osg::DVRSimpleLUTShaderBase::setActiveLutMode(), SWARNING, and osg::DVRLookupTableBase::TouchedFieldMask. Referenced by activate(). 00617 { 00618 FWARNING(("DVRSimpleLUTShader::initialize\n")); 00619 00620 GLenum nInternalFormat = GL_INTENSITY; 00621 GLenum nExternalFormat = GL_LUMINANCE; 00622 00623 m_nTexturePaletteMode = LM_NO; 00624 m_nTextureId = -1; 00625 00626 Window *win = action->getWindow(); 00627 00628 // Determine lookup table mechanism 00629 if(getLutMode() != LM_AUTO) 00630 { 00631 // A certain mode has been selected 00632 if(isModeSupported(action, getLutMode(), volume->getTextureMode(win))) 00633 { 00634 SWARNING << "DVRSimpleLUTShader - User specified lookup table " 00635 << "mode " 00636 << int(getLutMode()) << std::endl; 00637 00638 m_nTexturePaletteMode = getLutMode(); 00639 } 00640 else 00641 { 00642 SWARNING << "DVRSimpleLUTShader - Unsupported lookup table mode " 00643 << int(getLutMode()) << " disabling LUT" << std::endl; 00644 00645 m_nTexturePaletteMode = LM_NO; 00646 } 00647 } 00648 else 00649 { 00650 // Use automatic mode selection 00651 m_nTexturePaletteMode = selectMode(action, 00652 volume->getTextureMode(win)); 00653 } 00654 00655 setActiveLutMode(m_nTexturePaletteMode); 00656 00657 getPaletteFormat(action, 00658 m_nTexturePaletteMode, 00659 nInternalFormat, 00660 nExternalFormat ); 00661 00662 DVRLookupTablePtr lut = DVRVOLUME_PARAMETER(volume, DVRLookupTable ); 00663 DVRVolumeTexturePtr vol = DVRVOLUME_PARAMETER(volume, DVRVolumeTexture); 00664 00665 if((volume == NULL) || (vol == NullFC)) 00666 { 00667 SWARNING << "NO Volume..." << std::endl; 00668 00669 return false; 00670 } 00671 00672 m_nTextureId = volume->getTextureManager().registerTexture( 00673 vol->getImage(), // image 00674 nInternalFormat, // internalFormat 00675 nExternalFormat, // externalFormat 00676 1, // doBricking 00677 0, // textureStage0 00678 -1); // textureStage1 00679 00680 if(m_nTextureId == -1) 00681 { 00682 SWARNING << "Error registering textures ..." << std::endl; 00683 00684 return false; 00685 } 00686 else 00687 { 00688 SWARNING << "New texture Id: " << m_nTextureId << std::endl; 00689 00691 volume->getTextureManager().reloadTexture(m_nTextureId, action); 00692 } 00693 00694 if(lut != NullFC) 00695 { 00696 beginEditCP(lut, DVRLookupTable::TouchedFieldMask); 00697 { 00698 lut->setTouched(true); // force initialization in first render 00699 // pass 00700 } 00701 endEditCP (lut, DVRLookupTable::TouchedFieldMask); 00702 } 00703 00704 return true; 00705 }
|
|
||||||||||||
|
! Texture Stage 1 - dependent lookup ! Texture Stage 0 - ordinary lookup ! Register combiners to account for alpha value correction Reimplemented from osg::DVRSimpleShader. Reimplemented in osg::DVRMtexLUTShader. Definition at line 739 of file OSGDVRSimpleLUTShader.cpp. References _extSharedPalettedTexture, _fragProg2D, _fragProg2DMulti, _fragProg3D, _funcActiveTextureARB, _funcColorTableEXT, _funcColorTableSGI, _sgiTexColorTable, osg::DVRSimpleShader::activate(), osg::addRefCP(), osg::beginEditCP(), cleanup(), osg::FragmentProgramChunkBase::create(), DVRVOLUME_PARAMETER, osg::endEditCP(), FDEBUG, FFATAL, osg::DVRSimpleLUTShaderBase::getActiveLutMode(), osg::Window::getFunction(), osg::DVRVolume::getTextureManager(), osg::DVRVolume::getTextureMode(), osg::DrawActionBase::getWindow(), GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_REGISTER_COMBINERS_NV, GL_SHADER_OPERATION_NV, GL_SHARED_TEXTURE_PALETTE_EXT, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_TEXTURE_3D, GL_TEXTURE_SHADER_NV, osg::Window::hasExtension(), initDependentTexture(), initialize(), LM_AUTO, LM_DEPENDENT, LM_FRAGPROG, LM_NO, LM_PALETTE_EXT, LM_RELOAD, LM_TABLE_SGI, osg::DVRSimpleShader::m_nTextureId, m_nTextureMode, m_nTexturePaletteMode, m_pDepTexture, m_pFragProg, osg::NullFC, osg::TextureManager::reloadTexture(), setupAlphaCorrectionRegisterCombiners(), osg::DVRVolumeBase::ShaderFieldMask, SLOG, SNOTICE, SWARNING, osg::TextureManager::TM_2D, osg::TextureManager::TM_2D_Multi, osg::TextureManager::TM_3D, and updateDependentTexture(). Referenced by osg::DVRMtexLUTShader::activate(). 00740 { 00741 // FDEBUG(("DVRSimpleLUTShader::activate - v1.2 (%d)\n", (int) this)); 00742 00743 Window *win = action->getWindow(); 00744 00745 // remove compiler warnings for unused variable 00746 #if defined GL_NV_texture_shader2 00747 ActiveTextureARBFunc ActiveTextureARB = 00748 (ActiveTextureARBFunc) win->getFunction(_funcActiveTextureARB); 00749 #endif 00750 00751 ColorTableSGIFunc ColorTableSGI = NULL; 00752 00753 if(win->hasExtension(_sgiTexColorTable)) 00754 { 00755 ColorTableSGI = 00756 (ColorTableSGIFunc) win->getFunction(_funcColorTableSGI); 00757 } 00758 00759 ColorTableEXTFunc ColorTableEXT = NULL; 00760 00761 if(win->hasExtension(_extSharedPalettedTexture)) 00762 { 00763 ColorTableEXT = 00764 (ColorTableEXTFunc) win->getFunction(_funcColorTableEXT); 00765 } 00766 00767 DVRSimpleShader::activate(volume, action); 00768 00769 DVRLookupTablePtr lut = DVRVOLUME_PARAMETER(volume, DVRLookupTable); 00770 DVRVolumeTexturePtr vol = DVRVOLUME_PARAMETER(volume, DVRVolumeTexture); 00771 00772 if((volume == NULL) || (vol == NullFC)) 00773 { 00774 SWARNING << "NO Volume ..." << std::endl; 00775 00776 return; 00777 } 00778 00779 00780 // reinitialize if hardware mode has not yet been chosen or mode has 00781 // changed 00782 00783 if(getActiveLutMode() == LM_AUTO) 00784 { 00785 SNOTICE << "Reinitializing DVRSimpleLUTShader" << std::endl; 00786 00787 cleanup (volume, action); 00788 initialize(volume, action); 00789 00790 // notify volume about shader changed 00791 beginEditCP(DVRVolumePtr(volume), DVRVolume::ShaderFieldMask); 00792 endEditCP (DVRVolumePtr(volume), DVRVolume::ShaderFieldMask); 00793 } 00794 00795 00796 // reload lookup table if neccessary 00797 if((lut != NullFC) && (lut->getTouched())) 00798 { 00799 Int32 colorTableSize = lut->getSize(0); 00800 UInt8 *data = &(lut->getData(0)); 00801 00802 lut->setTouched(false); 00803 00804 switch(m_nTexturePaletteMode) 00805 { 00806 case LM_TABLE_SGI: 00807 00808 FDEBUG(("Using SGI postshading palette....\n")); 00809 00810 #if defined GL_SGI_texture_color_table 00811 glEnable(GL_TEXTURE_COLOR_TABLE_SGI); 00812 00813 ColorTableSGI( 00814 GL_TEXTURE_COLOR_TABLE_SGI, // GLenum target, 00815 GL_RGBA, // GLenum internalformat, 00816 colorTableSize, // GLsizei width, 00817 GL_RGBA, // GLenum format, 00818 GL_UNSIGNED_BYTE, // GLenum type, 00819 data); // const GLvoid *table 00820 #endif // GL_SGI_texture_color_table 00821 00822 break; 00823 00824 case LM_PALETTE_EXT: 00825 00826 FDEBUG(("Using preshading palette....\n")); 00827 00828 #if defined GL_EXT_paletted_texture && defined GL_EXT_shared_texture_palette 00829 00830 glEnable(GL_SHARED_TEXTURE_PALETTE_EXT); 00831 00832 ColorTableEXT( 00833 GL_SHARED_TEXTURE_PALETTE_EXT, // GLenum target, 00834 GL_RGBA, // GLenum internalformat, 00835 colorTableSize, // GLsizei width, 00836 GL_RGBA, // GLenum format, 00837 GL_UNSIGNED_BYTE, // GLenum type, 00838 data); // const GLvoid *table 00839 #endif 00840 00841 break; 00842 00843 case LM_RELOAD: 00844 { 00845 FDEBUG(("Using palette reload ....\n")); 00846 FFATAL(("Using palette reload ....\n")); 00847 00848 glPixelTransferi(GL_MAP_COLOR, GL_TRUE); 00849 00850 glPixelMapfv(GL_PIXEL_MAP_I_TO_R, 00851 colorTableSize, 00852 &(lut->getDataR(0))); 00853 00854 glPixelMapfv(GL_PIXEL_MAP_I_TO_G, 00855 colorTableSize, 00856 &(lut->getDataG(0))); 00857 00858 glPixelMapfv(GL_PIXEL_MAP_I_TO_B, 00859 colorTableSize, 00860 &(lut->getDataB(0))); 00861 00862 glPixelMapfv(GL_PIXEL_MAP_I_TO_A, 00863 colorTableSize, 00864 &(lut->getDataA(0))); 00865 00866 volume->getTextureManager().reloadTexture(m_nTextureId, 00867 action); 00868 00869 glPixelTransferi(GL_MAP_COLOR, GL_FALSE); 00870 break; 00871 } 00872 00873 case LM_DEPENDENT: 00874 { 00875 // Initialize dependent texture 00876 if(m_pDepTexture == NullFC) 00877 initDependentTexture(lut->getSize(0)); 00878 00879 // Setup the correct texture shader mode 00880 if(volume->getTextureMode(win) != m_nTextureMode) 00881 { 00882 switch (volume->getTextureMode(win)) 00883 { 00884 case TextureManager::TM_3D: 00885 SLOG << "Setup texture shader for 3D" << std::endl; 00886 break; 00887 00888 case TextureManager::TM_2D: 00889 SLOG << "Setup texture shader for 2D" << std::endl; 00890 break; 00891 00892 default: 00893 FFATAL( 00894 ( "Texture mode for dependent textures" 00895 " not supported by DVRSimpleLUTShader\n")); 00896 return; 00897 } 00898 00899 m_nTextureMode = volume->getTextureMode(win); 00900 } 00901 00902 // Update dependent texture if neccessary 00903 updateDependentTexture(lut->getSize(0), &(lut->getData(0))); 00904 break; 00905 } 00906 00907 case LM_FRAGPROG: 00908 { 00909 // Initialize dependent texture 00910 if(m_pDepTexture == NullFC) 00911 initDependentTexture(lut->getSize(0)); 00912 00913 // Initialize fragment program 00914 if(m_pFragProg == NullFC) 00915 { 00916 FDEBUG(("Initializing fragment program ")); 00917 00918 m_pFragProg = FragmentProgramChunk::create(); 00919 00920 addRefCP( m_pFragProg ); 00921 00922 FDEBUG((" - DONE\n")); 00923 } 00924 00925 // Load the appropriate program 00926 if(volume->getTextureMode(win) != m_nTextureMode) 00927 { 00928 switch(volume->getTextureMode(win)) 00929 { 00930 case TextureManager::TM_3D: 00931 //SLOG << "Loading ... lutFragProg3D.asm" 00932 // << std::endl; 00933 00934 beginEditCP(m_pFragProg); 00935 { 00936 m_pFragProg->setProgram(_fragProg3D); 00937 // m_pFragProg->read("lutFragProg3D.asm"); 00938 } 00939 endEditCP (m_pFragProg); 00940 break; 00941 00942 case TextureManager::TM_2D: 00943 //SLOG << "Loading ... lutFragProg2D.asm" 00944 // << std::endl; 00945 00946 beginEditCP(m_pFragProg); 00947 { 00948 m_pFragProg->setProgram(_fragProg2D); 00949 // m_pFragProg->read("lutFragProg2D.asm"); 00950 } 00951 endEditCP (m_pFragProg); 00952 break; 00953 00954 case TextureManager::TM_2D_Multi: 00955 //SLOG << "Loading ... lutFragProg2DMulti.asm" 00956 // << std::endl; 00957 00958 beginEditCP(m_pFragProg); 00959 { 00960 m_pFragProg->setProgram(_fragProg2DMulti); 00961 //m_pFragProg->read("lutFragProg2DMulti.asm"); 00962 } 00963 endEditCP (m_pFragProg); 00964 break; 00965 00966 default: 00967 FFATAL(( "Texture mode for fragment programs" 00968 " not supported by DVRSimpleLUTShader" )); 00969 return; 00970 } 00971 00972 m_nTextureMode = volume->getTextureMode(win); 00973 } 00974 00975 // Update dependent texture if neccessary 00976 updateDependentTexture(lut->getSize(0), &(lut->getData(0))); 00977 break; 00978 } 00979 00980 case LM_NO: 00981 FDEBUG(("Using NO palette reload ....\n")); 00982 break; 00983 } 00984 } 00985 00986 00987 // enable lookup table 00988 if(lut != NullFC) 00989 { 00990 switch(m_nTexturePaletteMode) 00991 { 00992 case LM_TABLE_SGI: 00993 00994 #if defined GL_SGI_texture_color_table 00995 glEnable(GL_TEXTURE_COLOR_TABLE_SGI); 00996 #endif 00997 00998 break; 00999 01000 case LM_PALETTE_EXT: 01001 01002 #if defined GL_EXT_paletted_texture && defined GL_EXT_shared_texture_palette 01003 glEnable(GL_SHARED_TEXTURE_PALETTE_EXT); 01004 #endif 01005 break; 01006 01007 case LM_DEPENDENT: 01008 01009 #if defined GL_NV_texture_shader2 01010 if(m_pDepTexture == NullFC) 01011 { 01012 SWARNING << "LM_DEPENDENT - no dependent texture" 01013 << std::endl; 01014 } 01015 01016 //beginEditCP(m_pDepTexture, 01017 // TextureChunk::EnvModeFieldMask | 01018 // TextureChunk::ShaderOperationFieldMask); 01019 //{ 01020 // m_pDepTexture->setEnvMode (GL_REPLACE); 01021 // m_pDepTexture->setShaderOperation( 01022 // GL_DEPENDENT_AR_TEXTURE_2D_NV); 01023 //} 01024 //endEditCP (m_pDepTexture, 01025 // TextureChunk::EnvModeFieldMask | 01026 // TextureChunk::ShaderOperationFieldMask); 01027 01028 m_pDepTexture->activate(action, 1); 01029 01031 glEnable(GL_TEXTURE_SHADER_NV); 01032 01033 ActiveTextureARB(GL_TEXTURE1_ARB); 01034 01035 glTexEnvf(GL_TEXTURE_ENV, 01036 GL_TEXTURE_ENV_MODE, 01037 GL_REPLACE); 01038 01039 glTexEnvi(GL_TEXTURE_SHADER_NV, 01040 GL_SHADER_OPERATION_NV, 01041 GL_DEPENDENT_AR_TEXTURE_2D_NV); 01042 01044 01045 ActiveTextureARB(GL_TEXTURE0_ARB); 01046 01047 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 01048 01049 switch(volume->getTextureMode(win)) 01050 { 01051 case TextureManager::TM_3D: 01052 01053 glTexEnvi(GL_TEXTURE_SHADER_NV, 01054 GL_SHADER_OPERATION_NV, 01055 GL_TEXTURE_3D); 01056 break; 01057 01058 case TextureManager::TM_2D: 01059 01060 glTexEnvi(GL_TEXTURE_SHADER_NV, 01061 GL_SHADER_OPERATION_NV, GL_TEXTURE_2D); 01062 break; 01063 01064 default: 01065 01066 //FFATAL(("Texture mode for dependent texture not " 01067 // "supported by DVRSimpleLUTShader")); 01068 break; 01069 } 01070 #endif 01071 01072 #if defined GL_NV_register_combiners 01073 01074 setupAlphaCorrectionRegisterCombiners(action); 01075 glEnable(GL_REGISTER_COMBINERS_NV); 01076 break; 01077 #endif 01078 01079 case LM_FRAGPROG: 01080 01081 // activate fragment program chunk 01082 m_pDepTexture->activate(action, 2); 01083 m_pFragProg ->activate(action ); 01084 01085 break; 01086 01087 default: 01088 break; 01089 } 01090 } 01091 01092 }
|
|
||||||||||||||||
|
! FIXME: This is a workaround for the current snapshot since ! it overwrites the texture shader settings on texture activation Reimplemented from osg::DVRSimpleShader. Definition at line 1095 of file OSGDVRSimpleLUTShader.cpp. References osg::DVRSimpleShader::brickActivate(), osg::DVRVolume::getTextureMode(), osg::DrawActionBase::getWindow(), GL_SHADER_OPERATION_NV, GL_TEXTURE_3D, GL_TEXTURE_SHADER_NV, LM_DEPENDENT, m_nTexturePaletteMode, osg::TextureManager::TM_2D, and osg::TextureManager::TM_3D. 01098 { 01099 //FDEBUG(("DVRSimpleLUTShader::brickActivate %d\n", (int) this)); 01100 01101 DVRSimpleShader::brickActivate(volume, action, brick); 01102 01105 01106 if(m_nTexturePaletteMode == LM_DEPENDENT) 01107 { 01108 switch(volume->getTextureMode(action->getWindow())) 01109 { 01110 case TextureManager::TM_3D: 01111 glTexEnvi(GL_TEXTURE_SHADER_NV, 01112 GL_SHADER_OPERATION_NV, 01113 GL_TEXTURE_3D); 01114 break; 01115 01116 case TextureManager::TM_2D: 01117 glTexEnvi(GL_TEXTURE_SHADER_NV, 01118 GL_SHADER_OPERATION_NV, 01119 GL_TEXTURE_2D); 01120 break; 01121 01122 default: 01123 // FFATAL(("Texture mode for dependent texture not " 01124 // "supported by DVRSimpleLUTShader")); 01125 break; 01126 } 01127 } 01128 }
|
|
||||||||||||