Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
e6ee447f
Commit
e6ee447f
authored
May 28, 2012
by
Robert Menzel
Browse files
added support for user defined internal format at image file loader
parent
87c69437
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/ACGL/OpenGL/Controller/TextureControlFile.hh
View file @
e6ee447f
...
...
@@ -33,7 +33,8 @@ public:
mAnisotropicFilter
(
0.0
f
),
mWrapS
(
0
),
mWrapT
(
0
),
mWrapR
(
0
)
mWrapR
(
0
),
mInternalFormat
(
GL_INVALID_ENUM
)
{}
virtual
~
TextureControlFile
(
void
)
{}
...
...
@@ -44,6 +45,7 @@ public:
inline
TextureControlFile
&
minFilter
(
GLint
_minFilter
)
{
mMinFilter
=
_minFilter
;
return
*
this
;
}
inline
TextureControlFile
&
magFilter
(
GLint
_magFilter
)
{
mMagFilter
=
_magFilter
;
return
*
this
;
}
inline
TextureControlFile
&
anisotropicFilter
(
GLfloat
_anisotropicFilter
)
{
mAnisotropicFilter
=
_anisotropicFilter
;
return
*
this
;
}
inline
TextureControlFile
&
internalFormat
(
GLenum
_internalFormat
)
{
mInternalFormat
=
_internalFormat
;
}
inline
TextureControlFile
&
wrap
(
GLenum
_wrapS
,
GLenum
_wrapT
=
0
,
GLenum
_wrapR
=
0
)
{
...
...
@@ -74,6 +76,7 @@ protected:
GLenum
mWrapS
;
GLenum
mWrapT
;
GLenum
mWrapR
;
GLenum
mInternalFormat
;
};
}
// OpenGL
...
...
src/ACGL/OpenGL/Controller/TextureControlFile.cc
View file @
e6ee447f
...
...
@@ -16,7 +16,8 @@ TextureControlFile::TextureControlFile(const std::string& _filename)
mAnisotropicFilter
(
0.0
f
),
mWrapS
(
0
),
mWrapT
(
0
),
mWrapR
(
0
)
mWrapR
(
0
),
mInternalFormat
(
GL_INVALID_ENUM
)
{
if
(
!
mDataController
)
ACGL
::
Utils
::
error
()
<<
"No valid texture controller to load the image. Perhaps there is no loader for that file extension: "
<<
_filename
<<
std
::
endl
;
...
...
@@ -30,7 +31,8 @@ TextureControlFile::TextureControlFile(const char* _filename)
mAnisotropicFilter
(
0.0
f
),
mWrapS
(
0
),
mWrapT
(
0
),
mWrapR
(
0
)
mWrapR
(
0
),
mInternalFormat
(
GL_INVALID_ENUM
)
{
if
(
!
mDataController
)
ACGL
::
Utils
::
error
()
<<
"No valid texture controller to load the image. Perhaps there is no loader for that file extension: "
<<
_filename
<<
std
::
endl
;
...
...
@@ -47,11 +49,18 @@ bool TextureControlFile::load(SharedTexture& texture)
return
false
;
texture
->
bind
();
GLenum
internalFormat
;
if
(
mInternalFormat
==
GL_INVALID_ENUM
)
{
internalFormat
=
tempData
->
getFormat
();
}
else
{
internalFormat
=
mInternalFormat
;
}
texture
->
setImageData2D
(
tempData
->
getData
(),
tempData
->
getWidth
(),
tempData
->
getHeight
(),
tempData
->
get
Format
()
,
internal
Format
,
tempData
->
getFormat
(),
tempData
->
getType
());
texture
->
generateMipmaps
();
...
...
Write
Preview
Supports
Markdown
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