[GtkGLExt] glDrawPixels
- From: Chris Le Sueur <thefishface gmail com>
- To: "gtkglext-list gnome org" <gtkglext-list gnome org>
- Subject: [GtkGLExt] glDrawPixels
- Date: Wed, 16 Nov 2005 22:01:23 +0000
Hi, I'm trying to use glDrawPixels and am having trouble getting data
from my Pixmap. Here's the code that I'm currently using:
pixmap = gtk.gdk.Pixmap(widget.window, tw, th)
pixmap.draw_layout(widget.get_style().black_gc,
0, 0, self.pangolayout)
pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, tw, th)
pixels = pixbuf.get_from_drawable(pixmap, pixmap.get_colormap(),
0, 0, 0, 0, tw, th).get_pixels()
glDrawPixels(tw, th, GL_RGB, GL_INT, pixels)
Now, the spec says that pixels for glDrawPixels should be a pointer to
the pixels, hence it requires the format those pixels are in. What
should I be passing in the context of gtk pixmap? This code segfaults,
presumably because it's trying to use a pointer, but I'm not sure.
Perhaps glDrawPixels simply won't work in python, in which case, let me
explain what I'm trying to do.
I have several objects which require information about them to be
displayed nearby, such as name/description/whatever. If I can't use
glDrawPixels, how do I go about using some other function to draw a gtk
Pixmap next to an object in 3D space? Essentially I need to find the
location of the object in terms of 2D coordinates and draw something
there.
There are few 'boundary' conditions that need to be taken into account -
the text needs to clip nicely as it goes of screen, and must preferably
not be displayed if it is occluded by some other object.
Thanks in advance, hope you can help.
--
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]