# Visualization Library

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

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

- Main Page
- 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.com                                               */
    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/GLBufferObject.hpp>
    00039
    00040 namespace vl
    00041 {
    00042   class OpenGLContext;
    00043
    00044   //------------------------------------------------------------------------------
    00045   // TexParameter
    00046   //------------------------------------------------------------------------------
    00062   class TexParameter
    00063   {
    00064     friend class Texture;
    00065   public:
    00066     TexParameter();
    00067     virtual const char* className() { return "vl::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     VLGRAPHICS_EXPORT 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 setTexCompareMode(ETexCompareMode mode) { mDirty = true; mCompareMode = mode; }
    00092     void setTexCompareFunc(ETexCompareFunc func) { mDirty = true; mCompareFunc = func; }
    00093     void setDepthTextureMode(EDepthTextureMode mode) { mDirty = true; mDepthTextureMode = mode; }
    00094
    00095     bool dirty() const { return mDirty; }
    00096
    00097   protected:
    00098     ETexParamFilter mMinFilter;
    00099     ETexParamFilter mMagfilter;
    00100     ETexParamWrap mWrapS;
    00101     ETexParamWrap mWrapT;
    00102     ETexParamWrap mWrapR;
    00103     ETexCompareMode mCompareMode;
    00104     ETexCompareFunc mCompareFunc;
    00105     EDepthTextureMode mDepthTextureMode;
    00106     fvec4 mBorderColor;
    00107     float mAnisotropy;
    00108     bool mGenerateMipmap;
    00109
    00110     mutable bool mDirty;
    00111   };
    00112   //------------------------------------------------------------------------------
    00113   // Texture
    00114   //------------------------------------------------------------------------------
    00137   class VLGRAPHICS_EXPORT Texture: public Object
    00138   {
    00139   public:
    00144     class SetupParams: public Object
    00145     {
    00146     public:
    00147       SetupParams()
    00148       {
    00149         mDimension  = TD_TEXTURE_2D;
    00150         mFormat     = TF_RGBA;
    00151         mBorder     = false;
    00152         mGenMipmaps = false;
    00153         mWidth = mHeight = mDepth = 0;
    00154         mSamples = 0;
    00155         mFixedSamplesLocation = true;
    00156       }
    00157
    00158       void setImagePath(const String& path) { mImagePath = path; }
    00159       const String& imagePath() const { return mImagePath; }
    00160
    00161       void setImage(Image* image) { mImage = image; }
    00162       const Image* image() const { return mImage.get(); }
    00163       Image* image() { return mImage.get(); }
    00164
    00165       const GLBufferObject* bufferObject() const { return mBufferObject.get(); }
    00166       GLBufferObject* bufferObject() { return mBufferObject.get(); }
    00167       void setBufferObject(GLBufferObject* bo) { mBufferObject = bo; }
    00168
    00169       void setDimension(ETextureDimension dimension) { mDimension = dimension; }
    00170       ETextureDimension dimension() const { return mDimension; }
    00171
    00172       void setFormat(ETextureFormat format) { mFormat = format; }
    00173       ETextureFormat format() const { return mFormat; }
    00174
    00175       void setBorder(bool on) { mBorder = on; }
    00176       bool border() const { return mBorder; }
    00177
    00178       void setGenMipmaps(bool on) { mGenMipmaps = on; }
    00179       bool genMipmaps() const { return mGenMipmaps; }
    00180
    00181       void setWidth(int w) { mWidth = w; }
    00182       int width() const { return mWidth; }
    00183
    00184       void setHeight(int h) { mHeight = h; }
    00185       int height() const { return mHeight; }
    00186
    00187       void setDepth(int d) { mDepth = d; }
    00188       int depth() const { return mDepth; }
    00189
    00190       int samples() const { return mSamples; }
    00191       void setSamples(int samples) { mSamples = samples; }
    00192
    00193       bool fixedSamplesLocations() const { return mFixedSamplesLocation; }
    00194       void setFixedSamplesLocations(bool fixed) { mFixedSamplesLocation = fixed; }
    00195
    00196     protected:
    00197       String mImagePath;
    00198       ref<GLBufferObject> mBufferObject;
    00199       ref<Image> mImage;
    00200       ETextureDimension mDimension;
    00201       ETextureFormat mFormat;
    00202       int mWidth, mHeight, mDepth; // used when no image is specified.
    00203       int mSamples;
    00204       bool mBorder;
    00205       bool mGenMipmaps;
    00206       bool mFixedSamplesLocation;
    00207     };
    00208
    00209   public:
    00210     virtual const char* className() { return "vl::Texture"; }
    00211
    00214     Texture(const String& image_path, ETextureFormat format = TF_RGBA, bool mipmaps = true, bool border=false);
    00215
    00218     Texture(Image* image, ETextureFormat format = TF_RGBA, bool mipmaps = true, bool border=false);
    00219
    00222     Texture(int width, ETextureFormat format = TF_RGBA, bool border=false);
    00223
    00226     Texture(int width, int height, ETextureFormat format = TF_RGBA, bool border=false);
    00227
    00230     Texture(int width, int height, int depth, ETextureFormat format = TF_RGBA, bool border=false);
    00231
    00233     Texture();
    00234
    00236     ~Texture();
    00237
    00239     TexParameter* getTexParameter() { return &mTexParameter; }
    00240
    00242     const TexParameter* getTexParameter() const { return &mTexParameter; }
    00243
    00245     GLBufferObject* bufferObject() { return mBufferObject.get(); }
    00246
    00248     const GLBufferObject* bufferObject() const { return mBufferObject.get(); }
    00249
    00251     void destroyTexture();
    00252
    00256     bool createTexture();
    00257
    00260     bool createTexture(ETextureDimension tex_dimension, ETextureFormat tex_format, int w, int h, int d, bool border, GLBufferObject* bo, int samples, bool fixedsamplelocations);
    00261
    00269     bool setMipLevel(int mip_level, Image* img, bool gen_mipmaps);
    00270
    00272     void prepareTexture1D(int width, ETextureFormat format, bool border=false)
    00273     {
    00274       prepareTexture1D(NULL, format, false, border);
    00275       mSetupParams->setWidth(width);
    00276     }
    00277
    00279     void createTexture1D(int width, ETextureFormat format, bool border=false)
    00280     {
    00281       prepareTexture1D(width, format, border);
    00282       createTexture();
    00283     }
    00284
    00286     void prepareTexture1D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00287     {
    00288       prepareTexture1D(NULL, format, mipmaps, border);
    00289       mSetupParams->setImagePath(image_path);
    00290     }
    00291
    00293     void createTexture1D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00294     {
    00295       prepareTexture1D(image_path, format, mipmaps, border);
    00296       createTexture();
    00297     }
    00298
    00300     void prepareTexture1D(Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00301     {
    00302       mSetupParams = new SetupParams;
    00303       mSetupParams->setImage(image);
    00304       mSetupParams->setDimension(TD_TEXTURE_1D);
    00305       mSetupParams->setFormat(format);
    00306       mSetupParams->setGenMipmaps(mipmaps);
    00307       mSetupParams->setBorder(border);
    00308     }
    00309
    00311     void createTexture1D(Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00312     {
    00313       prepareTexture1D(image, format, mipmaps, border);
    00314       createTexture();
    00315     }
    00316
    00318     void prepareTexture2D(int width, int height, ETextureFormat format, bool border=false)
    00319     {
    00320       prepareTexture2D(NULL, format, false, border);
    00321       mSetupParams->setWidth(width);
    00322       mSetupParams->setHeight(height);
    00323     }
    00324
    00326     void createTexture2D(int width, int height, ETextureFormat format, bool border=false)
    00327     {
    00328       prepareTexture2D(width, height, format, border);
    00329       createTexture();
    00330     }
    00331
    00333     void prepareTexture2D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00334     {
    00335       prepareTexture2D(NULL, format, mipmaps, border);
    00336       mSetupParams->setImagePath(image_path);
    00337     }
    00338
    00340     void createTexture2D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00341     {
    00342       prepareTexture2D(image_path, format, mipmaps, border);
    00343       createTexture();
    00344     }
    00345
    00347     void prepareTexture2D(Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00348     {
    00349       mSetupParams = new SetupParams;
    00350       mSetupParams->setImage(image);
    00351       mSetupParams->setDimension(TD_TEXTURE_2D);
    00352       mSetupParams->setFormat(format);
    00353       mSetupParams->setGenMipmaps(mipmaps);
    00354       mSetupParams->setBorder(border);
    00355     }
    00356
    00358     void createTexture2D(Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00359     {
    00360       prepareTexture2D(image, format, mipmaps, border);
    00361       createTexture();
    00362     }
    00363
    00365     void prepareTexture3D(int width, int height, int depth, ETextureFormat format, bool border=false)
    00366     {
    00367       prepareTexture3D(NULL, format, false, border);
    00368       mSetupParams->setWidth(width);
    00369       mSetupParams->setHeight(height);
    00370       mSetupParams->setDepth(depth);
    00371     }
    00372
    00374     void createTexture3D(int width, int height, int depth, ETextureFormat format, bool border=false)
    00375     {
    00376       prepareTexture3D(width, height, depth, format, border);
    00377       createTexture();
    00378     }
    00379
    00381     void prepareTexture3D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00382     {
    00383       prepareTexture3D(NULL, format, mipmaps, border);
    00384       mSetupParams->setImagePath(image_path);
    00385     }
    00386
    00388     void createTexture3D(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00389     {
    00390       prepareTexture3D(image_path, format, mipmaps, border);
    00391       createTexture();
    00392     }
    00393
    00395     void prepareTexture3D(Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00396     {
    00397       mSetupParams = new SetupParams;
    00398       mSetupParams->setImage(image);
    00399       mSetupParams->setDimension(TD_TEXTURE_3D);
    00400       mSetupParams->setFormat(format);
    00401       mSetupParams->setGenMipmaps(mipmaps);
    00402       mSetupParams->setBorder(border);
    00403     }
    00404
    00406     void createTexture3D(Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00407     {
    00408       prepareTexture3D(image, format, mipmaps, border);
    00409       createTexture();
    00410     }
    00411
    00413     void prepareTextureCubemap(int width, int height, ETextureFormat format, bool border=false)
    00414     {
    00415       prepareTextureCubemap(NULL, format, false, border);
    00416       mSetupParams->setWidth(width);
    00417       mSetupParams->setHeight(height);
    00418     }
    00419
    00421     void createTextureCubemap(int width, int height, ETextureFormat format, bool border=false)
    00422     {
    00423       prepareTextureCubemap(width, height, format, border);
    00424       createTexture();
    00425     }
    00426
    00428     void prepareTextureCubemap(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00429     {
    00430       prepareTextureCubemap(NULL, format, mipmaps, border);
    00431       mSetupParams->setImagePath(image_path);
    00432     }
    00433
    00435     void createTextureCubemap(const String& image_path, ETextureFormat format, bool mipmaps=true, bool border=false)
    00436     {
    00437       prepareTextureCubemap(image_path, format, mipmaps, border);
    00438       createTexture();
    00439     }
    00440
    00442     void prepareTextureCubemap(Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00443     {
    00444       mSetupParams = new SetupParams;
    00445       mSetupParams->setImage(image);
    00446       mSetupParams->setDimension(TD_TEXTURE_CUBE_MAP);
    00447       mSetupParams->setFormat(format);
    00448       mSetupParams->setGenMipmaps(mipmaps);
    00449       mSetupParams->setBorder(border);
    00450     }
    00451
    00453     void createTextureCubemap(Image* image, ETextureFormat format, bool mipmaps=true, bool border=false)
    00454     {
    00455       prepareTextureCubemap(image, format, mipmaps, border);
    00456       createTexture();
    00457     }
    00458
    00460     void prepareTexture1DArray(int width, int count, ETextureFormat format)
    00461     {
    00462       prepareTexture1DArray(NULL, format, false);
    00463       mSetupParams->setWidth(width);
    00464       mSetupParams->setHeight(count);
    00465     }
    00466
    00468     void createTexture1DArray(int width, int count, ETextureFormat format)
    00469     {
    00470       prepareTexture1DArray(width, count, format);
    00471       createTexture();
    00472     }
    00473
    00475     void prepareTexture1DArray(const String& image_path, ETextureFormat format, bool mipmaps=true)
    00476     {
    00477       prepareTexture1DArray(NULL, format, mipmaps);
    00478       mSetupParams->setImagePath(image_path);
    00479     }
    00480
    00482     void createTexture1DArray(const String& image_path, ETextureFormat format, bool mipmaps=true)
    00483     {
    00484       prepareTexture1DArray(image_path, format, mipmaps);
    00485       createTexture();
    00486     }
    00487
    00489     void prepareTexture1DArray(Image* image, ETextureFormat format, bool mipmaps=true)
    00490     {
    00491       mSetupParams = new SetupParams;
    00492       mSetupParams->setImage(image);
    00493       mSetupParams->setDimension(TD_TEXTURE_1D_ARRAY);
    00494       mSetupParams->setFormat(format);
    00495       mSetupParams->setGenMipmaps(mipmaps);
    00496       mSetupParams->setBorder(false);
    00497     }
    00498
    00500     void createTexture1DArray(Image* image, ETextureFormat format, bool mipmaps=true)
    00501     {
    00502       prepareTexture1DArray(image, format, mipmaps);
    00503       createTexture();
    00504     }
    00505
    00507     void prepareTexture2DArray(int width, int height, int count, ETextureFormat format)
    00508     {
    00509       prepareTexture2DArray(NULL, format, false);
    00510       mSetupParams->setWidth(width);
    00511       mSetupParams->setHeight(height);
    00512       mSetupParams->setDepth(count);
    00513     }
    00514
    00516     void createTexture2DArray(int width, int height, int count, ETextureFormat format)
    00517     {
    00518       prepareTexture2DArray(width, height, count, format);
    00519       createTexture();
    00520     }
    00521
    00523     void prepareTexture2DArray(const String& image_path, ETextureFormat format, bool mipmaps=true)
    00524     {
    00525       prepareTexture2DArray(NULL, format, mipmaps);
    00526       mSetupParams->setImagePath(image_path);
    00527     }
    00528
    00530     void createTexture2DArray(const String& image_path, ETextureFormat format, bool mipmaps=true)
    00531     {
    00532       prepareTexture2DArray(image_path, format, mipmaps);
    00533       createTexture();
    00534     }
    00535
    00537     void prepareTexture2DArray(Image* image, ETextureFormat format, bool mipmaps=true)
    00538     {
    00539       mSetupParams = new SetupParams;
    00540       mSetupParams->setImage(image);
    00541       mSetupParams->setDimension(TD_TEXTURE_2D_ARRAY);
    00542       mSetupParams->setFormat(format);
    00543       mSetupParams->setGenMipmaps(mipmaps);
    00544       mSetupParams->setBorder(false);
    00545     }
    00546
    00548     void createTexture2DArray(Image* image, ETextureFormat format, bool mipmaps=true)
    00549     {
    00550       prepareTexture2DArray(image, format, mipmaps);
    00551       createTexture();
    00552     }
    00553
    00555     void prepareTextureRectangle(int width, int height, ETextureFormat format)
    00556     {
    00557       prepareTextureRectangle(NULL, format);
    00558       mSetupParams->setWidth(width);
    00559       mSetupParams->setHeight(height);
    00560     }
    00561
    00563     void createTextureRectangle(int width, int height, ETextureFormat format)
    00564     {
    00565       prepareTextureRectangle(width, height, format);
    00566       createTexture();
    00567     }
    00568
    00570     void prepareTextureRectangle(const String& image_path, ETextureFormat format)
    00571     {
    00572       prepareTextureRectangle(NULL, format);
    00573       mSetupParams->setImagePath(image_path);
    00574     }
    00575
    00577     void createTextureRectangle(const String& image_path, ETextureFormat format)
    00578     {
    00579       prepareTextureRectangle(image_path, format);
    00580       createTexture();
    00581     }
    00582
    00584     void prepareTextureRectangle(Image* image, ETextureFormat format)
    00585     {
    00586       mSetupParams = new SetupParams;
    00587       mSetupParams->setImage(image);
    00588       mSetupParams->setDimension(TD_TEXTURE_RECTANGLE);
    00589       mSetupParams->setFormat(format);
    00590       mSetupParams->setGenMipmaps(false);
    00591       mSetupParams->setBorder(false);
    00592     }
    00593
    00595     void createTextureRectangle(Image* image, ETextureFormat format)
    00596     {
    00597       prepareTextureRectangle(image, format);
    00598       createTexture();
    00599     }
    00600
    00602     void prepareTextureBuffer(vl::ETextureFormat format, GLBufferObject* bo)
    00603     {
    00604       mSetupParams = new SetupParams;
    00605       mSetupParams->setDimension(TD_TEXTURE_BUFFER);
    00606       mSetupParams->setFormat(format);
    00607       mSetupParams->setBufferObject(bo);
    00608       mSetupParams->setGenMipmaps(false);
    00609       mSetupParams->setBorder(false);
    00610     }
    00611
    00613     void createTextureBuffer(vl::ETextureFormat format, GLBufferObject* bo)
    00614     {
    00615       prepareTextureBuffer(format, bo);
    00616       createTexture();
    00617     }
    00618
    00620     void prepareTexture2DMultisample(int width, int height, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
    00621     {
    00622       mSetupParams = new SetupParams;
    00623       mSetupParams->setDimension(TD_TEXTURE_2D_MULTISAMPLE);
    00624       mSetupParams->setWidth(width);
    00625       mSetupParams->setHeight(height);
    00626       mSetupParams->setFormat(format);
    00627       mSetupParams->setSamples(samples);
    00628       mSetupParams->setFixedSamplesLocations(fixedsamplelocations);
    00629       mSetupParams->setGenMipmaps(false);
    00630       mSetupParams->setBorder(false);
    00631     }
    00632
    00634     void createTexture2DMultisample(int width, int height, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
    00635     {
    00636       prepareTexture2DMultisample(width, height, format, samples, fixedsamplelocations);
    00637       createTexture();
    00638     }
    00639
    00641     void prepareTexture2DMultisampleArray(int width, int height, int depth, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
    00642     {
    00643       mSetupParams = new SetupParams;
    00644       mSetupParams->setDimension(TD_TEXTURE_2D_MULTISAMPLE_ARRAY);
    00645       mSetupParams->setWidth(width);
    00646       mSetupParams->setHeight(height);
    00647       mSetupParams->setDepth(depth);
    00648       mSetupParams->setFormat(format);
    00649       mSetupParams->setSamples(samples);
    00650       mSetupParams->setFixedSamplesLocations(fixedsamplelocations);
    00651       mSetupParams->setGenMipmaps(false);
    00652       mSetupParams->setBorder(false);
    00653     }
    00654
    00656     void createTexture2DMultisampleArray(int width, int height, int depth, vl::ETextureFormat format, int samples, bool fixedsamplelocations)
    00657     {
    00658       prepareTexture2DMultisampleArray(width, height, depth, format, samples, fixedsamplelocations);
    00659       createTexture();
    00660     }
    00661
    00663     bool isValid() const;
    00664
    00666     unsigned int handle() const { return mHandle; }
    00668     void setHandle(unsigned int id) { mHandle = id; }
    00669
    00671     void setDimension(ETextureDimension dimension) { mDimension = dimension; }
    00673     ETextureDimension dimension() const { return mDimension; }
    00674
    00676     void setInternalFormat(ETextureFormat format) { mFormat = format; }
    00678     ETextureFormat internalFormat() const { return mFormat; }
    00679
    00681     void setWidth(int x)  { mWidth = x; }
    00683     int width() const { return mWidth; }
    00684
    00686     void setHeight(int y) { mHeight = y; }
    00688     int height() const { return mHeight; }
    00689
    00691     void setDepth(int z)  { mDepth = z; }
    00693     int depth() const { return mDepth; }
    00694
    00696     void setBorder(bool border) { mBorder = border; }
    00698     bool border() const { return mBorder; }
    00699
    00701     int samples() const { return mSamples; }
    00702
    00704     bool fixedSamplesLocation() const { return mFixedSamplesLocation; }
    00705
    00707     const SetupParams* setupParams() const { return mSetupParams.get(); }
    00708
    00710     SetupParams* setupParams() { return mSetupParams.get(); }
    00711
    00713     void setSetupParams(SetupParams* setup_params) { mSetupParams = setup_params; }
    00714
    00716     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);
    00717
    00719     static bool isCompressedFormat(int format);
    00720
    00722     bool isDepthTexture() const;
    00723
    00726     void clone(const Texture& other);
    00727
    00728   private:
    00729     Texture(const Texture& other): Object(other) {}
    00730     void operator=(const Texture&) {}
    00731     void reset();
    00732
    00733   protected:
    00734     unsigned int mHandle;
    00735     TexParameter mTexParameter;
    00736     ref<SetupParams> mSetupParams;
    00737     ref<GLBufferObject> mBufferObject;
    00738     ETextureFormat mFormat;
    00739     ETextureDimension mDimension;
    00740     int mWidth;
    00741     int mHeight;
    00742     int mDepth;
    00743     int mSamples;
    00744     bool mBorder;
    00745     bool mFixedSamplesLocation;
    00746   };
    00747 }
    00748
    00749 #endif

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:25.
Permission is granted to use this page to write and publish articles regarding Visualization Library.