Show Posts
|
|
Pages: [1]
|
|
2
|
Java Game APIs & Engines / Java 2D / VolatileImage usage
|
on: 2003-09-30 11:45:56
|
|
Fellas...
I've got a little video game and i was facing some speed issues in high resolutions so i thought: "why not?let's find out what this volatileImage stuff is all about"
The situation is the following: Container->Canvas BufferedImages drawing in Buffer (BufferedImage) and then the buffer is being drawn to the Graphics of the Canvas using Graphics2D's drawImage.
I knew nothing about VolatileImage so i started changing everything i saw from BufferedImage to VolatileImage using routines for validate() cases and contentsLost() (std procedure...) The Result? Disastrous...(fps down 3-4 frames)
OK i have understood the redundancy of using VolatileImages for the initial images but what about the final Buffer? I mean it's the image(array of bytes)that should stay in the VRAM...
So,I did it again with only the final buffer being Volatile but the results were the same.
Tell me: Do i have a really BIG misconseption about what a VolatileImage is and how to use it? Does the above structure has any potential of becoming any faster without any big changes (e.g BufferStrategy)?
I don't want so much a solution to my problem comparably to how badly i want to find out if i got straight VolatileImage.
|
|
|
|
|
3
|
Java Game APIs & Engines / Java 2D / fade effect with images
|
on: 2003-06-03 14:24:29
|
|
Guys, I'm trying to create a fade effect: An image is shown in a JPanel and i want another image to gradually paint over it while the (initial) image from behind is fading.
I tried to use AlphaComposite, it worked , but the outcome was really slow.
Another aproach was to get the alpha values of the images by using .getAlphaRaster() of the BufferedImage class and then setting each pixel of the above raster by using .setPixels().Unforunately (as you might have already guessed) that was also too slow. The image's dimension's are: 415x600.
Thank you for your time....
|
|
|
|
|
4
|
Java Game APIs & Engines / Java 2D / Re: Yet Another Image Question...
|
on: 2003-05-12 01:24:37
|
|
If i'm not mistaken (not a very possible scenario...) Toolkit.getDefaultToolkit().getImage() starts loading the image when you call graphics.drawImage(). So even if i draw it in a BufferedImage or a JComponent the procedure of loading is pretty much automated.
(love that wako guy... )
|
|
|
|
|
5
|
Java Game APIs & Engines / Java 2D / Yet Another Image Question...
|
on: 2003-05-11 22:10:03
|
|
Yes... I'm one of many java newbies who just can't seem to be able to load an image right.
So on to the Question: I was using Toolkit.getDefaultToolkit().getImage(...) to load an image until one day i discovered it had asynchronous loading and so the drawing of a 1024x768 image wasn't exactly a great spectacle.
I tried to slip past this little glitch by drawing the acquired image to a BufferedImage and the on to the graphics object... Darkness....The output was a (completely) black image.
But this could not daunt me (yet...). So i tried ImageIO.read(...). And yes ,the loading was synchronous. But the image had transparent spots (.gif) which were black...(using the previous method no such problem occured) .
I know i'm doing something wrong in both of these methods...so if it's obvious by the above storytelling ,tell me. If not, say which code segment i should post.
Thanks guys
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|