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  
  Fastest way to do a software renderer  (Read 1994 times)
0 Members and 1 Guest are viewing this topic.
Offline kaffiene
« Posted 2010-06-30 00:53:58 »


I was playing with the idea of doing some real time ray tracing in Java.  I found that I could get 50fps for a smallish render size so I thought that interpolating the pixels to get a reasonably enlarged image would be a good idea.  Problem is that the setpixel stuff really hosed the frame rate.  I'd used the create compatible buffer approach to get something that I thought would be reasonably fast to write to.

My question is: with current technology, what's the optimal approach to software pixel pushing in Java?  Should I even be using BufferedImages?  Would I be able to get better performance from an OpenGL buffer, or maybe using SDL?

Anyone done anything like this before?
Offline moogie

JGO Ninja

Medals: 16
Projects: 6
Exp: 10 years

Java games rock!

« Reply #1 - Posted 2010-06-30 04:59:07 »

For my java realtime raytracter i directly manipuated the backing Int buffer of a RGB Buffered Image:

to get the backing buffer:

BufferedImage image = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
int[] imagePixelData = ((DataBufferInt) image.getRaster().getDataRasterBuffer()).getData();

to render a pixel:

imagePixelData[pixelY*width+pixelX]= (int) (*255) << 16 | (int) (*255) << 8 | (int) (*255 )

then just draw the image to a graphics object.

Java4k RIP 2014
Pages: [1]
  ignore  |  Print  

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

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

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

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

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

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

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

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

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

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