Browse Source

gpu: use the RenderContext class in a few friendly places.

legacy
Sam Hocevar sam 12 years ago
parent
commit
b97cbbe27f
2 changed files with 8 additions and 6 deletions
  1. +4
    -4
      src/scene.cpp
  2. +4
    -2
      tutorial/08_fbo.cpp

+ 4
- 4
src/scene.cpp View File

@@ -191,15 +191,17 @@ Array<Light *> const &Scene::GetLights() const


void Scene::Render() // XXX: rename to Blit() void Scene::Render() // XXX: rename to Blit()
{ {
RenderContext rc;
rc.SetDepthTest(true);
rc.SetAlphaBlend(true);

#if defined USE_D3D9 || defined _XBOX #if defined USE_D3D9 || defined _XBOX
#else #else
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL); glDepthFunc(GL_LEQUAL);
#if defined HAVE_GL_2X && !defined __APPLE__ #if defined HAVE_GL_2X && !defined __APPLE__
glEnable(GL_ALPHA_TEST); glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GEQUAL, 0.01f); glAlphaFunc(GL_GEQUAL, 0.01f);
#endif #endif
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
#endif #endif


@@ -347,11 +349,9 @@ void Scene::Render() // XXX: rename to Blit()
#if defined USE_D3D9 || defined _XBOX #if defined USE_D3D9 || defined _XBOX
/* TODO */ /* TODO */
#else #else
glDisable(GL_DEPTH_TEST);
# if defined HAVE_GL_2X && !defined __APPLE__ # if defined HAVE_GL_2X && !defined __APPLE__
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
# endif # endif
glDisable(GL_BLEND);
#endif #endif
} }




+ 4
- 2
tutorial/08_fbo.cpp View File

@@ -83,9 +83,11 @@ public:
/* FIXME: this object never cleans up */ /* FIXME: this object never cleans up */
} }


m_fbo->Bind();
/* FIXME: we should just disable depth test in the shader */ /* FIXME: we should just disable depth test in the shader */
Video::Clear(ClearMask::Depth);
RenderContext rc;
rc.SetDepthTest(false);

m_fbo->Bind();
m_shader->Bind(); m_shader->Bind();


#if _XBOX #if _XBOX


Loading…
Cancel
Save