I did something like this:
img:TPixmap=LoadPixmap("incbin::ball.png") 'load the pixmap from the inbin'd image file
wid=img.width 'get width of pixmap
hig=img.height 'get height of pixmap
If img.format<>PF_RGBA8888 Then img=ConvertPixmap( img,PF_RGBA8888 ) 'Make sure image format is in the format needed for OpenGL to render it properly
Local psource:Byte Ptr 'define pointer for source pixmap data location
psource=PixmapPixelPtr(img,0,0) 'get source pixmap data location
Global psize:Int=wid*hig*4 '4 bytes per pixel assuming RGBA8888 format pixmap
txtri:TImage=CreateImage(wid,hig,1,iflags|DYNAMICIMAGE) 'create dummy image in case we want to do realtime conversion between pixmaps and images/textures
txtrp:TPixmap=LockImage(txtri,0,False,True) 'Lock our dummy image so we can draw to it
pdest=PixmapPixelPtr(txtrp,0,0) 'Set our destination pointer to the image's pixmap
MemCopy(pdest,psource,psize) 'Copy the pixels from the pixmap in memory to the image/texture's pixmap
UnlockImage(txtri) 'Let the image be rendered now
DrawImage txtri,objpos[o,0],objpos[o,1] 'Render the image/texture
|