Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: a texture(early created)cover another texture(new)

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2012
    Posts
    8

    a texture(early created)cover another texture(new)

    Hi , big ones~ ,I 'm back,The game I wrote (a tank shoot planes) now has get all texture rendered correctly. Thanks~
    And I get a new question : For shoot , I create a class names Collimator . I render it the time the game begin,and then create many planes.
    So.. When I move the Collimator to the plane which I want to shoot,
    the plane covers my collimator! Because as far as I know , the texture late created will cover the texture early created...
    I just want to know how to set a texture shows that will never be covered?

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    723

    Re: a texture(early created)cover another texture(new)

    You will have to start using the depth buffer if you don't want to sort the objects from back to front.

    Have you used a depth buffer before?

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2012
    Posts
    8

    Re: a texture(early created)cover another texture(new)

    Do you mean:
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);

    I has already set .
    But I don't quite understand how these make my textures render.
    Can you give more information? Thanks~!

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    723

    Re: a texture(early created)cover another texture(new)

    You need a z value on each vertex. If you are looking down the negative-z axis (which probably you are in a 2D render). An object drawn with say z = -1 will always cover and object drawn with z = -2 no matter the draw order

  5. #5
    Junior Member Newbie
    Join Date
    Mar 2012
    Posts
    8

    Re: a texture(early created)cover another texture(new)

    Thanks for your help ~! I got it !
    Now I know the z axis can move texture deep or out of the screen~ so the texture can cover them correctly~!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •