Re: [GtkGLExt] textures



glTexImage2D expects texture data to be handed it in an array. The parameters to glTexImage2D describe how the image data is packed in the array. For example you could use 8 bit integers in red, green, blue order. So the first pixel will be described by the first three elements of the array, first the red component, then the green component, finally the blue component.

I don't readily see how to take the image data loaded via a gtk library call, and get it's RGB components to place into an array. For my application I don't need to load from a file, so it isn't a problem. I store my image data in an array in RGB format anyway.

You might want to look into the imlib2 library. It can be used to load and save image data, I think it will allow you to extract the RGB component data also.

flood wrote:
Hello, how can I load a simple texture to use use in opengl? Can I use the
function gtk_image_new_from_file? If so eactly what parameters do I pass for
the function glTexImage2D?

--
~flood



------------------------------------------------------------------------

_______________________________________________
gtkglext-list mailing list
gtkglext-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkglext-list



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