Commit bdf0e119 authored by zmoelnig's avatar zmoelnig
Browse files

fixed texCoords when texture is upside down;

LATER: unify this and make all textures upside-down


git-svn-id: https://pd-gem.svn.sourceforge.net/svnroot/pd-gem/trunk/Gem@2868 49b2a0ca-c541-4d49-a7ef-d785e4371512
parent a8810b1c
...@@ -207,17 +207,19 @@ void model :: buildList() ...@@ -207,17 +207,19 @@ void model :: buildList()
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
void model :: render(GemState *state) void model :: render(GemState *state)
{ {
int texcoordindex=(state->texUpsideDown)?1:2; if(state) {
if (state && (m_currentH != state->texCoordX(texcoordindex) || m_currentW != state->texCoordY(texcoordindex))) int texcoordindex=(state->texUpsideDown)?1:2;
{ if (m_currentH != state->texCoordX(texcoordindex) || m_currentW != state->texCoordY(texcoordindex))
m_rebuild=true; {
m_rebuild=true;
}
if(m_rebuild) {
m_currentH = state->texCoordX(texcoordindex);
m_currentW = state->texCoordY(texcoordindex);
glmTexture(m_model, m_textype, m_currentH, m_currentW);
buildList();
m_rebuild=false;
} }
if(m_rebuild) {
m_currentH = state->texCoordX(2);
m_currentW = state->texCoordY(2);
glmTexture(m_model, m_textype, m_currentH, m_currentW);
buildList();
m_rebuild=false;
} }
if (!m_dispList)return; if (!m_dispList)return;
glCallList(m_dispList); glCallList(m_dispList);
......
...@@ -271,15 +271,18 @@ void multimodel :: startRendering() ...@@ -271,15 +271,18 @@ void multimodel :: startRendering()
void multimodel :: render(GemState *state) void multimodel :: render(GemState *state)
{ {
if (!m_numModels || !m_loadedCache) return; if (!m_numModels || !m_loadedCache) return;
if (state && (m_currentH != state->texCoordX(2) || m_currentW != state->texCoordY(2))) int texcoordindex=(state->texUpsideDown)?1:2;
{ if(state) {
m_rebuild=true; if (m_currentH != state->texCoordX(texcoordindex) || m_currentW != state->texCoordY(texcoordindex))
{
m_rebuild=true;
}
if(m_rebuild) {
m_currentH = state->texCoordX(texcoordindex);
m_currentW = state->texCoordY(texcoordindex);
buildList();
m_rebuild=false;
} }
if(m_rebuild) {
m_currentH = state->texCoordX(2);
m_currentW = state->texCoordY(2);
buildList();
m_rebuild=false;
} }
if (!m_loadedCache->models[m_curModel])return; if (!m_loadedCache->models[m_curModel])return;
...@@ -355,4 +358,4 @@ void multimodel :: rescaleMessCallback(void *data, t_floatarg state) ...@@ -355,4 +358,4 @@ void multimodel :: rescaleMessCallback(void *data, t_floatarg state)
void multimodel :: textureMessCallback(void *data, t_floatarg state) void multimodel :: textureMessCallback(void *data, t_floatarg state)
{ {
GetMyClass(data)->textureMess((int)state); GetMyClass(data)->textureMess((int)state);
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment