2001-10-04 23:12:57 +08:00
|
|
|
//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield
|
|
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
|
|
//as published by the Free Software Foundation.
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
// -*-c++-*-
|
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
#ifndef OSG_TEXTURE
|
|
|
|
#define OSG_TEXTURE 1
|
|
|
|
|
|
|
|
#include <osg/GL>
|
2001-09-20 05:08:56 +08:00
|
|
|
#include <osg/Types>
|
2001-01-11 00:32:10 +08:00
|
|
|
#include <osg/Image>
|
2001-09-20 05:08:56 +08:00
|
|
|
#include <osg/StateAttribute>
|
|
|
|
#include <osg/StateSet>
|
|
|
|
#include <osg/ref_ptr>
|
2002-03-01 17:27:10 +08:00
|
|
|
#include <osg/Vec4>
|
2001-01-11 00:32:10 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
// if not defined by gl.h use the definition found in:
|
|
|
|
// http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_filter_anisotropic.txt
|
|
|
|
#ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT
|
2001-10-30 03:29:49 +08:00
|
|
|
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
2001-09-20 05:08:56 +08:00
|
|
|
#endif
|
2001-01-11 00:32:10 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
#ifndef GL_ARB_texture_compression
|
|
|
|
#define GL_COMPRESSED_ALPHA_ARB 0x84E9
|
|
|
|
#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA
|
|
|
|
#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB
|
|
|
|
#define GL_COMPRESSED_INTENSITY_ARB 0x84EC
|
|
|
|
#define GL_COMPRESSED_RGB_ARB 0x84ED
|
|
|
|
#define GL_COMPRESSED_RGBA_ARB 0x84EE
|
|
|
|
#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF
|
|
|
|
#define GL_TEXTURE_IMAGE_SIZE_ARB 0x86A0
|
|
|
|
#define GL_TEXTURE_COMPRESSED_ARB 0x86A1
|
|
|
|
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
|
|
|
|
#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GL_EXT_texture_compression_s3tc
|
|
|
|
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
|
|
|
|
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
|
|
|
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
|
|
|
|
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
|
|
|
#endif
|
2001-01-11 00:32:10 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
#ifndef GL_MIRRORED_REPEAT_IBM
|
|
|
|
#define GL_MIRRORED_REPEAT_IBM 0x8370
|
|
|
|
#endif
|
|
|
|
|
2001-12-05 04:38:27 +08:00
|
|
|
#ifndef GL_CLAMP_TO_EDGE
|
|
|
|
#define GL_CLAMP_TO_EDGE 0x812F
|
|
|
|
#endif
|
|
|
|
|
2002-02-28 06:00:47 +08:00
|
|
|
#ifndef GL_CLAMP_TO_BORDER_ARB
|
2002-03-23 18:55:29 +08:00
|
|
|
#define GL_CLAMP_TO_BORDER_ARB 0x812D
|
2002-02-28 06:00:47 +08:00
|
|
|
#endif
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
#ifndef GL_GENERATE_MIPMAP_SGIS
|
2001-10-30 03:29:49 +08:00
|
|
|
#define GL_GENERATE_MIPMAP_SGIS 0x8191
|
2001-09-20 05:08:56 +08:00
|
|
|
#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
|
|
|
|
#endif
|
|
|
|
|
2002-03-23 18:55:29 +08:00
|
|
|
#ifndef GL_TEXTURE_3D
|
|
|
|
#define GL_TEXTURE_3D 0x806F
|
|
|
|
#endif
|
2001-09-20 05:08:56 +08:00
|
|
|
|
|
|
|
namespace osg {
|
2001-01-11 00:32:10 +08:00
|
|
|
|
|
|
|
/** Texture state class which encapsulates OpenGl texture functionality.*/
|
2001-09-20 05:08:56 +08:00
|
|
|
class SG_EXPORT Texture : public StateAttribute
|
2001-01-11 00:32:10 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
public :
|
|
|
|
|
|
|
|
Texture();
|
|
|
|
|
2002-01-29 22:04:06 +08:00
|
|
|
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
|
|
|
Texture(const Texture& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
|
|
|
StateAttribute(text,copyop),
|
2002-03-01 17:27:10 +08:00
|
|
|
_handleList(),
|
|
|
|
_modifiedTag(),
|
2002-01-29 22:04:06 +08:00
|
|
|
_image(copyop(text._image.get())),
|
2002-03-19 07:10:33 +08:00
|
|
|
_target(text._target),
|
Added support for shallow and deep copy of nodes, drawables and state, via a
copy constructor which takes an optional Cloner object, and the old
osg::Object::clone() has changed so that it now requires a Cloner as paramter.
This is passed on to the copy constructor to help control the shallow vs
deep copying. The old functionality of clone() which was clone of type has
been renamed to cloneType().
Updated all of the OSG to work with these new conventions, implemention all
the required copy constructors etc. A couple of areas will do shallow
copies by design, a couple of other still need to be updated to do either
shallow or deep.
Neither of the shallow or deep copy operations have been tested yet, only
the old functionality of the OSG has been checked so far, such running the
viewer on various demo datasets.
Also fixed a problem in osg::Optimize::RemoveRendundentNodesVisitor which
was not checking that Group didn't have have any attached StateSet's, Callbacks
or UserData. These checks have now been added, which fixes a bug which was
revealled by the new osgscribe demo, this related to removal of group acting
as state decorator.
method
2002-01-29 05:17:01 +08:00
|
|
|
_wrap_s(text._wrap_s),
|
|
|
|
_wrap_t(text._wrap_t),
|
|
|
|
_wrap_r(text._wrap_r),
|
|
|
|
_min_filter(text._min_filter),
|
|
|
|
_mag_filter(text._mag_filter),
|
2002-03-15 00:01:21 +08:00
|
|
|
_texParamtersDirty(false),
|
Added support for shallow and deep copy of nodes, drawables and state, via a
copy constructor which takes an optional Cloner object, and the old
osg::Object::clone() has changed so that it now requires a Cloner as paramter.
This is passed on to the copy constructor to help control the shallow vs
deep copying. The old functionality of clone() which was clone of type has
been renamed to cloneType().
Updated all of the OSG to work with these new conventions, implemention all
the required copy constructors etc. A couple of areas will do shallow
copies by design, a couple of other still need to be updated to do either
shallow or deep.
Neither of the shallow or deep copy operations have been tested yet, only
the old functionality of the OSG has been checked so far, such running the
viewer on various demo datasets.
Also fixed a problem in osg::Optimize::RemoveRendundentNodesVisitor which
was not checking that Group didn't have have any attached StateSet's, Callbacks
or UserData. These checks have now been added, which fixes a bug which was
revealled by the new osgscribe demo, this related to removal of group acting
as state decorator.
method
2002-01-29 05:17:01 +08:00
|
|
|
_internalFormatMode(text._internalFormatMode),
|
|
|
|
_internalFormatValue(text._internalFormatValue),
|
2002-03-01 17:27:10 +08:00
|
|
|
_borderColor(text._borderColor),
|
Added support for shallow and deep copy of nodes, drawables and state, via a
copy constructor which takes an optional Cloner object, and the old
osg::Object::clone() has changed so that it now requires a Cloner as paramter.
This is passed on to the copy constructor to help control the shallow vs
deep copying. The old functionality of clone() which was clone of type has
been renamed to cloneType().
Updated all of the OSG to work with these new conventions, implemention all
the required copy constructors etc. A couple of areas will do shallow
copies by design, a couple of other still need to be updated to do either
shallow or deep.
Neither of the shallow or deep copy operations have been tested yet, only
the old functionality of the OSG has been checked so far, such running the
viewer on various demo datasets.
Also fixed a problem in osg::Optimize::RemoveRendundentNodesVisitor which
was not checking that Group didn't have have any attached StateSet's, Callbacks
or UserData. These checks have now been added, which fixes a bug which was
revealled by the new osgscribe demo, this related to removal of group acting
as state decorator.
method
2002-01-29 05:17:01 +08:00
|
|
|
_textureWidth(text._textureWidth),
|
|
|
|
_textureHeight(text._textureHeight),
|
|
|
|
_subloadMode(text._subloadMode),
|
|
|
|
_subloadOffsX(text._subloadOffsX),
|
2002-03-28 06:51:58 +08:00
|
|
|
_subloadOffsY(text._subloadOffsY),
|
|
|
|
_subloadWidth(text._subloadWidth),
|
|
|
|
_subloadHeight(text._subloadHeight) {}
|
Added support for shallow and deep copy of nodes, drawables and state, via a
copy constructor which takes an optional Cloner object, and the old
osg::Object::clone() has changed so that it now requires a Cloner as paramter.
This is passed on to the copy constructor to help control the shallow vs
deep copying. The old functionality of clone() which was clone of type has
been renamed to cloneType().
Updated all of the OSG to work with these new conventions, implemention all
the required copy constructors etc. A couple of areas will do shallow
copies by design, a couple of other still need to be updated to do either
shallow or deep.
Neither of the shallow or deep copy operations have been tested yet, only
the old functionality of the OSG has been checked so far, such running the
viewer on various demo datasets.
Also fixed a problem in osg::Optimize::RemoveRendundentNodesVisitor which
was not checking that Group didn't have have any attached StateSet's, Callbacks
or UserData. These checks have now been added, which fixes a bug which was
revealled by the new osgscribe demo, this related to removal of group acting
as state decorator.
method
2002-01-29 05:17:01 +08:00
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
META_StateAttribute(osg, Texture,TEXTURE);
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2001-09-22 10:42:08 +08:00
|
|
|
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
|
|
|
virtual int compare(const StateAttribute& rhs) const;
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
virtual void setStateSetModes(StateSet& ds,const GLModeValue value) const
|
|
|
|
{
|
2002-03-20 19:24:47 +08:00
|
|
|
ds.setMode(_target,value);
|
2001-09-20 05:08:56 +08:00
|
|
|
}
|
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
/** Set the texture image. */
|
|
|
|
void setImage(Image* image);
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
/** Get the texture image. */
|
2001-09-20 05:08:56 +08:00
|
|
|
Image* getImage() { return _image.get(); }
|
|
|
|
|
|
|
|
/** Get the const texture image. */
|
|
|
|
inline const Image* getImage() const { return _image.get(); }
|
|
|
|
|
|
|
|
/** Copy pixels into a 2D texture image.As per glCopyTexImage2D.
|
|
|
|
* Creates an OpenGL texture object from the current OpenGL background
|
|
|
|
* framebuffer contents at pos \a x, \a y with width \a width and
|
|
|
|
* height \a height. \a width and \a height must be a power of two.
|
|
|
|
*/
|
2002-03-20 19:24:47 +08:00
|
|
|
void copyTexImage2D(State& state, int x, int y, int width, int height );
|
2001-09-20 05:08:56 +08:00
|
|
|
|
|
|
|
/** Copy a two-dimensional texture subimage. As per glCopyTexSubImage2D.
|
2001-10-01 19:15:55 +08:00
|
|
|
* Updates portion of an existing OpenGL texture object from the current OpenGL background
|
2001-09-20 05:08:56 +08:00
|
|
|
* framebuffer contents at pos \a x, \a y with width \a width and
|
|
|
|
* height \a height. \a width and \a height must be a power of two,
|
|
|
|
* and writing into the texture with offset \a xoffset and \a yoffset.
|
|
|
|
*/
|
2002-03-20 19:24:47 +08:00
|
|
|
void copyTexSubImage2D(State& state, int xoffset, int yoffset, int x, int y, int width, int height );
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
enum WrapParameter {
|
|
|
|
WRAP_S,
|
|
|
|
WRAP_T,
|
|
|
|
WRAP_R
|
|
|
|
};
|
|
|
|
|
|
|
|
enum WrapMode {
|
2001-09-20 05:08:56 +08:00
|
|
|
CLAMP = GL_CLAMP,
|
2001-12-05 04:38:27 +08:00
|
|
|
CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE,
|
2002-03-15 00:01:21 +08:00
|
|
|
CLAMP_TO_BORDER = GL_CLAMP_TO_BORDER_ARB,
|
2001-09-20 05:08:56 +08:00
|
|
|
REPEAT = GL_REPEAT,
|
2002-03-15 00:01:21 +08:00
|
|
|
MIRROR = GL_MIRRORED_REPEAT_IBM
|
2001-01-11 00:32:10 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Set the texture wrap mode.*/
|
2001-09-20 05:08:56 +08:00
|
|
|
void setWrap(const WrapParameter which, const WrapMode wrap);
|
2001-01-11 00:32:10 +08:00
|
|
|
/** Get the texture wrap mode.*/
|
2001-09-20 05:08:56 +08:00
|
|
|
const WrapMode getWrap(const WrapParameter which) const;
|
2001-01-11 00:32:10 +08:00
|
|
|
|
|
|
|
|
2002-03-15 00:01:21 +08:00
|
|
|
/** Sets the border color for this texture. Makes difference only if
|
|
|
|
* wrap mode is CLAMP_TO_BORDER */
|
|
|
|
void setBorderColor(const Vec4& color) { _borderColor = color; _texParamtersDirty = true; }
|
|
|
|
|
|
|
|
const Vec4& borderColor(void) const { return _borderColor; }
|
|
|
|
|
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
enum FilterParameter {
|
|
|
|
MIN_FILTER,
|
|
|
|
MAG_FILTER
|
|
|
|
};
|
|
|
|
|
|
|
|
enum FilterMode {
|
|
|
|
LINEAR = GL_LINEAR,
|
|
|
|
LINEAR_MIPMAP_LINEAR = GL_LINEAR_MIPMAP_LINEAR,
|
|
|
|
LINEAR_MIPMAP_NEAREST = GL_LINEAR_MIPMAP_NEAREST,
|
|
|
|
NEAREST = GL_NEAREST,
|
|
|
|
NEAREST_MIPMAP_LINEAR = GL_NEAREST_MIPMAP_LINEAR,
|
2001-09-20 05:08:56 +08:00
|
|
|
NEAREST_MIPMAP_NEAREST = GL_NEAREST_MIPMAP_NEAREST,
|
2002-03-20 19:24:47 +08:00
|
|
|
ANISOTROPIC = GL_TEXTURE_MAX_ANISOTROPY_EXT
|
2001-01-11 00:32:10 +08:00
|
|
|
};
|
|
|
|
|
2002-03-14 08:07:29 +08:00
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
/** Set the texture filter mode.*/
|
2001-09-20 05:08:56 +08:00
|
|
|
void setFilter(const FilterParameter which, const FilterMode filter);
|
2002-03-20 19:24:47 +08:00
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
/** Get the texture filter mode.*/
|
2001-09-20 05:08:56 +08:00
|
|
|
const FilterMode getFilter(const FilterParameter which) const;
|
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
enum InternalFormatMode {
|
|
|
|
USE_IMAGE_DATA_FORMAT,
|
|
|
|
USE_USER_DEFINED_FORMAT,
|
|
|
|
USE_ARB_COMPRESSION,
|
|
|
|
USE_S3TC_DXT1_COMPRESSION,
|
|
|
|
USE_S3TC_DXT3_COMPRESSION,
|
|
|
|
USE_S3TC_DXT5_COMPRESSION
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Set the internal format mode.
|
|
|
|
* Note, If the mode is set USE_IMAGE_DATA_FORMAT, USE_ARB_COMPRESSION,
|
|
|
|
* USE_S3TC_COMPRESSION the internalFormat is automatically selected,
|
|
|
|
* and will overwrite the previous _internalFormatValue.
|
|
|
|
*/
|
|
|
|
inline void setInternalFormatMode(const InternalFormatMode mode) { _internalFormatMode = mode; }
|
2001-01-11 00:32:10 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
/** Get the internal format mode.*/
|
|
|
|
inline const InternalFormatMode getInternalFormatMode() const { return _internalFormatMode; }
|
2001-01-11 00:32:10 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
/** Set the internal format to use when creating OpenGL textures.
|
|
|
|
* Also sets the internalFormatMode to USE_USER_DEFINED_FORMAT.
|
|
|
|
*/
|
|
|
|
inline void setInternalFormatValue(const int internalFormat)
|
|
|
|
{
|
|
|
|
_internalFormatMode = USE_USER_DEFINED_FORMAT;
|
|
|
|
_internalFormatValue = internalFormat;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Get the internal format to use when creating OpenGL textures.*/
|
|
|
|
inline const int getInternalFormatValue() const { return _internalFormatValue; }
|
|
|
|
|
|
|
|
/** return the OpenGL texture object for specified context.*/
|
|
|
|
inline const uint getTextureObject(const uint contextID) const { if (contextID<_handleList.size()) return _handleList[contextID]; else return 0;}
|
|
|
|
|
|
|
|
|
|
|
|
enum SubloadMode {
|
|
|
|
OFF,
|
|
|
|
AUTO,
|
|
|
|
IF_DIRTY
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Set the texture subload mode. */
|
|
|
|
inline void setSubloadMode(const SubloadMode mode) { _subloadMode = mode; }
|
|
|
|
|
|
|
|
/** Get the texture subload mode. */
|
|
|
|
inline const SubloadMode getSubloadMode() const { return _subloadMode; }
|
|
|
|
|
|
|
|
/** Set the texture subload offsets. */
|
|
|
|
inline void setSubloadOffset(const int x, const int y) {
|
|
|
|
_subloadOffsX = x;
|
|
|
|
_subloadOffsY = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Get the texture subload offsets. */
|
|
|
|
inline void getSubloadOffset(int& x, int& y) const {
|
|
|
|
x = _subloadOffsX;
|
|
|
|
y = _subloadOffsY;
|
|
|
|
}
|
|
|
|
|
2002-03-28 06:51:58 +08:00
|
|
|
/** Set the texture subload width. If width or height are zero then
|
|
|
|
* the repsective size value is calculated from the source image sizes. */
|
|
|
|
inline void setSubloadSize(const int width, const int height) {
|
|
|
|
_subloadWidth = width;
|
|
|
|
_subloadHeight = height;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Get the texture subload width. */
|
|
|
|
inline void getSubloadSize(int& width, int& height) const {
|
|
|
|
width = _subloadWidth;
|
|
|
|
height = _subloadHeight;
|
|
|
|
}
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
/** Get the handle to the texture object for the current context.*/
|
2001-09-22 10:42:08 +08:00
|
|
|
inline GLuint& getHandle(const uint contextID) const
|
2001-09-20 05:08:56 +08:00
|
|
|
{
|
|
|
|
// pad out handle list if required.
|
2002-02-28 08:11:31 +08:00
|
|
|
if (_handleList.size()<=contextID)
|
2002-06-24 05:43:46 +08:00
|
|
|
_handleList.resize(contextID+1,0);
|
2001-09-20 05:08:56 +08:00
|
|
|
|
|
|
|
// get the globj for the current contextID.
|
|
|
|
return _handleList[contextID];
|
|
|
|
}
|
|
|
|
|
2002-02-28 08:11:31 +08:00
|
|
|
inline uint& getModifiedTag(const uint contextID) const
|
|
|
|
{
|
|
|
|
// pad out handle list if required.
|
|
|
|
if (_modifiedTag.size()<=contextID)
|
|
|
|
_modifiedTag.resize(contextID,0);
|
|
|
|
|
|
|
|
// get the modified tag for the current contextID.
|
|
|
|
return _modifiedTag[contextID];
|
|
|
|
}
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
/** Force a recompile on next apply() of associated OpenGL texture objects.*/
|
|
|
|
void dirtyTextureObject();
|
|
|
|
|
|
|
|
/** On first apply (unless already compiled), create the minmapped
|
|
|
|
* texture and bind it, subsequent apply will simple bind to texture.*/
|
|
|
|
virtual void apply(State& state) const;
|
|
|
|
|
|
|
|
/** Compile the texture mip maps. Implemented by simply calling apply().*/
|
|
|
|
virtual void compile(State& state) const;
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-03-01 17:27:10 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
|
|
|
|
/** use deleteTextureObject instead of glDeleteTextures to allow
|
|
|
|
* OpenGL texture objects to cached until they can be deleted
|
|
|
|
* by the OpenGL context in which they were created, specified
|
|
|
|
* by contextID.*/
|
2001-09-22 10:42:08 +08:00
|
|
|
static void deleteTextureObject(uint contextID,GLuint handle);
|
2001-09-20 05:08:56 +08:00
|
|
|
|
|
|
|
/** flush all the cached display list which need to be deleted
|
|
|
|
* in the OpenGL context related to contextID.*/
|
|
|
|
static void flushDeletedTextureObjects(uint contextID);
|
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
|
|
|
|
protected :
|
|
|
|
|
|
|
|
virtual ~Texture();
|
|
|
|
|
2002-03-15 00:01:21 +08:00
|
|
|
|
2002-03-20 19:24:47 +08:00
|
|
|
/** Method which does setting of texture paramters. */
|
|
|
|
void applyTexParameters(GLenum target, State& state) const;
|
|
|
|
|
|
|
|
/** Method which does the creation of the texture itself, and
|
|
|
|
* does not set or use texture binding. */
|
|
|
|
virtual void applyTexImage(GLenum target, Image* image, State& state) const;
|
2002-03-15 00:01:21 +08:00
|
|
|
|
2001-09-22 10:42:08 +08:00
|
|
|
typedef std::vector<GLuint> TextureNameList;
|
2001-09-20 05:08:56 +08:00
|
|
|
mutable TextureNameList _handleList;
|
2001-01-11 00:32:10 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
typedef std::vector<uint> ImageModifiedTag;
|
|
|
|
mutable ImageModifiedTag _modifiedTag;
|
2001-01-11 00:32:10 +08:00
|
|
|
|
2002-03-15 00:01:21 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
// not ideal that _image is mutable, but its required since
|
|
|
|
// Image::ensureDimensionsArePowerOfTwo() can only be called
|
|
|
|
// in a valid OpenGL context, a therefore within an Texture::apply
|
|
|
|
// which is const...
|
|
|
|
mutable ref_ptr<Image> _image;
|
2001-01-11 00:32:10 +08:00
|
|
|
|
2002-03-19 07:10:33 +08:00
|
|
|
GLenum _target; // defaults to GL_TEXTURE_2D
|
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
WrapMode _wrap_s;
|
|
|
|
WrapMode _wrap_t;
|
|
|
|
WrapMode _wrap_r;
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
FilterMode _min_filter;
|
|
|
|
FilterMode _mag_filter;
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2002-03-15 00:01:21 +08:00
|
|
|
// true if apply tex parameters required.
|
|
|
|
mutable bool _texParamtersDirty;
|
|
|
|
|
2002-03-14 08:07:29 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
InternalFormatMode _internalFormatMode;
|
|
|
|
int _internalFormatValue;
|
|
|
|
|
2002-03-01 17:27:10 +08:00
|
|
|
Vec4 _borderColor;
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
// subloaded images can have different texture and image sizes.
|
2002-03-30 01:26:40 +08:00
|
|
|
mutable GLsizei _textureWidth, _textureHeight;
|
2001-09-20 05:08:56 +08:00
|
|
|
|
|
|
|
SubloadMode _subloadMode;
|
2002-03-28 07:04:52 +08:00
|
|
|
GLint _subloadOffsX, _subloadOffsY;
|
|
|
|
GLsizei _subloadWidth, _subloadHeight;
|
2001-09-20 05:08:56 +08:00
|
|
|
|
|
|
|
// static cache of deleted display lists which can only
|
|
|
|
// by completely deleted once the appropriate OpenGL context
|
|
|
|
// is set.
|
|
|
|
typedef std::map<uint,std::set<uint> > DeletedTextureObjectCache;
|
|
|
|
static DeletedTextureObjectCache s_deletedTextureObjectCache;
|
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
};
|
|
|
|
|
2002-02-03 20:33:41 +08:00
|
|
|
}
|
2001-01-11 00:32:10 +08:00
|
|
|
|
|
|
|
#endif
|