Fixed compile flags in Texture
This commit is contained in:
@@ -176,11 +176,28 @@ class SG_EXPORT Texture : public StateAttribute
|
||||
ANISOTROPIC = GL_TEXTURE_MAX_ANISOTROPY_EXT
|
||||
};
|
||||
|
||||
|
||||
/** Set the texture filter mode.*/
|
||||
void setFilter(const FilterParameter which, const FilterMode filter);
|
||||
/** Get the texture filter mode.*/
|
||||
const FilterMode getFilter(const FilterParameter which) const;
|
||||
|
||||
enum CompileFlags {
|
||||
COMPILE_NONE = 0x0,
|
||||
COMPILE_MAG_FILTER = 0x1,
|
||||
COMPILE_MIN_FILTER = 0x2,
|
||||
COMPILE_WRAP_S = 0x4,
|
||||
COMPILE_WRAP_T = 0x8,
|
||||
COMPILE_ALL = 0xFF
|
||||
};
|
||||
|
||||
/** Set the compile flags. Whatever is set will be compiled
|
||||
** when the texture object is built. Otherwise, immediate mode
|
||||
** setting of these modes will occur during the apply
|
||||
**/
|
||||
void setCompileFlags( const CompileFlags compile_flags ) { _compile_flags = compile_flags; }
|
||||
const CompileFlags getCompileFlags( void ) const { return _compile_flags; }
|
||||
|
||||
|
||||
enum InternalFormatMode {
|
||||
USE_IMAGE_DATA_FORMAT,
|
||||
@@ -327,6 +344,8 @@ class SG_EXPORT Texture : public StateAttribute
|
||||
FilterMode _min_filter;
|
||||
FilterMode _mag_filter;
|
||||
|
||||
CompileFlags _compile_flags;
|
||||
|
||||
InternalFormatMode _internalFormatMode;
|
||||
int _internalFormatValue;
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ Texture::Texture()
|
||||
_subloadOffsX = _subloadOffsY = 0;
|
||||
|
||||
_borderColor.set(0.0, 0.0, 0.0, 0.0);//OpenGL default
|
||||
|
||||
_compile_flags = COMPILE_ALL;
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +193,14 @@ void Texture::apply(State& state) const
|
||||
if (_subloadMode == OFF)
|
||||
{
|
||||
glBindTexture( GL_TEXTURE_2D, handle );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _min_filter);
|
||||
if( !(_compile_flags & COMPILE_MIN_FILTER) )
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _min_filter);
|
||||
if( !(_compile_flags & COMPILE_MAG_FILTER) )
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _mag_filter);
|
||||
if( !(_compile_flags & COMPILE_WRAP_S) )
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, _wrap_s );
|
||||
if( !(_compile_flags & COMPILE_WRAP_T) )
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, _wrap_t );
|
||||
}
|
||||
else if (_image.valid() && _image->data())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user