nRo

Members
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

126 Neutral

About nRo

  • Rank
    Newbie
  1. It is working now. I forgot to enable writing to the depth buffer while clean it. And I had to enable GL_ALPHA_TEST to get the transparency of the textures while filling the depth buffer. [CODE] gl.glEnable ( GL2.GL_ALPHA_TEST ) ; gl.glAlphaFunc ( GL.GL_GREATER, 0.1f) ; [/CODE] [url="http://www.youtube.com/watch?v=I0YiAlsUk7Q"]http://www.youtube.com/watch?v=I0YiAlsUk7Q[/url]
  2. Hi all! I am trying to implement a lighting-shadow engine in my litte 2d java game. I followed this tutorial. [url="http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/dynamic-2d-soft-shadows-r2032"]http://www.gamedev.n...t-shadows-r2032[/url] In contrary to the tutorial, I am using textures for my entites. All my Z-values (Lights,Background and Entities) are 0. [source lang="java"]function render(): clearZBuffer() fillZBuffer() foreach(light in lights) clearAlpha() glEnable(GL.GL_DEPTH_TEST); glDisable(GL.GL_BLEND); glColorMask(false, false, false, true); renderLightAlpha(light); glEnable(GL.GL_BLEND); glBlendFunc(GL.GL_ZERO, GL.GL_ONE_MINUS_SRC_ALPHA); renderShadows(light); glDisable(GL.GL_DEPTH_TEST); glEnable(GL.GL_DEPTH_TEST); glColorMask(true, true, true, false); renderBackgroundTexture(); if (light.DrawSource()) { renderLightSource(light); } renderEntities(); glDisable(GL.GL_DEPTH_TEST); glDisable(GL.GL_BLEND); function clearZBuffer() glClearDepth(1); glClearColor(0, 0, 0, 0); glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT|GL.GL_STENCIL_BUFFER_BIT); function fillZBuffer() glEnable(GL.GL_DEPTH_TEST); glDepthMask(true); glColorMask(false, false, false, false); renderBackgroundTexture(); renderEntities(); glDepthMask(false); glDisable(GL.GL_DEPTH_TEST); function clearAlpha() glColorMask(false, false, false, true); glClear(GL.GL_COLOR_BUFFER_BIT); [/source] here is a picture of my output: [url="http://imageshack.us/photo/my-images/39/unbenannt3yw.jpg/"][img]http://img39.imageshack.us/img39/9186/unbenannt3yw.th.jpg[/img][/url] My Problem is, that the entity textures are not rendered correctly. It seems like black parts are not at all. It works when I enable colorwriting in the fillZBuffer function: [url="http://imageshack.us/photo/my-images/818/test1pv.jpg/"][img]http://img818.imageshack.us/img818/5333/test1pv.th.jpg[/img][/url] Does anyone know how I can get the textures fully drawn without enabling colorwriting while filling the zBuffer?