Click to See Complete Forum and Search --> : Drawing methods


MethodicalJ
09-07-2004, 12:42 PM
Hey guys (and beautiful nerd girls), got a question.

I'm making a 3d space-sim engine, all from scratch. I render to my own RGB image format, then move it to an MIT-SHM shared memory image. While this method works hundreds of times faster than using standard xlib pixmaps and such, it is still eating up half of my clock time:

normal rendering (rendering to my image and then translating to pixel codes, then to the SHM image, then to the screen) gets about 25 fps.

doing all the rendering but not actually sending it to the shm imaage before the next frame doubles my framerate.

so I need to find the fastest way to put data on the screen. If anyone knows about full screen modes, writing to the framebuffer, or anything, I could really use pointers to some documentation or libraries.

By the way this game is incredibly cool. I attached a tar file for your pleasure. Check the readme for compile instructions.

JohnT
09-07-2004, 03:59 PM
Sorry cant help with what your looking for, but your right it is a cool game...even in its current incarnation. :D

bwkaz
09-07-2004, 06:49 PM
You might be able to use OpenGL to do it. Basically the method consists of creating one large OpenGL polygon parallel to the screen surface (perpendicular to the view vector), the size of the screen. Then you set that polygon's texture to be your "framebuffer". Then changes to the framebuffer get moved onto the screen using some kind of accelerated bitblt type of operation.

That doesn't save nearly as much CPU time as using OpenGL to actually do transformations and such, but it might help a bit (depending on the OpenGL status of the target machine).

You might also be able to make the stars OpenGL points (or small spheres), and let OpenGL render your universe for you. That actually might work even better (then you'd forget about the single large polygon parallel to the screen, you'd just have OpenGL render the stars and whatnot to the viewport like it normally does).

MethodicalJ
09-12-2004, 03:44 AM
Hey, I finally bothered to learn openGL, now I've got actual spheres and stuff. It doesn't look as sharp yet, but now planets and stars are more than just 2d circles. I think I'm gonna use a particle system to draw the stars when they're far away, because right now they flicker. What is the best way to do that? By the way, I'll post the new OpenGL source later tomorrow. It's looking cool.

MethodicalJ
09-13-2004, 12:23 PM
Here it is: