Slick Forums

Discuss the Slick 2D Library
It is currently Fri Nov 17, 2017 7:08 pm

All times are UTC




Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sun Feb 19, 2012 9:54 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
davedes idea is the more "useable" way imho. I would prefer such a way where I have a staic method to create an offscreen image so I can use this an replace the reference of the normal graphic context of slick (or ist this possible already? For post processing?).
I would suggest implementing it (you have access to teh repo or not?) and testing it. It adresses the problem and gives an easy way to work with offscreen images :)

_________________
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 4:16 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
I have no repo access. I'll write up a test case tomorrow.


Top
 Profile  
 
PostPosted: Mon Feb 27, 2012 9:44 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Mh then Kev should give you access! Or Tommy :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 4:47 pm 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
R.D. wrote:
Mh then Kev should give you access! Or Tommy :D


Haha, I read that!

davedes, if you're interested in becoming a bitbucket dev member, I or Kev could do that :wink: Just tell me your bitbucket user name and I would gladly add you. Your support is way too awesome to get lost 8)

Cheers,
Tommy

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


Top
 Profile  
 
PostPosted: Wed Feb 29, 2012 6:14 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Registered at bitbucket -- username davedes.


Top
 Profile  
 
PostPosted: Thu Mar 01, 2012 1:40 pm 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
davedes, you're now registered as a Slick developer on bitbucket - welcome on board! :D

Don't forget to use the development branch for changes - see the sticky topic in the development forum.

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


Top
 Profile  
 
PostPosted: Thu Mar 01, 2012 4:32 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
Welcome davedes!

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


Top
 Profile  
 
PostPosted: Sun Mar 04, 2012 10:18 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Made some changes to Image and textures in the dev branch:
Code:
- (width, height, filter) constructor now uses EmptyImageData to minimize clutter
- draw/drawSheared/drawEmbedded now all check for init() before rendering
- startUse/endUse now rely on Texture instead of Image (because multiple Images may share the same texture)
- setting a new texture with Image.setTexture reverts the 'destroyed' flag to false
    - perhaps a future update should fix this further by moving the isDestroyed stuff to Texture (i.e. if texID == 0, then it must be destroyed)
- added createOffscreenGraphics method and fixed FBO/PBuffer/PBufferUnique
- fixed center of rotation problems as described in this thread http://slick.javaunlimited.net/viewtopic.php?f=1&t=4252
- InternalTextureLoader now has a method getTextureCount, which returns the number of active textures


Top
 Profile  
 
PostPosted: Fri Mar 09, 2012 7:19 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Added the following:

Image.drawEmbedded(x, y, width, height, rotation)
- This applies a rotation transform to the vertices, allowing them to be rotated "in use"
- I decided not to use getRotation since drawEmbedded doesn't already do that; besides, drawEmbedded should act like drawing a sub image (i.e. a "fresh" image). However, getCenterOfRotationX/Y is used here.

SpriteSheet.renderInUse(x, y, width, height, sx, sy)
SpriteSheet.renderInUse(x, y, width, height, rotation, sx, sy)
SpriteSheet.renderInUse(x, y, rotation, sx, sy)

RenderInUseTest
- shows off this stuff


Top
 Profile  
 
PostPosted: Fri May 11, 2012 6:32 am 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
I've been using FBOs in my own library for a while now and have not run into any problems with textures that weren't "just created." Nor have I run into any documentation about that issue in drivers. So I'm not sure what kev's commenting was on about.

In this case, I think we might be able to get rid of the ugly static method "createOffscreenImage" at the expense of changing (IMO, improving) a few things:
- Overload constructors in FBOGraphics/PBufferGraphics with a Texture parameter. That way an image that's been kicking around for a while will just be attached to an FBO, rather than having to create a new texture for that image (which is the root of this whole memory leak).
- By this logic, a single texture can only be bound to a single FBO. This means we might need to change Texture a little...
- This also means that shallow copies like getSubImage will have different behaviour. They share the same Texture object as their parent regardless of getGraphics(), and therefore any changes to the FBO graphics will be reflected in shallow copies. IMO this should have been how it works from the beginning.
- We can deprecate GraphicsFactory since it will be useless. The class was pretty ugly anyways, and we can move the capability checks to public static methods so users can handle it more eaisly.
- This "decouples" FBO/Pbuffer from Image, i.e. enabling us to expose those utilities to Slick users keen for more flexibility

May break old code if people are implementing Texture directly. I'll think about it for a while... Weigh in your thoughts.


Top
 Profile  
 
PostPosted: Fri May 11, 2012 8:40 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Imho, we can't always go like this : "Oh no this would break old Applications". I said that too but REAL work showed me that this is happening all the time. So if it eventually makes the code better and increases Performance, I don't see why we shouldn't do it.
If old users a fine with the old way they don't need to update to the newiest Slick2D version.

So yeah, do it. I have some time no too. That said I would like to do some "Canvas Resizing"-Stuff. The old API uses a JFrame but LWJGL has there own functions for that which are probalty better. Dunno if I can make this work but we will see :)

_________________
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 Jul 17, 2012 11:48 am 
Offline

Joined: Sat Jun 23, 2012 4:14 pm
Posts: 74
Location: Germany
R.D. wrote:
Imho, we can't always go like this : "Oh no this would break old Applications". I said that too but REAL work showed me that this is happening all the time. So if it eventually makes the code better and increases Performance, I don't see why we shouldn't do it.
If old users a fine with the old way they don't need to update to the newiest Slick2D version.

I absolutely agree on this. Backward compatibility is really harmful for making clean, elegant and efficient code.


Top
 Profile  
 
PostPosted: Thu Jul 19, 2012 8:44 am 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
There shouldn't be a problem if we keep old versions of Slick available for download. So in case a game requires a old version of Slick, you can use the old version. Or you got for newer versions with the requirement to update a few things here and there.

Are there that many that update the libraries of a application without even recompiling the applications? Can't imagine that this is a wise thing to do anyway.
I'd rather have a nicely written and very fast working Slick then... a backwards compatible Slick. But I expressed this attitude a few times already. :wink:

Sure some changes will break the examples on this board or in the wiki... but thats the price of progress in my opinion. The wiki can be updated and the remaining old examples are, as the name says, old.

Nitram

_________________
http://illarion.org


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

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