Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
C-Fu
OpenGL
Commits
b4b2538e
Commit
b4b2538e
authored
Nov 08, 2016
by
Anakin
Browse files
fixed problem
parent
e5490b94
Changes
3
Hide whitespace changes
Inline
Side-by-side
MshViewer/Header/OpenGLController.h
View file @
b4b2538e
...
...
@@ -28,7 +28,7 @@ struct textureData {
bool
alpha
;
std
::
uint32_t
width
;
std
::
uint32_t
height
;
const
GLvoid
*
data
;
std
::
vector
<
std
::
uint8_t
>
*
data
;
};
class
OpenGLController
...
...
MshViewer/Source/OpenGlController.cpp
View file @
b4b2538e
...
...
@@ -46,6 +46,7 @@ OpenGLController::~OpenGLController()
{
textureData
*
cursor
=
vTextures
.
back
();
vTextures
.
pop_back
();
delete
cursor
->
data
;
delete
cursor
;
}
}
...
...
@@ -347,8 +348,7 @@ void OpenGLController::loadMsh(const char * path)
tempData
->
alpha
=
tempTex
.
hasAlpha
();
tempData
->
width
=
tempTex
.
getWidth
();
tempData
->
height
=
tempTex
.
getHeight
();
tempData
->
data
=
tempTex
.
getData
().
data
();
tempData
->
data
=
new
std
::
vector
<
std
::
uint8_t
>
(
tempTex
.
getData
());
}
catch
(
std
::
invalid_argument
e
)
{
...
...
@@ -356,7 +356,7 @@ void OpenGLController::loadMsh(const char * path)
tempData
->
alpha
=
true
;
tempData
->
width
=
1
;
tempData
->
height
=
1
;
tempData
->
data
=
(
const
GLvoid
*
)
solidColor
;
tempData
->
data
=
new
std
::
vector
<
std
::
uint8_t
>
({
0
,
0
,
255
,
255
})
;
}
vTextures
.
push_back
(
tempData
);
...
...
@@ -370,7 +370,7 @@ void OpenGLController::loadMsh(const char * path)
0
,
vTextures
.
front
()
->
alpha
?
GL_BGRA
:
GL_BGR
,
GL_UNSIGNED_BYTE
,
vTextures
.
front
()
->
data
vTextures
.
front
()
->
data
->
data
()
);
// set some texture parameters
...
...
@@ -380,6 +380,4 @@ void OpenGLController::loadMsh(const char * path)
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR_MIPMAP_LINEAR
);
glGenerateMipmap
(
GL_TEXTURE_2D
);
}
MshViewer/main.cpp
View file @
b4b2538e
...
...
@@ -20,7 +20,8 @@ int main(int argc, char** argv)
else
scene
=
OpenGLController
::
getInstance
();
scene
->
loadMsh
(
"..
\\
Release
\\
Msh
\\
multiModTex.msh"
);
//scene->loadMsh("..\\Release\\Msh\\multiModTex.msh");
scene
->
loadMsh
(
"..
\\
Release
\\
Msh
\\
cubeTex.msh"
);
do
{
scene
->
updateScene
();
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment