From 25a7afeeff7fabaf721cba732a1a3fb47b0b26cd Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 7 Oct 2012 12:36:08 +0000 Subject: Probe the maximal number of OpenGL lights. --- src/render/state.cc | 5 +++++ src/render/state.h | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/render/state.cc b/src/render/state.cc index 06156a1..5f026f0 100644 --- a/src/render/state.cc +++ b/src/render/state.cc @@ -22,6 +22,7 @@ float State::state_aspect = 0; bool State::state_has_generate_mipmaps = false; bool State::state_has_vbo = false; GLuint State::state_vbo = 0; +int State::state_maxlights; math::Color State::state_color_primary; @@ -95,6 +96,10 @@ void State::init(int width, int height) else con_print << "disabled" << std::endl; + // probe maximal number of lights + glGetIntegerv(GL_MAX_LIGHTS, &state_maxlights); + con_debug << " maximum number of OpenGL lights is " << state_maxlights << std::endl; + // Generate VBO if (state_has_vbo) gl::genbuffers(1, &state_vbo); diff --git a/src/render/state.h b/src/render/state.h index 2ba7c32..cda64d5 100644 --- a/src/render/state.h +++ b/src/render/state.h @@ -101,6 +101,9 @@ public: inline static GLuint vbo() { return state_vbo; } + inline static int max_lights() { + return state_maxlights; + } static void set_normalize(const bool enable=true); @@ -112,6 +115,7 @@ private: static bool state_has_generate_mipmaps; static bool state_has_vbo; static GLuint state_vbo; + static int state_maxlights; static math::Color state_color_primary; // current primary color static math::Color state_color_secondary; // current secondary color -- cgit v1.2.3