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 (844)
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  
  Need for Speed - image creation & rendering  (Read 2483 times)
0 Members and 1 Guest are viewing this topic.
Offline albright777

Junior Newbie

Java games rock!

« Posted 2003-01-29 17:30:12 »

   I need any advice to squeeze more performance out of my application.  My app receives a 2-d array of doubles, from which I need to create an image.  It receives a new array once every second.  This image is then continuously rendered (trying to maintain 30fps) to a JPanel, each frame scrolling down.  (i.e. to represent a top-down view of the ground scrolling by).
  I am currently converting the 2-d array of doubles to a 2-d array of int pixels, then create a BufferedImage (TYPE_INT_ARGB) and call setRGB with the int array.
  Then another thread is calling repaint() which scrolls the image at the desired fps.   From what I can gather from this forum is that I may not be getting accelerated images, and that would greatly increase the painting of the image each frame.    Is there a way to create an accelerated image from this int array (as opposed to loading it from a file)?

Any help is appreciated,

Offline rgeimer

Senior Newbie

« Reply #1 - Posted 2003-01-29 21:04:42 »

First off, try doing active rendering instead of calling repaint. You might want to take a look at using BufferStrategy as well, especially if this is a full screen app. Lastly, use Component.createImage() or GraphicsConfiguration.createCompatibleImage(), since these methods create buffered images that can be accelerated (also called "Automatic Images" by some of the folks on this board).
Offline erikd

JGO Ninja

Medals: 16
Projects: 4
Exp: 14 years


« Reply #2 - Posted 2003-01-30 07:19:28 »

Also, you might try to profile your app by using the -Xprof switch to make sure what the bottlenecks are.
Maybe the array of doubles and conversion to ints is expensive for example.


Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline albright777

Junior Newbie

Java games rock!

« Reply #3 - Posted 2003-02-10 12:40:00 »

Thanks for your help!  Once I switched to active rendering, and used VolatileImages, my framerate jumped to ~250 fps!  
  Thanks again, this forum is great, I wish I would have found it sooner.

Pages: [1]
  ignore  |  Print  

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

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

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

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

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

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

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

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

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

Solater (143 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!