 |
GTK+ Forums Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
|
|
|
| Author |
Message |
|
|
HappyCat Familiar Face
Joined: 13 Aug 2007 Posts: 5
|
Posted: Mon Aug 13, 2007 5:57 pm Post subject: Pixel level drawing in GTK |
|
|
| Hi, I am trying to create a game for which I need fast, double-buffered, pixel level drawing. I am not sure how to do this. I have used SDL and creating a software SDL surface does what I need, but the only thing I could find for GTK was the GTK_SDL widget, which relies on a hack and is very unreliable (it doesn't work for me). SDL does not work because I need many windows and GUI components, and also I am not fond of the rest of SDL. Is there any widgets that I can use to draw individual pixels very fast? Ideally, I will just have a pointer to an array of pixel data, and the program can write to that as necessary (similar to SDL_Surface->pixles), and then when I am done, I can call a swap buffers function. Optionally, I would prefer something that can maintain a constant size pixel buffer that I can write to, but the rendered image will stretch to be the size of the window. This is not necessary, however. Is there any good way to do this? |
|
| Back to top |
|
 |
rotalever Familiar Face
Joined: 24 Feb 2007 Posts: 11
|
Posted: Fri Aug 17, 2007 7:01 pm Post subject: |
|
|
Fast rendering sound like hardware acceleration. You may want to use OpenGL which can also draw 2D-Images. If you do so, do not set pixels directly, that slows things down. Copy your sprites to OpenGL textures and you will get very good framerates. IMO this is the way to go.
GTK provides a widget which embeds OpenGL, but I dont know its name. |
|
| Back to top |
|
 |
caracal GTK+ Geek
Joined: 21 Jun 2007 Posts: 75 Location: Wilkes Barre Pa
|
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group CodeBB 1.0 Beta 2
|