Browse Source

Put HUD objects back on front of the scene.

legacy
Sam Hocevar sam 14 years ago
parent
commit
ad3128405a
3 changed files with 28 additions and 7 deletions
  1. +12
    -0
      src/ticker.cpp
  2. +15
    -7
      src/video.cpp
  3. +1
    -0
      src/video.h

+ 12
- 0
src/ticker.cpp View File

@@ -221,6 +221,17 @@ void Ticker::TickDraw()

/* Tick objects for the draw loop */
for (int i = Entity::DRAWGROUP_BEGIN; i < Entity::DRAWGROUP_END; i++)
{
switch (i)
{
case Entity::DRAWGROUP_HUD:
Video::SetDepth(false);
break;
default:
Video::SetDepth(true);
break;
}

for (Entity *e = data->list[i]; e; e = e->drawnext)
if (!e->destroy)
{
@@ -236,6 +247,7 @@ void Ticker::TickDraw()
e->state = Entity::STATE_IDLE;
#endif
}
}

Profiler::Stop(Profiler::STAT_TICK_DRAW);
Profiler::Start(Profiler::STAT_TICK_BLIT);


+ 15
- 7
src/video.cpp View File

@@ -36,13 +36,6 @@ void Video::Setup(int width, int height)
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0);

glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GEQUAL, 0.01f);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}

@@ -89,8 +82,23 @@ void Video::SetFov(float theta)
glLoadIdentity();
}

void Video::SetDepth(bool set)
{
if (set)
glEnable(GL_DEPTH_TEST);
else
glDisable(GL_DEPTH_TEST);
}

void Video::Clear()
{
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GEQUAL, 0.01f);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

SetFov(0.0f);


+ 1
- 0
src/video.h View File

@@ -19,6 +19,7 @@ class Video
public:
static void Setup(int width, int height);
static void SetFov(float theta);
static void SetDepth(bool set);
static void Clear();
static void Capture(uint32_t *buffer);
static int GetWidth();


Loading…
Cancel
Save