Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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  
  Few questions about Slick  (Read 1571 times)
0 Members and 1 Guest are viewing this topic.
Offline nsigma
« Posted 2010-12-20 11:23:22 »

Hi,

Would have posted this on the Slick forums, but tried to register and it threw up an error that it couldn't connect to the mail server to send me the email. (actually wrote this yesterday but then JGO was unreachable - seems like everything I touch at the moment is breaking!  persecutioncomplex )

I've just started experimenting with Slick.  I'm thinking of using it as the starting point for a hardware accelerated video/image pipeline in my Praxis software.  However, I've got a few questions I wondered if anyone on here could offer some advice on.

* The current software pipeline uses premultiplied alpha for all transparent images.  As I need to have this software pipeline available as a fallback, I'd like to use images with premultiplied alpha in Slick.  This will make getting data in to (and occassionally out of) textures much easier.  I've also read various things that suggest blending is more accurate using premultiplied alpha, particularly for blending between transparent surfaces.  Has anyone done anything similar with Slick?  I'm thinking I'll need to subclass Image and create a wrapper to the Graphics that reimplements blend modes, color, etc.  I wondered if there are any pointers or gotchas I should be aware of doing this?

* The software pipeline has its data stored in int arrays as RGB or ARGB_PRE.  I'm new to this OpenGL lark, so I wondered what people would advise as the best performing way to get this data into a texture?  Currently for the ARGB data I've experimented with glTexSubImage2D, using a bytebuffer with little endian ordering, and pushing it up as BGRA.  This was mentioned on the Slick forum somewhere, but I wondered if this is the best way to do it?

* Am I right in thinking that textures on images need to be explicitly released, and they're not just released when the Texture object is unused or GC'd?  I was experimenting (rather naively) at first with setting a new texture to the image every frame, and it almost brought my computer to its knees.  Adding a line to release the texture before setting the new one at least seemed to stop things falling over.  However, there are various places in the Slick source code where the texture seems to be changed without releasing the old one.  Am I missing something?

Thanks in advance for all and any help, Neil

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline avm1979
« Reply #1 - Posted 2010-12-21 03:07:24 »

* Am I right in thinking that textures on images need to be explicitly released, and they're not just released when the Texture object is unused or GC'd?  I was experimenting (rather naively) at first with setting a new texture to the image every frame, and it almost brought my computer to its knees.  Adding a line to release the texture before setting the new one at least seemed to stop things falling over.  However, there are various places in the Slick source code where the texture seems to be changed without releasing the old one.  Am I missing something?

Yeah, you releasing a texture will clean up the texture object on the graphics card side.  However, what you'd usually do is load a bunch of Textures upfront, and then refer to them from various parts of your code.  I'm not sure exactly how Slick handles this, but you'll have something like TextureStore.getTexture(String id) which will return the same Texture object to different places you use it from.

So you shouldn't be creating/releasing Textures all that often - generally, once per each image you're using.  And so, releasing them all isn't necessary - since by the time you "should", you're exiting the program anyway.  It'd only be an issue if you're unloading/loading subsets of your Textures fairly often due to memory constraints - such as say specific textures for a level in a game.

I'm not sure what you mean by "setting a new texture to the image every frame" but that doesn't sound like something you'd want to be doing in the first place Smiley

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.

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

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

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

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

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

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

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23
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

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!