#include <OSGDVRMtexLUTShaderBase.h>
Inheritance diagram for osg::DVRMtexLUTShaderBase:

Public Types | |
| typedef DVRMtexLUTShaderPtr | Ptr |
| enum | { LutModeFieldId = Inherited::NextFieldId, ActiveLutModeFieldId = LutModeFieldId + 1, NextFieldId = ActiveLutModeFieldId + 1 } |
Public Member Functions | |
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 |
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 | |
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. | |
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 DVRMtexLUTShaderPtr | create (void) |
| create a new instance of the class | |
| static DVRMtexLUTShaderPtr | createEmpty (void) |
| create an empty new instance of the class, do not copy the prototype | |
Static Public Attributes | |
| static const osg::BitVector | MTInfluenceMask |
| static const osg::BitVector | LutModeFieldMask |
| static const osg::BitVector | ActiveLutModeFieldMask |
| 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 | |
| * | DVRMtexLUTShaderBase (void) |
| DVRMtexLUTShaderBase (const DVRMtexLUTShaderBase &source) | |
Destructors | |
| *virtual | ~DVRMtexLUTShaderBase (void) |
Sync | |
| *void | executeSyncImpl (DVRMtexLUTShaderBase *pOther, const BitVector &whichField) |
| virtual void | executeSync (FieldContainer &other, const BitVector &whichField) |
Volume Rendering | |
| *void | getPaletteFormat (DrawActionBase *action, UInt8 lutMode, GLenum &internalFormat, GLenum &externalFormat) |
| returns texture formate for selected lookup table mode | |
| bool | isModeSupported (DrawActionBase *action, UInt8 mode, Int8 textureMode) |
| Checks whether the selected mode is supported. | |
| UInt8 | selectMode (DrawActionBase *action, Int8 textureMode) |
| Automatically select a lookup table mode. | |
| void | enablePalette (void) |
| enables lut | |
| void | disablePalette (void) |
| diasables lut | |
| void | initDependentTexture (Int32 size) |
| create dependent texture | |
| void | updateDependentTexture (Int32 size, const UInt8 *data) |
| update dependent texture | |
| void | destroyDependentTexture (void) |
| destroy dependent texture | |
| void | setupAlphaCorrectionRegisterCombiners (DrawActionBase *action) |
Field Get | |
| *SFInt8 * | getSFLutMode (void) |
| Get the DVRSimpleLUTShader::_sfLutMode field. | |
| SFInt8 * | getSFActiveLutMode (void) |
| Get the DVRSimpleLUTShader::_sfActiveLutMode field. | |
| Int8 & | getLutMode (void) |
| Get the value of the DVRSimpleLUTShader::_sfLutMode field. | |
| const Int8 & | getLutMode (void) const |
| Get the value of the DVRSimpleLUTShader::_sfLutMode field. | |
| Int8 & | getActiveLutMode (void) |
| Get the value of the DVRSimpleLUTShader::_sfActiveLutMode field. | |
| const Int8 & | getActiveLutMode (void) const |
| Get the value of the DVRSimpleLUTShader::_sfActiveLutMode field. | |
Field Set | |
| *void | setLutMode (const Int8 &value) |
| Set the value of the DVRSimpleLUTShader::_sfLutMode field. | |
| void | setActiveLutMode (const Int8 &value) |
| Set the value of the DVRSimpleLUTShader::_sfActiveLutMode field. | |
Sync | |
| *void | executeSyncImpl (DVRSimpleLUTShaderBase *pOther, const BitVector &whichField) |
Sync | |
| *void | executeSyncImpl (DVRSimpleShaderBase *pOther, const BitVector &whichField) |
Sync | |
| *void | executeSyncImpl (DVRShaderBase *pOther, const BitVector &whichField) |
Sync | |
| *void | executeSyncImpl (DVRShaderBase *pOther, const BitVector &whichField) |
Protected Attributes | |
| UInt8 | m_nTexturePaletteMode |
| Int8 | m_nTextureMode |
| FragmentProgramChunkPtr | m_pFragProg |
| TextureChunkPtr | m_pDepTexture |
| Int32 | m_nTextureId |
Fields | |
| *SFInt8 | _sfLutMode |
| SFInt8 | _sfActiveLutMode |
Private Types | |
| typedef DVRSimpleLUTShader | Inherited |
Private Member Functions | |
| void | operator= (const DVRMtexLUTShaderBase &source) |
Static Private Attributes | |
| static FieldContainerType | _type |
Friends | |
| class | FieldContainer |
Definition at line 80 of file OSGDVRMtexLUTShaderBase.h.
|
|
Reimplemented from osg::DVRSimpleLUTShader. Reimplemented in osg::DVRMtexLUTShader. Definition at line 84 of file OSGDVRMtexLUTShaderBase.h. |
|
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 89 of file OSGDVRMtexLUTShaderBase.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 144 of file OSGDVRMtexLUTShaderBase.cpp. 00144 : 00145 Inherited() 00146 { 00147 }
|
|
|
Definition at line 153 of file OSGDVRMtexLUTShaderBase.cpp. 00153 : 00154 Inherited (source) 00155 { 00156 }
|
|
|
Definition at line 160 of file OSGDVRMtexLUTShaderBase.cpp.
|
|
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 58 of file OSGDVRMtexLUTShaderBase.inl. References _type. Referenced by create(). 00059 { 00060 return _type; 00061 }
|
|
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 65 of file OSGDVRMtexLUTShaderBase.inl. References _type, and osg::TypeBase::getId(). 00066 { 00067 return _type.getId(); 00068 }
|
|
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 86 of file OSGDVRMtexLUTShaderBase.cpp. References _type. 00087 { 00088 return _type; 00089 }
|
|
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 91 of file OSGDVRMtexLUTShaderBase.cpp. References _type. 00092 { 00093 return _type; 00094 }
|
|
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 106 of file OSGDVRMtexLUTShaderBase.cpp. 00107 { 00108 return sizeof(DVRMtexLUTShader); 00109 }
|
|
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 166 of file OSGDVRMtexLUTShaderBase.cpp. References osg::DVRSimpleLUTShaderBase::getBinSize(). 00167 { 00168 UInt32 returnValue = Inherited::getBinSize(whichField); 00169 00170 00171 return returnValue; 00172 }
|
|
||||||||||||
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 174 of file OSGDVRMtexLUTShaderBase.cpp. References osg::DVRSimpleLUTShaderBase::copyToBin(). 00176 { 00177 Inherited::copyToBin(pMem, whichField); 00178 00179 00180 }
|
|
||||||||||||
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 182 of file OSGDVRMtexLUTShaderBase.cpp. References osg::DVRSimpleLUTShaderBase::copyFromBin(). 00184 { 00185 Inherited::copyFromBin(pMem, whichField); 00186 00187 00188 }
|
|
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 72 of file OSGDVRMtexLUTShaderBase.inl. References getClassType(), osg::FieldContainerType::getPrototype(), osg::NullFC, and shallowCopy(). 00073 { 00074 DVRMtexLUTShaderPtr fc; 00075 00076 if(getClassType().getPrototype() != OSG::NullFC) 00077 { 00078 fc = DVRMtexLUTShaderPtr::dcast( 00079 getClassType().getPrototype()-> shallowCopy()); 00080 } 00081 00082 return fc; 00083 }
|
|
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 87 of file OSGDVRMtexLUTShaderBase.inl. References osg::FieldContainer::newPtr(). 00088 { 00089 DVRMtexLUTShaderPtr returnValue; 00090 00091 newPtr(returnValue); 00092 00093 return returnValue; 00094 }
|
|
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 97 of file OSGDVRMtexLUTShaderBase.cpp. References osg::FieldContainer::newPtr(). Referenced by create(). 00098 { 00099 DVRMtexLUTShaderPtr returnValue; 00100 00101 newPtr(returnValue, dynamic_cast<const DVRMtexLUTShader *>(this)); 00102 00103 return returnValue; 00104 }
|
|
||||||||||||
|
Definition at line 191 of file OSGDVRMtexLUTShaderBase.cpp. References osg::DVRSimpleLUTShaderBase::executeSyncImpl(). Referenced by executeSync(). 00193 { 00194 00195 Inherited::executeSyncImpl(pOther, whichField); 00196 00197 00198 }
|
|
||||||||||||
|
Reimplemented from osg::DVRSimpleLUTShaderBase. Definition at line 113 of file OSGDVRMtexLUTShaderBase.cpp. References executeSyncImpl(). 00115 { 00116 this->executeSyncImpl((DVRMtexLUTShaderBase *) &other, whichField); 00117 }
|
|
|
|
|
||||||||||||
|
Reimplemented from osg::DVRSimpleShader. Reimplemented in osg::DVRMtexLUTShader. Definition at line 593 of file OSGDVRSimpleLUTShader.cpp. References osg::DVRSimpleShader::changed(), FDEBUG, FWARNING, osg::DVRSimpleLUTShader::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(), osg::DVRSimpleLUTShader::getPaletteFormat(), osg::DVRVolume::getTextureManager(), osg::DVRVolume::getTextureMode(), osg::DrawActionBase::getWindow(), GLenum, osg::DVRSimpleLUTShader::isModeSupported(), osg::DVRSimpleLUTShader::LM_AUTO, osg::DVRSimpleLUTShader::LM_NO, osg::DVRSimpleShader::m_nTextureId, osg::DVRSimpleLUTShader::m_nTexturePaletteMode, osg::NullFC, osg::TextureManager::registerTexture(), osg::TextureManager::reloadTexture(), osg::DVRSimpleLUTShader::selectMode(), osg::DVRSimpleLUTShaderBase::setActiveLutMode(), SWARNING, and osg::DVRLookupTableBase::TouchedFieldMask. Referenced by osg::DVRSimpleLUTShader::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 osg::DVRSimpleLUTShader::_extSharedPalettedTexture, osg::DVRSimpleLUTShader::_fragProg2D, osg::DVRSimpleLUTShader::_fragProg2DMulti, osg::DVRSimpleLUTShader::_fragProg3D, osg::DVRSimpleLUTShader::_funcActiveTextureARB, osg::DVRSimpleLUTShader::_funcColorTableEXT, osg::DVRSimpleLUTShader::_funcColorTableSGI, osg::DVRSimpleLUTShader::_sgiTexColorTable, osg::DVRSimpleShader::activate(), osg::addRefCP(), osg::beginEditCP(), osg::DVRSimpleLUTShader::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(), osg::DVRSimpleLUTShader::initDependentTexture(), osg::DVRSimpleLUTShader::initialize(), osg::DVRSimpleLUTShader::LM_AUTO, osg::DVRSimpleLUTShader::LM_DEPENDENT, osg::DVRSimpleLUTShader::LM_FRAGPROG, osg::DVRSimpleLUTShader::LM_NO, osg::DVRSimpleLUTShader::LM_PALETTE_EXT, osg::DVRSimpleLUTShader::LM_RELOAD, osg::DVRSimpleLUTShader::LM_TABLE_SGI, osg::DVRSimpleShader::m_nTextureId, osg::DVRSimpleLUTShader::m_nTextureMode, osg::DVRSimpleLUTShader::m_nTexturePaletteMode, osg::DVRSimpleLUTShader::m_pDepTexture, osg::DVRSimpleLUTShader::m_pFragProg, osg::NullFC, osg::TextureManager::reloadTexture(), osg::DVRSimpleLUTShader::setupAlphaCorrectionRegisterCombiners(), osg::DVRVolumeBase::ShaderFieldMask, SLOG, SNOTICE, SWARNING, osg::TextureManager::TM_2D, osg::TextureManager::TM_2D_Multi, osg::TextureManager::TM_3D, and osg::DVRSimpleLUTShader::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); |