Changeset 13041 for OpenSceneGraph/trunk/include/osg/Texture
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osg/Texture (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osg/Texture
r12306 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 73 73 74 74 #ifndef GL_OES_compressed_ETC1_RGB8_texture 75 #define GL_ETC1_RGB8_OES 0x8D64 75 #define GL_ETC1_RGB8_OES 0x8D64 76 76 #endif 77 77 … … 165 165 166 166 #ifndef GL_CLAMP 167 #define GL_CLAMP 0x2900 167 #define GL_CLAMP 0x2900 168 168 #endif 169 169 … … 327 327 /** Fast alternative to dynamic_cast<> for determining if state attribute is a Texture.*/ 328 328 virtual Texture* asTexture() { return this; } 329 329 330 330 /** Fast alternative to dynamic_cast<> for determining if state attribute is a Texture.*/ 331 331 virtual const Texture* asTexture() const { return this; } … … 377 377 /** Sets the border width. */ 378 378 void setBorderWidth(GLint width) { _borderWidth = width; dirtyTextureParameters(); } 379 379 380 380 GLint getBorderWidth() const { return _borderWidth; } 381 381 … … 407 407 * depends on the graphics system. */ 408 408 void setMaxAnisotropy(float anis); 409 409 410 410 /** Gets the maximum anisotropy value. */ 411 411 inline float getMaxAnisotropy() const { return _maxAnisotropy; } … … 422 422 * Texture, apply() will delete the image data. */ 423 423 inline void setUnRefImageDataAfterApply(bool flag) { _unrefImageDataAfterApply = flag; } 424 424 425 425 /** Gets whether or not apply() unreferences image data. */ 426 426 inline bool getUnRefImageDataAfterApply() const { return _unrefImageDataAfterApply; } … … 435 435 inline bool getClientStorageHint() const { return _clientStorageHint; } 436 436 437 /** Sets whether to force the texture to resize images that have dimensions 437 /** Sets whether to force the texture to resize images that have dimensions 438 438 * that are not a power of two. If enabled, NPOT images will be resized, 439 439 * whether or not NPOT textures are supported by the hardware. If disabled, … … 482 482 /** Gets the internal texture format. */ 483 483 inline GLint getInternalFormat() const { if (_internalFormat==0) computeInternalFormat(); return _internalFormat; } 484 484 485 485 /** Return true if the internal format is one of the compressed formats.*/ 486 486 bool isCompressedInternalFormat() const; … … 513 513 UNSIGNED_INTEGER = 0x4 514 514 }; 515 515 516 516 /** Get the internal texture format type. */ 517 517 inline InternalFormatType getInternalFormatType() const { return _internalFormatType; } 518 518 519 519 class TextureObject; 520 520 … … 564 564 void setShadowComparison(bool flag) { _use_shadow_comparison = flag; } 565 565 bool getShadowComparison() const { return _use_shadow_comparison; } 566 566 567 567 enum ShadowCompareFunc { 568 568 NEVER = GL_NEVER, … … 594 594 void setShadowAmbient(float shadow_ambient) { _shadow_ambient = shadow_ambient; } 595 595 float getShadowAmbient() const { return _shadow_ambient; } 596 596 597 597 598 598 /** Sets the texture image for the specified face. */ … … 634 634 /** Encapsulates queries of extension availability, obtains extension 635 635 * function pointers, and provides convenience wrappers for 636 * calling extension functions. */ 636 * calling extension functions. */ 637 637 class OSG_EXPORT Extensions : public osg::Referenced 638 638 { … … 645 645 void setTextureFilterAnisotropicSupported(bool flag) { _isTextureFilterAnisotropicSupported=flag; } 646 646 bool isTextureFilterAnisotropicSupported() const { return _isTextureFilterAnisotropicSupported; } 647 647 648 648 void setTextureCompressionARBSupported(bool flag) { _isTextureCompressionARBSupported=flag; } 649 649 bool isTextureCompressionARBSupported() const { return _isTextureCompressionARBSupported; } … … 654 654 void setTextureCompressionPVRTC2BPPSupported(bool flag) { _isTextureCompressionPVRTC2BPPSupported=flag; } 655 655 bool isTextureCompressionPVRTC2BPPSupported() const { return _isTextureCompressionPVRTC2BPPSupported; } 656 656 657 657 void setTextureCompressionPVRTC4BPPSupported(bool flag) { _isTextureCompressionPVRTC4BPPSupported=flag; } 658 658 bool isTextureCompressionPVRTC4BPPSupported() const { return _isTextureCompressionPVRTC4BPPSupported; } 659 659 660 660 void setTextureCompressionETCSupported(bool flag) { _isTextureCompressionETCSupported=flag; } 661 661 bool isTextureCompressionETCSupported() const { return _isTextureCompressionETCSupported; } … … 699 699 bool isCompressedTexImage2DSupported() const { return _glCompressedTexImage2D!=0; } 700 700 bool isCompressedTexSubImage2DSupported() const { return _glCompressedTexSubImage2D!=0; } 701 701 702 702 bool isClientStorageSupported() const { return _isClientStorageSupported; } 703 703 704 704 bool isNonPowerOfTwoTextureSupported(GLenum filter) const 705 705 { 706 return (filter==GL_LINEAR || filter==GL_NEAREST) ? 706 return (filter==GL_LINEAR || filter==GL_NEAREST) ? 707 707 _isNonPowerOfTwoTextureNonMipMappedSupported : 708 708 _isNonPowerOfTwoTextureMipMappedSupported; … … 745 745 746 746 ~Extensions() {} 747 747 748 748 typedef void (GL_APIENTRY * CompressedTexImage2DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); 749 749 typedef void (GL_APIENTRY * CompressedTexSubImage2DArbProc) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); … … 786 786 GLint _numTextureUnits; 787 787 }; 788 788 789 789 /** Gets the extension for the specified context. Creates the 790 790 * Extensions object for that context if it doesn't exist. … … 801 801 * image format. */ 802 802 static bool isCompressedInternalFormat(GLint internalFormat); 803 803 804 804 /** Determine the size of a compressed image, given the internalFormat, 805 805 * the width, the height, and the depth of the image. The block size … … 812 812 * you're implementing a subload callback. */ 813 813 void applyTexImage2D_load(State& state, GLenum target, const Image* image, GLsizei width, GLsizei height,GLsizei numMipmapLevels) const; 814 814 815 815 /** Helper method. Subloads images into the texture, but doesn't set 816 816 * or use a texture binding. Note: Don't call this method directly … … 833 833 834 834 virtual void computeInternalFormat() const = 0; 835 835 836 836 /** Computes the internal format from Image parameters. */ 837 837 void computeInternalFormatWithImage(const osg::Image& image) const; … … 839 839 /** Computes the texture dimension for the given Image. */ 840 840 void computeRequiredTextureDimensions(State& state, const osg::Image& image,GLsizei& width, GLsizei& height,GLsizei& numMipmapLevels) const; 841 841 842 842 /** Computes the internal format type. */ 843 843 void computeInternalFormatType() const;
