Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
acgl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACGL
acgl
Commits
98b64e11
Commit
98b64e11
authored
12 years ago
by
Robert Menzel
Browse files
Options
Downloads
Patches
Plain Diff
added missing sampling parameters to TextureBase
parent
2ec9c2eb
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/ACGL/OpenGL/Objects/Texture.hh
+33
-1
33 additions, 1 deletion
include/ACGL/OpenGL/Objects/Texture.hh
src/ACGL/OpenGL/Objects/Texture.cc
+36
-0
36 additions, 0 deletions
src/ACGL/OpenGL/Objects/Texture.cc
with
69 additions
and
1 deletion
include/ACGL/OpenGL/Objects/Texture.hh
+
33
−
1
View file @
98b64e11
...
...
@@ -40,6 +40,8 @@ namespace OpenGL{
*
* Multiple states, e.g. the sampling mode gets stored in a texture as getting this infos back from
* GL is not trivial (at least if the currently bound texture should not change).
*
* WARNING: All setter bind the texture to the currently active texture unit!
*/
class
TextureBase
{
...
...
@@ -65,7 +67,12 @@ public:
mMagFilter
(
GL_LINEAR
),
mWrapS
(
GL_REPEAT
),
mWrapT
(
GL_REPEAT
),
mWrapR
(
GL_REPEAT
)
mWrapR
(
GL_REPEAT
),
mMinLod
(
-
1000
),
mMaxLod
(
1000
),
mLodBias
(
0.0
f
),
mCompareMode
(
GL_NONE
),
mCompareFunc
(
GL_LEQUAL
)
{
glGenTextures
(
1
,
&
mObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
...
...
@@ -92,6 +99,11 @@ public:
inline
GLenum
getType
(
void
)
const
{
return
mType
;
}
inline
GLint
getMinFilter
(
void
)
const
{
return
mMinFilter
;
}
inline
GLint
getMagFilter
(
void
)
const
{
return
mMagFilter
;
}
inline
GLint
getMinLOD
(
void
)
const
{
return
mMinLod
;
}
inline
GLint
getMaxLOD
(
void
)
const
{
return
mMaxLod
;
}
inline
GLfloat
getLODBias
(
void
)
const
{
return
mLodBias
;
}
inline
GLenum
getCompareMode
(
void
)
const
{
return
mCompareMode
;
}
inline
GLenum
getCompareFunc
(
void
)
const
{
return
mCompareFunc
;
}
#ifndef ACGL_OPENGLES_VERSION_20
inline
GLenum
getWrapS
(
void
)
const
{
return
mWrapS
;
}
...
...
@@ -147,6 +159,21 @@ public:
void
setWrap
(
GLenum
_wrapS
,
GLenum
_wrapT
=
0
,
GLenum
_wrapR
=
0
);
#endif
//! lowest mipmap level to use
void
setMinLOD
(
GLint
_lod
=
-
1000
);
//! highest mipmap level to use
void
setMaxLOD
(
GLint
_lod
=
1000
);
//! offset to add to the mipmap level calculation
void
setLODBias
(
GLfloat
_bias
=
0.0
f
);
//! for usage of a texture with depth data
void
setCompareMode
(
GLenum
_mode
=
GL_NONE
);
//! for usage of a texture with depth data
void
setCompareFunc
(
GLenum
_func
=
GL_LEQUAL
);
//! _sampleCount = 1.0 to deactivate anisotrop filtering, maximum is often 16. If a value is too high it will get clamped to the maximum
void
setAnisotropicFilter
(
GLfloat
_sampleCount
);
...
...
@@ -174,6 +201,11 @@ protected:
GLenum
mWrapS
;
GLenum
mWrapT
;
GLenum
mWrapR
;
GLint
mMinLod
;
GLint
mMaxLod
;
GLfloat
mLodBias
;
GLenum
mCompareMode
;
GLenum
mCompareFunc
;
};
ACGL_SMARTPOINTER_TYPEDEFS
(
TextureBase
)
...
...
This diff is collapsed.
Click to expand it.
src/ACGL/OpenGL/Objects/Texture.cc
+
36
−
0
View file @
98b64e11
...
...
@@ -54,6 +54,42 @@ void TextureBase::setWrap( GLenum _wrapS, GLenum _wrapT, GLenum _wrapR )
}
#endif // ACGL_OPENGLES_VERSION_20
void
TextureBase
::
setMinLOD
(
GLint
_lod
)
{
glBindTexture
(
mTarget
,
mObjectName
);
mMinLod
=
_lod
;
glTexParameteri
(
mTarget
,
GL_TEXTURE_MIN_LOD
,
_lod
);
}
void
TextureBase
::
setMaxLOD
(
GLint
_lod
)
{
glBindTexture
(
mTarget
,
mObjectName
);
mMaxLod
=
_lod
;
glTexParameteri
(
mTarget
,
GL_TEXTURE_MAX_LOD
,
_lod
);
}
void
TextureBase
::
setLODBias
(
GLfloat
_bias
)
{
glBindTexture
(
mTarget
,
mObjectName
);
mLodBias
=
_bias
;
glTexParameterf
(
mTarget
,
GL_TEXTURE_LOD_BIAS
,
_bias
);
}
void
TextureBase
::
setCompareMode
(
GLenum
_mode
)
{
glBindTexture
(
mTarget
,
mObjectName
);
mCompareMode
=
_mode
;
glTexParameteri
(
mTarget
,
GL_TEXTURE_COMPARE_MODE
,
_mode
);
}
void
TextureBase
::
setCompareFunc
(
GLenum
_func
)
{
glBindTexture
(
mTarget
,
mObjectName
);
mCompareFunc
=
_func
;
glTexParameteri
(
mTarget
,
GL_TEXTURE_COMPARE_FUNC
,
_func
);
}
void
TextureBase
::
setAnisotropicFilter
(
GLfloat
_sampleCount
)
{
if
(
ACGL_EXT_texture_filter_anisotrophic
()
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment