read msh in,
handle non UVed msh, next test UVed msh + dynamical switch between UVed/not UVed
This commit is contained in:
@@ -285,9 +285,7 @@ void OpenGLController::loadMsh(const char * path)
|
||||
{
|
||||
Object obj(path);
|
||||
vfVertices = obj.getVertex();
|
||||
|
||||
vfUV = loadUV();
|
||||
//vfUV = obj.getUV();
|
||||
vfUV = obj.getUV();
|
||||
}
|
||||
catch (std::invalid_argument e)
|
||||
{
|
||||
@@ -295,13 +293,16 @@ void OpenGLController::loadMsh(const char * path)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//vfVertices = loadData();
|
||||
//vfUV = loadUV();
|
||||
|
||||
glGenTextures(1, &gluiTextureID);
|
||||
glBindTexture(GL_TEXTURE_2D, gluiTextureID);
|
||||
TextureTGA tempTex(TEXTURE_NAME);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, tempTex.hasAlpha() ? GL_RGBA : GL_RGB, tempTex.getWidth(), tempTex.getHeight(), 0, tempTex.hasAlpha() ? GL_BGRA : GL_BGR, GL_UNSIGNED_BYTE, tempTex.getData().data());
|
||||
|
||||
// if texture && open ok, then
|
||||
//TextureTGA tempTex(TEXTURE_NAME);
|
||||
//glTexImage2D(GL_TEXTURE_2D, 0, tempTex.hasAlpha() ? GL_RGBA : GL_RGB, tempTex.getWidth(), tempTex.getHeight(), 0, tempTex.hasAlpha() ? GL_BGRA : GL_BGR, GL_UNSIGNED_BYTE, tempTex.getData().data());
|
||||
// else
|
||||
GLubyte solidColor[4] = { 255,0,0,255 };
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA ,1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid*)solidColor);
|
||||
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
@@ -324,4 +325,5 @@ void OpenGLController::loadMsh(const char * path)
|
||||
vfUV.data(),
|
||||
GL_STATIC_DRAW
|
||||
);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user