-
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?
-
Advanced Member
Frequent Contributor
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?
-
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~!
-
Advanced Member
Frequent Contributor
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
-
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
-
Forum Rules