[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: The best way to draw pixels?




On Thu, 28 Oct 1999, Jamie wrote:
> 
> What I probably need is a good tutorial on gdk, but I havn't been able
> to find one...
>

A good tutorial is the "scribble" chapter in the GTK tutorial; a good
"advanced" text on it is the GDK chapter in my book, 
http://developer.gnome.org/doc/GGAD
 
> But, I don't have any idea how to do this, so does anyone have any idea?
> the color at the points i generate changes frequently, and the range of
> colors is anywhere in the color spectrum.
> 

This is asked a lot, and we have no FAQ entry yet, so I've created one:

<!-- ----------------------------------------------------------------- -->
<sect1>How do I render pixels (image data) to the screen?

<p> There are several ways to approach this. The simplest way is to use
GdkRGB, see gdk/gdkrgb.h. You create an RGB buffer, render to your RGB
buffer, then use GdkRGB routines to copy your RGB buffer to a drawing area
or custom widget. The book GTK+/Gnome Application Development gives some
details; GdkRGB is also documented in the GTK+ reference documentation.

<p> If you're writing a game or other graphics-intensive application, you
might consider a more elaborate solution. OpenGL is the graphics standard
that will let you access hardware accelaration in future versions of
XFree86; so for maximum speed, you probably want to use OpenGL. A
GtkGLArea widget is available for using OpenGL with GTK+ (but GtkGLArea
does not come with GTK+ itself). There are also several open source game
libraries, such as ClanLib and Loki's Simple DirectMedia Layer library
(SDL).

<p>You do NOT want to use <tt/gdk_draw_point()/, that will be extremely
slow.

Havoc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]