Slick Forums

Discuss the Slick 2D Library
It is currently Sun Nov 19, 2017 2:50 am

All times are UTC




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sun Feb 19, 2012 12:55 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
The current add mode is kinda... broken. It's an add mode which ignores alpha and that is something we should change!
So I suggest adding a new mode called ADD_ALPHA like this:

Code:
if (currentDrawingMode == MODE_ADD_ALPHA) {
   GL.glEnable(SGL.GL_BLEND);
   GL.glColorMask(true, true, true, true);
   GL.glBlendFunc(SGL.GL_SRC_ALPHA, SGL.GL_ONE);
}


This way alpha can be uses for nice effects :)
We could also add the default OpenGL mode (GL11.GL_ONE, GL11.GL_ZERO). For non-alpha images or something. The would be REPLACE.

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Mon Feb 20, 2012 3:08 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
I've seen a few posts about the odd additive blending with alpha. Because so many people expext the alpha to be handled properly, I think replacing the blend mode implementation is reasonable. (I'm not an expert)

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
PostPosted: Mon Feb 20, 2012 3:12 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Yeah I thougt this too, but the problem is that this might break some games :/ Since the normal add effect is usable too imho.

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Tue Feb 21, 2012 8:02 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
I though the only difference was that the new code would support transparency in additive blending. Is this not so?

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
PostPosted: Wed Feb 22, 2012 1:38 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Yay, but what if you effects rlies on this effect? Where you render a alpha images normal, and for special effects with the ADD type ignoring alpha values? A test case should be added but I'm fully loaded with work :/ I will do it on weekend :)

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Sat Feb 25, 2012 5:36 pm 
Offline
User avatar

Joined: Tue May 03, 2011 7:45 pm
Posts: 13
Location: Poland, Cracow
Also, could we get a subtractive blend mode too? Basically you can do it using that new code for proper additive blend mode + that:
Code:
GL14.glBlendEquation(GL14.GL_FUNC_SUBTRACT);
GL14.glBlendEquation(GL14.GL_FUNC_REVERSE_SUBTRACT);


Top
 Profile  
 
PostPosted: Sat Feb 25, 2012 5:44 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Please post a solution using GL11 :) And I promise to implement it!
Or does Slick uses GL 14? Mh, this might be something to discuss in generel... We want to implement Shader too so... yeah.

Just a code in the style you can see in the setDrawMode method please :D

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Sun Feb 26, 2012 10:11 pm 
Offline
User avatar

Joined: Tue May 03, 2011 7:45 pm
Posts: 13
Location: Poland, Cracow
Why not use GL14? From Wikipedia (http://en.wikipedia.org/wiki/OpenGL):
Quote:
OpenGL 1.4
Released on July 24, 2002.
Supported Cards: Quadro DCC, Quadro4 380 XGL, Quadro4 500XGL, 550XGL, Quadro4 700XGL, 750XGL, 900XGL, 980XGL, and all later cards.


2002. That was 10 years ago. All the video cards that *can* run LWJGL should support OpenGL 1.4.

Also, stuff used by setDrawMode are actually aliases for GL11.blahblah, so you can use GL14.blahblah without any problems.


Top
 Profile  
 
PostPosted: Mon Feb 27, 2012 8:51 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Okay, then if I get the okay from the devs I do that. I implemented the ADD_ALPHA to the graphics mode and realized that the lwjgl jar was a 2.8.x Version but we use an old one so I changed it. Had no time to push it tho... Will do that if I get some free time again xD (darn work!)

Edit:
Btw you got the wrong idea. I KNOW what setDrawMode is doing, I asked for an implementation like it's done in the method ;) Or I misunderstood you^^

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Mon Feb 27, 2012 4:45 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Shockah wrote:
Why not use GL14? From Wikipedia (http://en.wikipedia.org/wiki/OpenGL):
Quote:
OpenGL 1.4
Released on July 24, 2002.
Supported Cards: Quadro DCC, Quadro4 380 XGL, Quadro4 500XGL, 550XGL, Quadro4 700XGL, 750XGL, 900XGL, 980XGL, and all later cards.


2002. That was 10 years ago. All the video cards that *can* run LWJGL should support OpenGL 1.4.

Also, stuff used by setDrawMode are actually aliases for GL11.blahblah, so you can use GL14.blahblah without any problems.

Slick's core (graphics, textures, fonts, etc) targets the lowest OpenGL version (GL 1.1). From there, it's up to the game developer to decide which OpenGL version to target and what extra features to include (e.g. FBOs, VBOs, shaders, what have you). If you need advanced GL14+ features, it's best to add them yourself.

If the same thing can be written using OpenGL 1.1 pipeline, then we could look into adding it.


Top
 Profile  
 
PostPosted: Mon Feb 27, 2012 4:50 pm 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
What's the LWJGL opinion here? I mean, if they already use a minimum version of GL 1.4 (for example), we could do the same.
Is there a statement somewhere? Or do they say the same: assume GL 1.1 and check for better features on your own?

_________________
Right Angle Games | Marte Engine
Back to the past | Star Cleaner | SpiderTrap


Top
 Profile  
 
PostPosted: Mon Feb 27, 2012 5:05 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
LWJGL doesn't rely on any OpenGL version; it simply wraps new features in their respective GLXX class. From there, it's up to the developer to decide which OpenGL version to target.

Slick has features that require greater versions of OpenGL (e.g. offscreen rendering), but for the most part it should work on OpenGL 1.1. Hell, if Ardor3D is working on GL1.2, then it would seem a bit daft that Slick, a simple 2D sprite library, would need higher requirements.


Top
 Profile  
 
PostPosted: Mon Feb 27, 2012 5:43 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Then I just need a blendfunc code snippet for the sub function to add :D

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Mon Feb 27, 2012 8:27 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
Quote:
Slick has features that require greater versions of OpenGL (e.g. offscreen rendering)


What version of OpenGL is required for off-screen rendering? If slick already uses a newer OpenGL for one of its features, it might as well allow itself to use that version for other features as well, right?

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
PostPosted: Mon Feb 27, 2012 9:27 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Mr. Kenkron wrote:
Quote:
Slick has features that require greater versions of OpenGL (e.g. offscreen rendering)


What version of OpenGL is required for off-screen rendering? If slick already uses a newer OpenGL for one of its features, it might as well allow itself to use that version for other features as well, right?

IMO, no.
(A) There is no simple "minimum OpenGL version" for offscreen rendering
(B) It's not a core requirement of Slick; you can make a 2D game without offscreen rendering

Slick uses two main strategies for offscreen rendering: FBOs or Pbuffers. Pbuffers are deprecated (replaced by FBO) in new versions of OpenGL. FBO did not become core until 3.0, although they have been around long before that (through EXT_framebuffer_object). FBOs are faster than Pbuffers since they don't require two context switches. Also, FBOs seem much more widespread than Pbuffers -- I can't even get Slick's Pbuffer to work on my iMac. (On that subject, could some people test it out by setting GraphicsFactory.setUseFBO to false and posting the results somewhere?)

Here's a pretty good chart for OpenGL versions on legacy Macs, for the sake of interest:
https://developer.apple.com/graphicsima ... abilities/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group