Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-05-21 12:56:05 +0400
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-05-21 12:56:05 +0400
commit22883f9232da3df2bcba995bb0d84d4cf95803e8 (patch)
treed8654ce7acacc9359fdd23f5966a4f4fa0b4b84b /source/gameengine/GamePlayer
parente78ef29a593857d87b0c35c211d082c8caa80f7b (diff)
Query GL for max number of lights to use.
Diffstat (limited to 'source/gameengine/GamePlayer')
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.cpp17
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.h1
2 files changed, 10 insertions, 8 deletions
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
index 3a7520861f9..79d769f7a1a 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
@@ -103,6 +103,9 @@
GPC_RenderTools::GPC_RenderTools()
{
m_font = BMF_GetFont(BMF_kHelvetica10);
+ glGetIntegerv(GL_MAX_LIGHTS, (GLint*) &m_numgllights);
+ if (m_numgllights < 8)
+ m_numgllights = 8;
}
@@ -326,16 +329,14 @@ int GPC_RenderTools::applyLights(int objectlayer)
vec[3]= 1.0;
- for(count=0; count<8; count++)
+ for(count=0; count<m_numgllights; count++)
glDisable((GLenum)(GL_LIGHT0+count));
- count= 0;
-
//std::vector<struct RAS_LightObject*> m_lights;
std::vector<struct RAS_LightObject*>::iterator lit = m_lights.begin();
- for (lit = m_lights.begin(); !(lit==m_lights.end()); ++lit)
+ for (lit = m_lights.begin(), count = 0; !(lit==m_lights.end()) && count < m_numgllights; ++lit)
{
RAS_LightObject* lightdata = (*lit);
if (lightdata->m_layer & objectlayer)
@@ -392,12 +393,10 @@ int GPC_RenderTools::applyLights(int objectlayer)
glLightfv((GLenum)(GL_LIGHT0+count), GL_DIFFUSE, vec);
glLightfv((GLenum)(GL_LIGHT0+count), GL_SPECULAR, vec);
glEnable((GLenum)(GL_LIGHT0+count));
+
+ count++;
glPopMatrix();
-
- count++;
- if(count>7)
- break;
}
}
@@ -511,3 +510,5 @@ void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,in
}
}
}
+
+unsigned int GPC_RenderTools::m_numgllights;
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.h b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
index c346003411c..3a878244e47 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.h
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
@@ -170,6 +170,7 @@ protected:
BMF_Font* m_font;
+ static unsigned int m_numgllights;
};
#endif // __GPC_RENDERTOOLS_H