GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Oct 30, 2014 5:31 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Pixel level drawing in GTK
PostPosted: Mon Aug 13, 2007 5:57 pm 
Offline
Familiar Face

Joined: Mon Aug 13, 2007 5:42 pm
Posts: 5
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?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 7:01 pm 
Offline
Familiar Face

Joined: Sat Feb 24, 2007 11:40 am
Posts: 9
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 11, 2007 12:09 pm 
Offline
GTK+ Guru

Joined: Thu Jun 21, 2007 1:52 pm
Posts: 198
Location: Wilkes Barre Pa
Its called GtkGLExt - an OpenGL extension to GTK 2.0 or later.
But there are other things you can do such as embedding a sdl window in a gtk window
or you can also use opengl in sdl and then embed sdl in a gtk window.
using gtk plug & socket.

Or you could use irrlich and wxgtk
http://irrlicht.sourceforge.net/phpBB2/ ... ight=wxgtk

here is a free linux game programming pdf book
http://www.losersjuegos.com.ar/referenc ... s-time.pdf

There are a bunch of other ways also.

GTK_SDL is for gtk1 not gtk2


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group