From: Maurizio Colucci To: lablgtk Subject: Loading a texture from file and applying it? Date: Wed, 18 Aug 2004 18:45:37 +0200 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200408181845.37672.seguso.forever at tin.it> Hello again, In lablgl + lablgtk, I need to load a texture from file and apply it to a triangle. More precisely: GlTex.image2d wants a byte array as a GlPix. I need to know how to create a GlPix from a png file (or similar). The GlPix should have rgba format, and the png file may not have alpha information. I read the example texturesurf.ml, but it creates the GlPix by hand: it creates a Pixmap with GLPix.create, then fills it by converting it to raw (GlPix.to_raw) and then uses Raw.sets to set the pixels. This seems a bit overkill. Of course I could parse the PNG by hand, then set the pixels with Raw.sets, but is there any easier way? Thanks Mau