# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

# D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/Texture.hpp

Go to the documentation of this file.

    00001 /**************************************************************************************/
    00002 /*                                                                                    */
    00003 /*  Visualization Library                                                             */
    00004 /*  http://www.visualizationlibrary.org                                               */
    00005 /*                                                                                    */
    00006 /*  Copyright (c) 2005-2010, Michele Bosi                                             */
    00007 /*  All rights reserved.                                                              */
    00008 /*                                                                                    */
    00009 /*  Redistribution and use in source and binary forms, with or without modification,  */
    00010 /*  are permitted provided that the following conditions are met:                     */
    00011 /*                                                                                    */
    00012 /*  - Redistributions of source code must retain the above copyright notice, this     */
    00013 /*  list of conditions and the following disclaimer.                                  */
    00014 /*                                                                                    */
    00015 /*  - Redistributions in binary form must reproduce the above copyright notice, this  */
    00016 /*  list of conditions and the following disclaimer in the documentation and/or       */
    00017 /*  other materials provided with the distribution.                                   */
    00018 /*                                                                                    */
    00019 /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   */
    00020 /*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     */
    00021 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            */
    00022 /*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR  */
    00023 /*  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    */
    00024 /*  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      */
    00025 /*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    */
    00026 /*  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT           */
    00027 /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     */
    00028 /*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      */
    00029 /*                                                                                    */
    00030 /**************************************************************************************/
    00031
    00032 #ifndef Texture_INCUDE_DEFINE
    00033 #define Texture_INCUDE_DEFINE
    00034
    00035 #include <vlCore/String.hpp>
    00036 #include <vlCore/Vector4.hpp>
    00037 #include <vlCore/Image.hpp>
    00038 #include <vlGraphics/BufferObject.hpp>
    00039
    00040 namespace vl
    00041 {
    00042   class OpenGLContext;
    00043
    00044   //------------------------------------------------------------------------------
    00045   // TexParameter
    00046   //------------------------------------------------------------------------------
    00062   class VLGRAPHICS_EXPORT TexParameter: public Object
    00063   {
    00064     friend class Texture;
    00065
    00066   public:
    00067     TexParameter();
    00068
    00069     void apply(ETextureDimension dimension, OpenGLContext* gl) const;
    00070
    00071     ETexParamFilter minFilter()   const { return mMinFilter; }
    00072     ETexParamFilter magFilter()   const { return mMagfilter; }
    00073     ETexParamWrap wrapS()         const { return mWrapS; }
    00074     ETexParamWrap wrapT()         const { return mWrapT; }
    00075     ETexParamWrap wrapR()         const { return mWrapR; }
    00076     fvec4 borderColor()           const { return mBorderColor; }
    00077     float anisotropy()            const { return mAnisotropy; }
    00078     bool generateMipmap()         const { return mGenerateMipmap; }
    00079     ETexCompareMode compareMode() const { return mCompareMode; }
    00080     ETexCompareFunc compareFunc() const { return mCompareFunc; }
    00081     EDepthTextureMode depthTextureMode() const { return mDepthTextureMode; }
    00082
    00083     void setMinFilter(ETexParamFilter minfilter) { mDirty = true; mMinFilter = minfilter; }
    00084       void setMagFilter(ETexParamFilter magfilter);
    00085     void setWrapS(ETexParamWrap texturewrap)     { mDirty = true; mWrapS = texturewrap; }
    00086     void setWrapT(ETexParamWrap texturewrap)     { mDirty = true; mWrapT = texturewrap; }
    00087     void setWrapR(ETexParamWrap texturewrap)     { mDirty = true; mWrapR = texturewrap; }
    00088     void setBorderColor(fvec4 bordercolor)       { mDirty = true; mBorderColor = bordercolor; }
    00089     void setAnisotropy(float anisotropy)         { mDirty = true; mAnisotropy = anisotropy; }
    00090     void setGenerateMipmap(bool generate_mipmap) { mDirty = true; mGenerateMipmap = generate_mipmap; }
    00091     void setCompareMode(ETexCompareMode mode) { mDirty = true; mCompareMode = mode; }
    00092     void setCompareFunc(ETexCompareFunc func) { mDirty = true; mCompareFunc = func; }
    00093     void setDepthTextureMode(EDepthTextureMode mode) { mDirty = true; mDepthTextureMode = mode; }
    00094
    00095     void setDirty(bool dirty) const { mDirty = dirty; }
    00096
    00097     bool dirty() const { return mDirty; }
    00098
    00099   protected:
    00100     ETexParamFilter mMinFilter;
    00101     ETexParamFilter mMagfilter;
    00102     ETexParamWrap mWrapS;
    00103     ETexParamWrap mWrapT;
    00104     ETexParamWrap mWrapR;
    00105     ETexCompareMode mCompareMode;
    00106     ETexCompareFunc mCompareFunc;
    00107     EDepthTextureMode mDepthTextureMode;
    00108     fvec4 mBorderColor;
    00109     float mAnisotropy;
    00110     bool mGenerateMipmap;
    00111
    00112     mutable bool mDirty;
    00113   };
    00114   //------------------------------------------------------------------------------
    00115   class TextureSampler;
    00116   //------------------------------------------------------------------------------
    00117   // Texture
    00118   //------------------------------------------------------------------------------
    00141   class VLGRAPHICS_EXPORT Texture: public Object
    00142   {
    00143     VL_INSTRUMENT_CLASS(vl::Texture, Object)
    00144     friend class TextureSampler;
    00145
    00146   public:
    00152     class SetupParams: public Object
    00153     {
    00154     public:
    00155       SetupParams()
    00156       {
    00157         mDimension  = TD_TEXTURE_2D;
    00158         mFormat     = TF_RGBA;
    00159         mBorder     = false;
    00160         mGenMipmaps = false;
    00161         mWidth = mHeight = mDepth = 0;
    00162         mSamples = 0;
    00163         mFixedSamplesLocation = true;
    00164       }
    00165
    00166       void setImagePath(const String& path) { mImagePath = path; }
    00167       const String& imagePath() const { return mImagePath; }
    00168
    00169       void setImage(const Image* image) { mImage = image; }
    00170       const Image* image() const { return mImage.get(); }
    00171
    00172       const BufferObject* bufferObject() const { return mBufferObject.get(); }
    00173       BufferObject* bufferObject() { return mBufferObject.get(); }
    00174       void setBufferObject(BufferObject* bo) { mBufferObject = bo; }
    00175
    00176       void setDimension(ETextureDimension dimension) { mDimension = dimension; }
    00177       ETextureDimension dimension() const { return mDimension; }
    00178
    00179       void setFormat(ETextureFormat format) { mFormat = format; }
    00180       ETextureFormat format() const { return mFormat; }
    00181
    00182       void setBorder(bool on) { mBorder = on; }
    00183       bool border() const { return mBorder; }
    00184
    00185       void setGenMipmaps(bool on) { mGenMipmaps = on; }
    00186       bool genMipmaps() const { return mGenMipmaps; }
    00187
    00188       void setWidth(int w) { mWidth = w; }
    00189       int width() const { return mWidth; }
    00190
    00191       void setHeight(int h) { mHeight = h; }
    00192       int height() const { return mHeight; }
    00193
    00194       void setDepth(int d) { mDepth = d; }
    00195       int depth() const { return mDepth; }
    00196
    00197       int samples() const { return mSamples; }
    00198       void setSamples(int samples) { mSamples = samples; }
    00199
    00200       bool fixedSamplesLocations() const { return mFixedSamplesLocation; }
    00201       void setFixedSamplesLocations(bool fixed) { mFixedSamplesLocation = fixed; }
    00202
    00203     protected:
    00204       String mImagePath;
    00205       ref<BufferObject> mBufferObject;
    00206       ref<Image> mImage;
    00207       ETextureDimension mDimension;
    00208       ETextureFormat mFormat;
    00209       int mWidth, mHeight, mDepth; // used when no image is specified.
    00210       int mSamples;
    00211       bool mBorder;
    00212       bool mGenMipmaps;
    00213       bool mFixedSamplesLocation;
    00214     };
    00215
    00216   public:
    00219     Texture(const String& image_path, ETextureFormat format = TF_RGBA, bool mipmaps = true, bool border=false);
    00220
    00223     Texture(const Image* image, ETextureFormat format = TF_RGBA, bool mipmaps = true, bool border=false);
    00224
    00227     Texture(int width, ETextureFormat format = TF_RGBA, bool border=false);
    00228
    00231     Texture(int width, int height, ETextureFormat format = TF_RGBA, bool border=false);
    00232
    00235     Texture(int width, int height, int depth, ETextureFormat format = TF_RGBA, bool border=false);
    00236
    00238     Texture();
    00239
    00241     ~Texture();
    00242
    00244     TexParameter* getTexParameter() { return mTexParameter.get(); }
    00245
    00247     const TexParameter* getTexParameter() const { return mTexParameter.get(); }
    00248
    00250     const TexParameter* getTexParameterOverride() const { return mTexParameterOverride.get(); }
    00251
    00253     BufferObject* bufferObject() { return mBufferObject.get(); }
    00254
    00256     const BufferObject* bufferObject() const { return mBufferObject.get(); }
    00257
    00259     void destroyTexture();
    00260
    00264     bool createTexture();
    00265
    00268     bool createTexture(ETextureDimension tex_dimension, ETextureFormat tex_format, int w, int h, int d, bool border, BufferObject* bo, int samples, bool fixedsamplelocations);
    00269
    00277     bool setMipLevel(int mip_level, const Image* img, bool gen_mipmaps);
    00278
    00280     void prepareTexture1D(int width, ETextureFormat format, bool border=false)
    00281     {
    00282       prepareTexture1D(NULL, format, false, border);
    00283       mSetupParams->setWidth(width);
    00284     }
    00285
    00287     bool createTexture1D(int width, ETextureFormat format, bool border=false)
    00288     {
    00289       prepareTexture1D(width, format, border);
    00290       return createTexture();
    00291     }
    00292
    00294     void prepareTexture1D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00295     {
    00296       prepareTexture1D(NULL, format, mipmaps, border);
    00297       mSetupParams->setImagePath(image_path);
    00298     }
    00299
    00301     bool createTexture1D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00302     {
    00303       prepareTexture1D(image_path, format, mipmaps, border);
    00304       return createTexture();
    00305     }
    00306
    00308     void prepareTexture1D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00309     {
    00310       mSetupParams = new SetupParams;
    00311       mSetupParams->setImage(image);
    00312       mSetupParams->setDimension(TD_TEXTURE_1D);
    00313       mSetupParams->setFormat(format);
    00314       mSetupParams->setGenMipmaps(mipmaps);
    00315       mSetupParams->setBorder(border);
    00316     }
    00317
    00319     bool createTexture1D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00320     {
    00321       prepareTexture1D(image, format, mipmaps, border);
    00322       return createTexture();
    00323     }
    00324
    00326     void prepareTexture2D(int width, int height, ETextureFormat format, bool border=false)
    00327     {
    00328       prepareTexture2D(NULL, format, false, border);
    00329       mSetupParams->setWidth(width);
    00330       mSetupParams->setHeight(height);
    00331     }
    00332
    00334     bool createTexture2D(int width, int height, ETextureFormat format, bool border=false)
    00335     {
    00336       prepareTexture2D(width, height, format, border);
    00337       return createTexture();
    00338     }
    00339
    00341     void prepareTexture2D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00342     {
    00343       prepareTexture2D(NULL, format, mipmaps, border);
    00344       mSetupParams->setImagePath(image_path);
    00345     }
    00346
    00348     bool createTexture2D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00349     {
    00350       prepareTexture2D(image_path, format, mipmaps, border);
    00351       return createTexture();
    00352     }
    00353
    00355     void prepareTexture2D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00356     {
    00357       mSetupParams = new SetupParams;
    00358       mSetupParams->setImage(image);
    00359       mSetupParams->setDimension(TD_TEXTURE_2D);
    00360       mSetupParams->setFormat(format);
    00361       mSetupParams->setGenMipmaps(mipmaps);
    00362       mSetupParams->setBorder(border);
    00363     }
    00364
    00366     bool createTexture2D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00367     {
    00368       prepareTexture2D(image, format, mipmaps, border);
    00369       return createTexture();
    00370     }
    00371
    00373     void prepareTexture3D(int width, int height, int depth, ETextureFormat format, bool border=false)
    00374     {
    00375       prepareTexture3D(NULL, format, false, border);
    00376       mSetupParams->setWidth(width);
    00377       mSetupParams->setHeight(height);
    00378       mSetupParams->setDepth(depth);
    00379     }
    00380
    00382     bool createTexture3D(int width, int height, int depth, ETextureFormat format, bool border=false)
    00383     {
    00384       prepareTexture3D(width, height, depth, format, border);
    00385       return createTexture();
    00386     }
    00387
    00389     void prepareTexture3D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00390     {
    00391       prepareTexture3D(NULL, format, mipmaps, border);
    00392       mSetupParams->setImagePath(image_path);
    00393     }
    00394
    00396     bool createTexture3D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00397     {
    00398       prepareTexture3D(image_path, format, mipmaps, border);
    00399       return createTexture();
    00400     }
    00401
    00403     void prepareTexture3D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00404     {
    00405       mSetupParams = new SetupParams;
    00406       mSetupParams->setImage(image);
    00407       mSetupParams->setDimension(TD_TEXTURE_3D);
    00408       mSetupParams->setFormat(format);
    00409       mSetupParams->setGenMipmaps(mipmaps);
    00410       mSetupParams->setBorder(border);
    00411     }
    00412
    00414     bool createTexture3D(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00415     {
    00416       prepareTexture3D(image, format, mipmaps, border);
    00417       return createTexture();
    00418     }
    00419
    00421     void prepareTextureCubemap(int width, int height, ETextureFormat format, bool border=false)
    00422     {
    00423       prepareTextureCubemap(NULL, format, false, border);
    00424       mSetupParams->setWidth(width);
    00425       mSetupParams->setHeight(height);
    00426     }
    00427
    00429     bool createTextureCubemap(int width, int height, ETextureFormat format, bool border=false)
    00430     {
    00431       prepareTextureCubemap(width, height, format, border);
    00432       return createTexture();
    00433     }
    00434
    00436     void prepareTextureCubemap(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00437     {
    00438       prepareTextureCubemap(NULL, format, mipmaps, border);
    00439       mSetupParams->setImagePath(image_path);
    00440     }
    00441
    00443     bool createTextureCubemap(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00444     {
    00445       prepareTextureCubemap(image_path, format, mipmaps, border);
    00446       return createTexture();
    00447     }
    00448
    00450     void prepareTextureCubemap(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00451     {
    00452       mSetupParams = new SetupParams;
    00453       mSetupParams->setImage(image);
    00454       mSetupParams->setDimension(TD_TEXTURE_CUBE_MAP);
    00455       mSetupParams->setFormat(format);
    00456       mSetupParams->setGenMipmaps(mipmaps);
    00457       mSetupParams->setBorder(border);
    00458     }
    00459
    00461     bool createTextureCubemap(const Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00462     {
    00463       prepareTextureCubemap(image, format, mipmaps, border);
    00464       return createTexture();
    00465     }
    00466
    00468     void prepareTexture1DArray(int width, int count, ETextureFormat format)
    00469     {
    00470       prepareTexture1DArray(NULL, format, false);
    00471       mSetupParams->setWidth(width);
    00472       mSetupParams->setHeight(count);
    00473     }
    00474
    00476     bool createTexture1DArray(int width, int count, ETextureFormat format)
    00477     {
    00478       prepareTexture1DArray(width, count, format);
    00479       return createTexture();
    00480     }
    00481
    00483     void prepareTexture1DArray(const String& image_path, ETextureFormat format, bool mipmaps=true)
    00484     {
    00485       prepareTexture1DArray(NULL, format, mipmaps);
    00486       mSetupParams->setImagePath(image_path);
    00487     }
    00488
    00490     bool createTexture1DArray(const String& image_path, ETextureFormat format, bool mipmaps=true)
    00491     {
    00492       prepareTexture1DArray(image_path, format, mipmaps);
    00493       return createTexture();
    00494     }
    00495
    00497     void prepareTexture1DArray(const Image* image, ETextureFormat format, bool mipmaps=true)
    00498     {
    00499       mSetupParams = new SetupParams;
    00500       mSetupParams->setImage(image);
    00501       mSetupParams->setDimension(TD_TEXTURE_1D_ARRAY);
    00502       mSetupParams->setFormat(format);
    00503       mSetupParams->setGenMipmaps(mipmaps);
    00504       mSetupParams->setBorder(false);
    00505     }
    00506
    00508     bool createTexture1DArray(const Image* image, ETextureFormat format, bool mipmaps=true)
    00509     {
    00510       prepareTexture1DArray(image, format, mipmaps);
    00511       return createTexture();
    00512     }
    00513
    00515     void prepareTexture2DArray(int width, int height, int count, ETextureFormat format)
    00516     {
    00517       prepareTexture2DArray(NULL, format, false);
    00518       mSetupParams->setWidth(width);
    00519       mSetupParams->setHeight(height);
    00520       mSetupParams->setDepth(count);
    00521     }
    00522
    00524     bool createTexture2DArray(int width, int height, int count, ETextureFormat format)
    00525     {
    00526       prepareTexture2DArray(width, height, count, format);
    00527       return createTexture();
    00528     }
    00529
    00531     void prepareTexture2DArray(const String& image_path, ETextureFormat format, bool mipmaps=true)
    00532     {
    00533       prepareTexture2DArray(NULL, format, mipmaps);
    00534       mSetupParams->setImagePath(image_path);
    00535     }
    00536
    00538     bool createTexture2DArray(const String& image_path, ETextureFormat format, bool mipmaps=true)
    00539     {
    00540       prepareTexture2DArray(image_path, format, mipmaps);
    00541       return createTexture();
    00542     }
    00543
    00545     void prepareTexture2DArray(const Image* image, ETextureFormat format, bool mipmaps=true)
    00546     {
    00547       mSetupParams = new SetupParams;
    00548       mSetupParams->setImage(image);
    00549       mSetupParams->setDimension(TD_TEXTURE_2D_ARRAY);
    00550       mSetupParams->setFormat(format);
    00551       mSetupParams->setGenMipmaps(mipmaps);
    00552       mSetupParams->setBorder(false);
    00553     }
    00554
    00556     bool createTexture2DArray(const Image* image, ETextureFormat format, bool mipmaps=true)
    00557     {
    00558       prepareTexture2DArray(image, format, mipmaps);
    00559       return createTexture();
    00560     }
    00561
    00563     void prepareTextureRectangle(int width, int height, ETextureFormat format)
    00564     {
    00565       prepareTextureRectangle(NULL, format);
    00566       mSetupParams->setWidth(width);
    00567       mSetupParams->setHeight(height);
    00568     }
    00569
    00571     bool createTextureRectangle(int width, int height, ETextureFormat format)
    00572     {
    00573       prepareTextureRectangle(width, height, format);
    00574       return createTexture();
    00575     }
    00576
    00578     void prepareTextureRectangle(const String& image_path, ETextureFormat format)
    00579     {
    00580       prepareTextureRectangle(NULL, format);
    00581       mSetupParams->setImagePath(image_path);
    00582     }
    00583
    00585     bool createTextureRectangle(const String& image_path, ETextureFormat format)
    00586     {
    00587       prepareTextureRectangle(image_path, format);
    00588       return createTexture();
    00589     }
    00590
    00592     void prepareTextureRectangle(const Image* image, ETextureFormat format)
    00593     {
    00594       mSetupParams = new SetupParams;
    00595       mSetupParams->setImage(image);
    00596       mSetupParams->setDimension(TD_TEXTURE_RECTANGLE);
    00597       mSetupParams->setFormat(format);
    00598       mSetupParams->setGenMipmaps(false);
    00599       mSetupParams->setBorder(false);
    00600     }
    00601
    00603     bool createTextureRectangle(const Image* image, ETextureFormat format)
    00604     {
    00605       prepareTextureRectangle(image, format);
    00606       return createTexture();
    00607     }
    00608
    00610     void prepareTextureBuffer(vl::ETextureFormat format, BufferObject* bo)
    00611     {
    00612       mSetupParams = new SetupParams;
    00613       mSetupParams->setDimension(TD_TEXTURE_BUFFER);
    00614       mSetupParams->setFormat(format);
    00615       mSetupParams->setBufferObject(bo);
    00616       mSetupParams->setGenMipmaps(false);
    00617       mSetupParams->setBorder(false);
    00618     }
    00619
    00621     bool createTextureBuffer(vl::ETextureFormat format, BufferObject* bo)
    00622     {
    00623       prepareTextureBuffer(format, bo);
    00624       return createTexture();
    00625     }
    00626
    00628     void prepareTexture2DMultisample(int width, int height, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
    00629     {
    00630       mSetupParams = new SetupParams;
    00631       mSetupParams->setDimension(TD_TEXTURE_2D_MULTISAMPLE);
    00632       mSetupParams->setWidth(width);
    00633       mSetupParams->setHeight(height);
    00634       mSetupParams->setFormat(format);
    00635       mSetupParams->setSamples(samples);
    00636       mSetupParams->setFixedSamplesLocations(fixedsamplelocations);
    00637       mSetupParams->setGenMipmaps(false);
    00638       mSetupParams->setBorder(false);
    00639     }
    00640
    00642     bool createTexture2DMultisample(int width, int height, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
    00643     {
    00644       prepareTexture2DMultisample(width, height, format, samples, fixedsamplelocations);
    00645       return createTexture();
    00646     }
    00647
    00649     void prepareTexture2DMultisampleArray(int width, int height, int depth, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
    00650     {
    00651       mSetupParams = new SetupParams;
    00652       mSetupParams->setDimension(TD_TEXTURE_2D_MULTISAMPLE_ARRAY);
    00653       mSetupParams->setWidth(width);
    00654       mSetupParams->setHeight(height);
    00655       mSetupParams->setDepth(depth);
    00656       mSetupParams->setFormat(format);
    00657       mSetupParams->setSamples(samples);
    00658       mSetupParams->setFixedSamplesLocations(fixedsamplelocations);
    00659       mSetupParams->setGenMipmaps(false);
    00660       mSetupParams->setBorder(false);
    00661     }
    00662
    00664     bool createTexture2DMultisampleArray(int width, int height, int depth, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
    00665     {
    00666       prepareTexture2DMultisampleArray(width, height, depth, format, samples, fixedsamplelocations);
    00667       return createTexture();
    00668     }
    00669
    00671     bool isValid() const;
    00672
    00674     unsigned int handle() const { return mHandle; }
    00676     void setHandle(unsigned int id) { mHandle = id; }
    00677
    00679     void setDimension(ETextureDimension dimension) { mDimension = dimension; }
    00681     ETextureDimension dimension() const { return mDimension; }
    00682
    00684     void setInternalFormat(ETextureFormat format) { mFormat = format; }
    00686     ETextureFormat internalFormat() const { return mFormat; }
    00687
    00689     void setWidth(int x)  { mWidth = x; }
    00691     int width() const { return mWidth; }
    00692
    00694     void setHeight(int y) { mHeight = y; }
    00696     int height() const { return mHeight; }
    00697
    00699     void setDepth(int z)  { mDepth = z; }
    00701     int depth() const { return mDepth; }
    00702
    00704     void setBorder(bool border) { mBorder = border; }
    00706     bool border() const { return mBorder; }
    00707
    00709     int samples() const { return mSamples; }
    00710
    00712     bool fixedSamplesLocation() const { return mFixedSamplesLocation; }
    00713
    00715     const SetupParams* setupParams() const { return mSetupParams.get(); }
    00716
    00718     SetupParams* setupParams() { return mSetupParams.get(); }
    00719
    00721     void setSetupParams(SetupParams* setup_params) { mSetupParams = setup_params; }
    00722
    00724     static bool supports(ETextureDimension tex_dimension, ETextureFormat tex_format, int mip_level, EImageDimension img_dimension, int w, int h, int d, bool border, int samples, bool fixedsamplelocations, bool verbose);
    00725
    00727     static bool isCompressedFormat(int format);
    00728
    00730     bool isDepthTexture() const;
    00731
    00734     void clone(const Texture& other);
    00735
    00736   private:
    00737     Texture(const Texture& other): Object(other) {}
    00738     void operator=(const Texture&) {}
    00739     void reset();
    00740
    00741   protected:
    00742     unsigned int mHandle;
    00743     ref<TexParameter> mTexParameter;
    00744     mutable ref<TexParameter> mTexParameterOverride;
    00745     ref<SetupParams> mSetupParams;
    00746     ref<BufferObject> mBufferObject;
    00747     ETextureFormat mFormat;
    00748     ETextureDimension mDimension;
    00749     int mWidth;
    00750     int mHeight;
    00751     int mDepth;
    00752     int mSamples;
    00753     bool mBorder;
    00754     bool mFixedSamplesLocation;
    00755   };
    00756 }
    00757
    00758 #endif

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:43:44.
Permission is granted to use this page to write and publish articles regarding Visualization Library.