Depth test

Help
Anonymous
2004-09-07
2004-09-10
  • Anonymous - 2004-09-07

    Hello,
    first, i would like to say thanks for a Vincent library, i like this, great work.

    I'm writting game with Vincent library, it should be a Tron (lightcycles race) remake for PDA's.
    I have two problems.
    First is with depth testing i think. There is a link to latest build www.podvlivem.net/fogron.zip
    controls: left and right arrows + mouse + you can use other arrows like qweasd but in this build it affects scene horribly ;o)
    you can se when the yellow "motorcycle" is making walls behind it, the scene at the arena flickers, and whole wall looks unnaturally.
    the whole arena is box without top side (10 triangles) [model is stored in arena.ase] -> texture -> zem0.png.
    each part of red wall is made of two triangles (part from corner to corner) without texture, only it is rendered with red color.
    I don't know what i am doing wrong but when i disable depth buffer, the flickering disappears.

    2nd problem is when i'm rendering terrain first and after i'am rendering the "motorcycle", if i'am using in these situations mipmaps, the mapping looks like linear. But when i'm rendering first motorcycle and after terrain, it looks fine, the mipmapping is used.

    btw. you can see flickering beetween arena although motorcycle doesn't intersecting with arena.

    Thanks for any suggestions.

     
    • Hans-Martin Will

      I'll have a look at the code later. Just that I know: Is this code ported from desktop OpenGL, or are you writing this from scratch?

      Thanks,
      HM

       
    • Hans-Martin Will

      OK, I'm not getting to this today (demo preparation at work). What I would check is that both your projection settings as well as your depth range settings are consistent (glViewport, glDepthRange, glPerspective) and do not cause any over or underflow. Since this is all fixed point, you might have to play a bit with the settings.

      Let me know if you have problems tracking this down.

      - HM

       
    • Hans-Martin Will

      Also, is there any other library used? (For reading ASE or PNG)?

       
    • Hans-Martin Will

      And, one more: Do you see the same behavior on a real device (i.e. not using the emulator)?

       
    • Anonymous - 2004-09-08

      no, i'm writting it from scratch, i started with your test code in ogl-es distribution archive and completely rewrite it to something what i'm calling engine.

      ...and do not cause any over or underflow...

      i thnik this is my case, i'm using my own implementation of gluPerspective because i'm not able to do same job with glFrustum as with gluPerpective, i used
      gluPerspective(45.f,3.f/4.f,1.f,1000.f);
      and this possibly makes some overflow.

      now i tried
      gluPerspective(45.f,3.f/4.f,50.f,1000.f);
      and flickering disappears.

      i will try to find best range for my game.

      .....Also, is there any other library used? (For reading ASE or PNG)?.....
      no, i'm using just only gles_cl library (only your implemention), for png loading i'm using similiar code like you in your test example, and for real device i tried just only gif files, and it works correctly.

      ...And, one more: Do you see the same behavior on a real device (i.e. not using the emulator)?...

      I'm not using PocketPC emulator yet, because i were using Vincent version mostly with Desktop windows with Visual Studio 7.1 which is more friendly then emVC4, but from time to time i'm making binaries for PPC and testing the game on it. But now i don't have any real device at home, so i'm coding only on desktop, when i will have any chance to test it i will try (hence problem 2).

      ad Problem 2: i will try to explore my code but i don't know what i'm doing wrong, i have set up
          glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
          glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
          glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
          glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

      it is same with GL_NEAREST_MIPMAP_NEAREST,GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_NEAREST.

      i think i will render terrain as last object in scene. Maybe i'll try render more large objects and see what happens.

      Thank you. TL

       
    • Anonymous - 2004-09-08

      one more:
      i'm working with vincent 0.81

       
      • Hans-Martin Will

        I see. The reason I've been asking is that we've seen some problems with the math code out of the reference implementation when compiled for the x86. (In EGL_Power). Maybe there is a similar problem with EGL_Inverse. [I am doing all my validation on the device only]

        If you turn off mip mapping altogether how does it look then?

         
    • Hans-Martin Will

      One more: NEAREST_MIPMAP_NEAREST is the simplest case for mip mapping. Also, can you try setting mag filter to nearest? the magnification filter setting is ignored anyway right now, but just to make sure...

       
    • Hans-Martin Will

      One more: NEAREST_MIPMAP_NEAREST is the simplest case for mip mapping. Also, can you try setting mag filter to nearest? the magnification filter setting is ignored anyway right now, but just to make sure...

       
    • Anonymous - 2004-09-09

      i make some sreenshots, with naming convention
      mag_filter_min_filter_render_first_second.png,
      they are there http://www.podvlivem.net/test/
      At saturday I will have my pda back so i will test this mapping.
      I try all combinations of mipmapping but when the terrain is rendered first there is the same result.

      So i have new piece of knowledge,
      when i am rendering first terrain it is look always like on screenshots, but if i am rendering terrain as second object it looks like i am expecting instead of first rendered frame.
      in this first frame it looks like mipmapping is turned off, but i am sure it isn't. from this time it looks ok.

      P.S.: setting mag filter to GL_NEAREST doesn't bringing any visible change to rendered scene.

       
    • Anonymous - 2004-09-09

      i noticed one more thing.
      when i am rendering wall behind motorcycle and i want use some color per vertex (because wall has not texture), through GL_COLOR_ARRAY, it's working ok when i use GLfixed type array, but if i make array of GLubyte, and i try to render scene, the whole wall is everytime black. glGetError() returns 0.

      it is working for me in my different project for desktop opengl.

      do you think that i need to set up something, or it could be bug?
      Thanks TL

       
    • Hans-Martin Will

      I have
      mag_nearest_min_linear_render_moto_terrain.png
      and
      mag_nearest_min_linear_render_terrain_moto.png
      open next to each other in fireworks, and I fail to see the difference.

      Both of them show aliasing as you go towards infinity. Could it be that there simply aren't enough mipmap levels loaded? have you tried using auto mipmap generation?

      For color pointer: this is indeed a bug. The code treats byte color coordinates like byte texture coordinates (which makes them 255 * too large). I'll enter this into the bug database.

      - HM

       
    • Hans-Martin Will

      Scratch the previous one: I finally see what you mean. Is the moto without texture?

       
    • Hans-Martin Will

      OK, so the fastest way for you to help me finding the issue is if you set a breakpoint in Rasterizer::SetTexture.
      This should be called at the beginning of each sequence of rasterizations of similar primitives. As you can see, this is where the "m_UseMipmap" flag is determined.

      Do you see a difference between the two cases?

      - HM

       
    • Anonymous - 2004-09-10

      no, moto was with texture, but if i use moto without texture it looks ok in both cases.

      so i tried to log (Rasterizer::SetTexture) the behavior when both objects are textured (i am rendering now just moto and terrain, no walls)

      i upload these logs on
      http://www.podvlivem.net/test/

      the most important are two logs with prefix _,
      it is case when terrain is rendered first and the second is when moto is rendered first.

      my setup is
          glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
          glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
          glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
          glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

      if you will put it abreast, you can se that the m_UseMipmap is not the same in both logs.

      i hope it will helps.
      TL

       
    • Anonymous - 2004-09-10

      sorry, it was stupid idea, because when it si rendered in different order, it must be logged in defferent order. noe i am going to do it by your way.
      but i think one thing can be interesting ->
      there are strange numbers in
      m_RasterInfo.MaxMipmapLevel
      at the begining of the game.

       
    • Anonymous - 2004-09-10

      finally i start use my brain ;o)
      now i am logging each pass through Rasterizer::SetTexture as above, but in main program i am logging information about what object is rendered.

      the new logs are at
      http://www.podvlivem.net/test/new/

      you can see the difference.
      i think the first free passes are from time when i am loading bitmaps, is'n it?
      Then you can see, when i am rendering moto first, on motorcycle is used used mipmapping but at same frame it is not used on terrain, after first frame are mipmaps used on both objects.

      in second file (case when i am rendering terrain first and after i am rendering moto), you can see that the mipmappin is used only on motorcycle but never on terrain.

      TL

       
    • Anonymous - 2004-09-10

      sorry mistaky at line 8

      .......I think the first three passes are.......

      i mean the first three paragraphs in log file

       
    • Anonymous - 2004-09-10

      mistaky == mistake
      sorry, I am after lunch ;o)

       
    • Hans-Martin Will

      OK, so what I can see in the log is that in the case where m_UseMipmap is 0 there is also the line:

      m_Texture->GetMipmapFilterMode() 0

      and 0 represents mipmap off.

      I am not sure how you are setting up your textures, but the mipmap settings are part of the settings per texture, not global settings.

      Ideally you'd have a sequendce of

      glBindTexture(moto texture)
      load data
      do all the wrap and min, mipmap & mag settings

      glBindTexture(terain)
      load data
      do all the wrap and min, mipmap & mag settings

      ....

      game loop starts:
      no more texture mode settings here!

      glBindTexture(one of them)
      render object

      glBindTexture(the other)
      render object

      Does this apply in your case?

      - HM

       
    • Anonymous - 2004-09-10

      no, sorry I was thinking about setting TexParameter as about global setting, i move the setting code from program start to loading texture part and it is now working ok.
      Thanks a lot for your time, I should study specification more properly.

      Tomas

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks