Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rwxr-xr-xsrc/ui/modelview.cc48
1 files changed, 9 insertions, 39 deletions
diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc
index 033e4e3..e3a3c79 100755
--- a/src/ui/modelview.cc
+++ b/src/ui/modelview.cc
@@ -19,7 +19,7 @@
namespace ui
{
-GLenum modelview_gllight = GL_LIGHT0 + 7;
+GLenum modelview_gllight = GL_LIGHT0;
ModelView::ModelView(Widget *parent) : Widget(parent)
{
@@ -204,25 +204,10 @@ void ModelView::draw_globe()
glEnableClientState(GL_NORMAL_ARRAY);
// we set up the light in camera space
- for (size_t i = 0; i < 8; i++) {
- // check if a light is available
- if (!glIsEnabled(GL_LIGHT0 + i)) {
- modelview_gllight = GL_LIGHT0 + i;
- break;
- }
- }
-
- GLfloat modelview_light[] = { -10.0f * reference_radius, 0, 0, 1.0f };
- GLfloat ambient_light[] = { 0.1f, 0.1f, 0.1f, 1.0f };
- GLfloat diffuse_light[] = { 0.75f, 0.75f, 0.75f, 1.0f };
- GLfloat specular_light[] = { 0.75f, 0.75f, 0.75f, 1.0f };
-
- glLightfv(modelview_gllight, GL_POSITION, modelview_light);
- glLightfv(modelview_gllight, GL_AMBIENT, ambient_light);
- glLightfv(modelview_gllight, GL_DIFFUSE, diffuse_light);
- glLightfv(modelview_gllight, GL_SPECULAR, specular_light);
-
- glLightf(modelview_gllight, GL_LINEAR_ATTENUATION, 0.05f);
+ float modelview_light_location[] = {-10.0f * reference_radius, 0, 0};
+ math::Color modelview_light_color;
+ modelview_light_color.assign(1.0);
+ modelview_gllight = render::create_light(modelview_light_location, 0.05f, modelview_light_color);
gl::enable(modelview_gllight);
@@ -319,25 +304,10 @@ void ModelView::draw_model()
glEnableClientState(GL_NORMAL_ARRAY);
// we set up the light in camera space
- for (size_t i = 0; i < 8; i++) {
- // check if a light is available
- if (!glIsEnabled(GL_LIGHT0 + i)) {
- modelview_gllight = GL_LIGHT0 + i;
- break;
- }
- }
-
- GLfloat modelview_light[] = { -10.0f * model->radius(), 0, 0, 1.0f };
- GLfloat ambient_light[] = { 0.1f, 0.1f, 0.1f, 1.0f };
- GLfloat diffuse_light[] = { 0.75f, 0.75f, 0.75f, 1.0f };
- GLfloat specular_light[] = { 0.75f, 0.75f, 0.75f, 1.0f };
-
- glLightfv(modelview_gllight, GL_POSITION, modelview_light);
- glLightfv(modelview_gllight, GL_AMBIENT, ambient_light);
- glLightfv(modelview_gllight, GL_DIFFUSE, diffuse_light);
- glLightfv(modelview_gllight, GL_SPECULAR, specular_light);
-
- glLightf(modelview_gllight, GL_LINEAR_ATTENUATION, 0.05f);
+ float modelview_light_location[] = {-10.0f * reference_radius, 0, 0};
+ math::Color modelview_light_color;
+ modelview_light_color.assign(1.0);
+ modelview_gllight = render::create_light(modelview_light_location, 0.05f, modelview_light_color);
gl::enable(modelview_gllight);