Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
acgl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ACGL
acgl
Commits
415799cc
Commit
415799cc
authored
Aug 13, 2013
by
Janis Born
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add getters / setters for texture border color
parent
5d288260
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
21 deletions
+43
-21
include/ACGL/OpenGL/Objects/Texture.hh
include/ACGL/OpenGL/Objects/Texture.hh
+26
-21
src/ACGL/OpenGL/Objects/Texture.cc
src/ACGL/OpenGL/Objects/Texture.cc
+17
-0
No files found.
include/ACGL/OpenGL/Objects/Texture.hh
View file @
415799cc
...
...
@@ -102,27 +102,28 @@ public:
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline
GLuint
getObjectName
(
void
)
const
{
return
mObjectName
;
}
inline
GLenum
getTarget
(
void
)
const
{
return
mTarget
;
}
inline
GLsizei
getWidth
(
void
)
const
{
return
mWidth
;
}
inline
GLsizei
getHeight
(
void
)
const
{
return
mHeight
;
}
inline
GLsizei
getDepth
(
void
)
const
{
return
mDepth
;
}
inline
GLenum
getInternalFormat
(
void
)
const
{
return
mInternalFormat
;
}
inline
GLint
getMinFilter
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_MIN_FILTER
);
}
inline
GLint
getMagFilter
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_MAG_FILTER
);
}
inline
GLint
getBaseLevel
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_BASE_LEVEL
);
}
inline
GLint
getMaxLevel
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_MAX_LEVEL
);
}
inline
GLint
getMinLOD
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_MIN_LOD
);
}
inline
GLint
getMaxLOD
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_MAX_LOD
);
}
inline
GLfloat
getLODBias
(
void
)
const
{
return
getParameterF
(
GL_TEXTURE_LOD_BIAS
);
}
inline
GLenum
getCompareMode
(
void
)
const
{
return
(
GLenum
)
getParameterI
(
GL_TEXTURE_COMPARE_MODE
);
}
inline
GLenum
getCompareFunc
(
void
)
const
{
return
(
GLenum
)
getParameterI
(
GL_TEXTURE_COMPARE_FUNC
);
}
inline
GLuint
getObjectName
(
void
)
const
{
return
mObjectName
;
}
inline
GLenum
getTarget
(
void
)
const
{
return
mTarget
;
}
inline
GLsizei
getWidth
(
void
)
const
{
return
mWidth
;
}
inline
GLsizei
getHeight
(
void
)
const
{
return
mHeight
;
}
inline
GLsizei
getDepth
(
void
)
const
{
return
mDepth
;
}
inline
GLenum
getInternalFormat
(
void
)
const
{
return
mInternalFormat
;
}
inline
GLint
getMinFilter
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_MIN_FILTER
);
}
inline
GLint
getMagFilter
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_MAG_FILTER
);
}
inline
GLint
getBaseLevel
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_BASE_LEVEL
);
}
inline
GLint
getMaxLevel
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_MAX_LEVEL
);
}
inline
GLint
getMinLOD
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_MIN_LOD
);
}
inline
GLint
getMaxLOD
(
void
)
const
{
return
getParameterI
(
GL_TEXTURE_MAX_LOD
);
}
inline
GLfloat
getLODBias
(
void
)
const
{
return
getParameterF
(
GL_TEXTURE_LOD_BIAS
);
}
inline
GLenum
getCompareMode
(
void
)
const
{
return
(
GLenum
)
getParameterI
(
GL_TEXTURE_COMPARE_MODE
);
}
inline
GLenum
getCompareFunc
(
void
)
const
{
return
(
GLenum
)
getParameterI
(
GL_TEXTURE_COMPARE_FUNC
);
}
inline
glm
::
vec4
getBorderColor
(
void
)
const
{
return
getParameter4F
(
GL_TEXTURE_BORDER_COLOR
);
}
#ifndef ACGL_OPENGLES_VERSION_20
inline
GLenum
getWrapS
(
void
)
const
{
return
(
GLenum
)
getParameterI
(
GL_TEXTURE_WRAP_S
);
}
inline
GLenum
getWrapT
(
void
)
const
{
return
(
GLenum
)
getParameterI
(
GL_TEXTURE_WRAP_T
);
}
inline
GLenum
getWrapR
(
void
)
const
{
return
(
GLenum
)
getParameterI
(
GL_TEXTURE_WRAP_R
);
}
inline
GLenum
getWrapS
(
void
)
const
{
return
(
GLenum
)
getParameterI
(
GL_TEXTURE_WRAP_S
);
}
inline
GLenum
getWrapT
(
void
)
const
{
return
(
GLenum
)
getParameterI
(
GL_TEXTURE_WRAP_T
);
}
inline
GLenum
getWrapR
(
void
)
const
{
return
(
GLenum
)
getParameterI
(
GL_TEXTURE_WRAP_R
);
}
#endif // ACGL_OPENGLES_VERSION_20
inline
glm
::
uvec3
getSize
(
void
)
const
{
return
glm
::
uvec3
(
mWidth
,
mHeight
,
mDepth
);
}
inline
glm
::
uvec3
getSize
(
void
)
const
{
return
glm
::
uvec3
(
mWidth
,
mHeight
,
mDepth
);
}
// ===================================================================================================== \/
// ============================================================================================ WRAPPERS \/
...
...
@@ -179,6 +180,9 @@ public:
//! for usage of a texture with depth data
void
setCompareFunc
(
GLenum
_func
=
GL_LEQUAL
);
//! color that is sampled outside range if wrap is set to GL_CLAMP_TO_BORDER
void
setBorderColor
(
const
glm
::
vec4
&
_color
=
glm
::
vec4
(
0.0
));
//! _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
);
...
...
@@ -216,8 +220,9 @@ protected:
GLuint
bindAndGetOldTexture
()
const
;
// generic get parameter functions:
GLfloat
getParameterF
(
GLenum
_name
)
const
;
GLint
getParameterI
(
GLenum
_name
)
const
;
GLint
getParameterI
(
GLenum
_name
)
const
;
GLfloat
getParameterF
(
GLenum
_name
)
const
;
glm
::
vec4
getParameter4F
(
GLenum
_name
)
const
;
//! returns a format compatible with the internal, only used to
//! reserve memory, not to upload actual data!
...
...
src/ACGL/OpenGL/Objects/Texture.cc
View file @
415799cc
...
...
@@ -111,6 +111,13 @@ void TextureBase::setCompareFunc( GLenum _func )
glBindTexture
(
mTarget
,
prevTexture
);
}
void
TextureBase
::
setBorderColor
(
const
glm
::
vec4
&
_color
)
{
GLuint
prevTexture
=
bindAndGetOldTexture
();
glTexParameterfv
(
mTarget
,
GL_TEXTURE_BORDER_COLOR
,
(
GLfloat
*
)
&
_color
);
glBindTexture
(
mTarget
,
prevTexture
);
}
void
TextureBase
::
setAnisotropicFilter
(
GLfloat
_sampleCount
)
{
...
...
@@ -177,6 +184,16 @@ GLfloat TextureBase::getParameterF( GLenum _name ) const
return
param
;
}
glm
::
vec4
TextureBase
::
getParameter4F
(
GLenum
_name
)
const
{
GLuint
prevTexture
=
bindAndGetOldTexture
();
glm
::
vec4
param
;
glGetTexParameterfv
(
mTarget
,
_name
,
(
GLfloat
*
)
&
param
);
glBindTexture
(
mTarget
,
prevTexture
);
openGLRareError
();
return
param
;
}
GLuint
TextureBase
::
bindAndGetOldTexture
()
const
{
GLint
prevTexture
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment