Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  No transparenzy with GL_DEPTH_TEST  (Read 2240 times)
0 Members and 1 Guest are viewing this topic.
Offline Bananni

Senior Newbie




Belive the hype!


« Posted 2010-08-27 18:12:53 »

Hello,
I have a problem by non-displaying transparent regions of my textures.
After i used GL_DEPTH_TEST my transparent regions became black or the background color.
I read something about double rendering but i dont get it how it works corectly.
I tryed:
1  
2  
3  
4  
5  
6  
7  
8  
9  
glDephtFunc(GL_GREATER)
glDephtMask(false);

FIRST RENDERING

glDepthFunc(GL_LEQUAL);
glDepthMask(true);

SECOUND RENDERING

The result of that was that they are still overlapping each other.
Heres my actual result of my system:
(rendered 1 time with GL_LEQUAL and DepthMask true)

(the number shows u the order in that i rendered the objects)
My blending:
gl.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA);

It would be very welcomed if this method is the badder 1 of some easy methods.
I dont think that im able to split my polygons in smaller 1 so they dont overlap each other.

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 439
Projects: 4


Hand over your head.


« Reply #1 - Posted 2010-08-27 18:22:54 »

If you'd have a less offensive nickname, I'd have said you'd need glAlphaFunc(), but now I don't really feel like it.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Offline Bananni

Senior Newbie




Belive the hype!


« Reply #2 - Posted 2010-08-27 18:34:02 »

Thx i will try around with it.
(my nickname does not mean that i wanna kill u  persecutioncomplex)
i didnt modify the AlphaFunc so it should be GL_ALWAYS.
The textures have an alpha channel and they are transparent, but they delete some party of the other textures.
What i dont understand is why they always delete 1 texture and leave the rest in peace?

This picture shows the first rendered battler behind the secounds rendered, they dont erase some regions of each other, only if i put the first rendered in front of the secound rendered some parts of the secound rendered will be delete

Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 439
Projects: 4


Hand over your head.


« Reply #3 - Posted 2010-08-27 19:06:53 »

If you do not use glAlphaFunc, the depth value of transparent fragments (pixels) will be written to the depthbuffer.

Therefore you *must* depth-sort your triangles, when using transparency. Intersecting triangles can never be correctly depth-sorted.

If you use glAlphaFunc, fragments with a transparency below/above X will not be rendered, and not written to the depthbuffer, resulting in the 'transparent' parts to be cut off the sprite, which allows intersecting geometry.


Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Offline Bananni

Senior Newbie




Belive the hype!


« Reply #4 - Posted 2010-08-27 19:11:11 »

I dont realy get it :/
i used: glAlphaFunc(GL_EQUAL,1f);
but it didnt changed anything.

Edit: nvm, it was a result of my stupidity...
forgot to enable ALPHA_TEST.
Thx for ur help ^^
(Can i change my name or do i have to wait until i can change it?)

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 439
Projects: 4


Hand over your head.


« Reply #5 - Posted 2010-08-27 19:22:14 »

Just say the name you wish to have, I can change it for you.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Offline Bananni

Senior Newbie




Belive the hype!


« Reply #6 - Posted 2010-08-27 19:28:26 »

Bananni
that would be a nice name :3
thx  Smiley

Offline deepthought
« Reply #7 - Posted 2010-09-08 01:29:14 »

what was his name before?

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Offline bobjob

JGO Knight


Medals: 10
Projects: 6


David Aaron Muhar


« Reply #8 - Posted 2010-09-08 02:41:55 »

glAlphaFunc(GL_EQUAL,1f);
can sometimes be in accurate.
I find that using
glAlphaFunc(GL_GREATER, 0.99f);
more effective

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline Eli Delventhal
« League of Dukes »

JGO Kernel


Medals: 39
Projects: 12


Game Engineer


« Reply #9 - Posted 2010-09-08 02:43:21 »

Just say the name you wish to have, I can change it for you.
What's hilarious is that I can't do this.

No joke.

The permissions on this forum are very messed up.

See my work:
OTC Software
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (140 views)
2013-05-17 21:29:12

alaslipknot (149 views)
2013-05-16 21:24:48

gouessej (180 views)
2013-05-16 00:53:38

gouessej (173 views)
2013-05-16 00:17:58

theagentd (183 views)
2013-05-15 15:01:13

theagentd (168 views)
2013-05-15 15:00:54

StreetDoggy (212 views)
2013-05-14 15:56:26

kutucuk (236 views)
2013-05-12 17:10:36

kutucuk (235 views)
2013-05-12 15:36:09

UnluckyDevil (240 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.121 seconds with 21 queries.