Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (843)
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  
  LWJGL - Fade Textures into eachother  (Read 3059 times)
0 Members and 1 Guest are viewing this topic.
Offline Ikaron

Junior Newbie

« Posted 2012-11-11 18:10:27 »

Hello there, I'm new to this forum (But not too much to LWJGL Wink) and I was looking for a way to fade 2 textures into eachother. But no time based fade, more like a Quad, that has the one texture on the one side, and the other texture on the other side, and fades between those two. I tried using 2 quads that faded into nothing, but that made the other one that faded the other texture in the other direction disappear. I haven't found any other way, and don't find anything on the webs. Any ideas?
Thanks for your time.
Offline Sickan
« Reply #1 - Posted 2012-11-11 18:11:17 »

I would be very interested in something like this, too!

Cheers Cheesy
Offline Ikaron

Junior Newbie

« Reply #2 - Posted 2012-11-11 18:20:07 »

Well, I found a way by displacing the second quad just a tiny bit, that of course is a really dirty method, but seems to be the only way.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Danny02
« Reply #3 - Posted 2012-11-11 18:36:00 »

without shaders:
render a quad two times. The first one should be rendered just as always. but the second one is a bit more tricky, the quad needs vertex color attributes, where on one side it has an alpha of 1 and on the other 0. then you have to render the second quad with depth-testing to equal and alpha-blending enabled.

with shaders:
everything is easier^^. just create a shader who reads 2 textures and blend them together depending on a vertex attribute.

some simple blending I did some time ago, based on the idea found in this blog post
Offline Ikaron

Junior Newbie

« Reply #4 - Posted 2012-11-11 18:42:17 »

Thanks! I was missing the glDepthFunc(GL_EQUAL) call! Thank you really much Cheesy
Offline davedes
« Reply #5 - Posted 2012-11-11 19:54:06 »

Using shaders is very simple and much more flexible. Full code here.


Mask: (alpha)


Pages: [1]
  ignore  |  Print  

EgonOlsen (38 views)
2018-06-10 19:43:48

EgonOlsen (20 views)
2018-06-10 19:43:44

EgonOlsen (40 views)
2018-06-10 19:43:20

DesertCoockie (187 views)
2018-05-13 18:23:11

nelsongames (122 views)
2018-04-24 18:15:36

nelsongames (121 views)
2018-04-24 18:14:32

ivj94 (861 views)
2018-03-24 14:47:39

ivj94 (122 views)
2018-03-24 14:46:31

ivj94 (758 views)
2018-03-24 14:43:53

Solater (139 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!