Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
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 2641 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: 757
Projects: 4
Exp: 16 years


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
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!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 757
Projects: 4
Exp: 16 years


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
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: 757
Projects: 4
Exp: 16 years


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
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: 4


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

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


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.

 

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

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (26 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (13 views)
2014-07-29 10:59:34

E.R. Fleming (34 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (44 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!