Thanks Col!
Here's my progress so far:
And as you'll see with using your own images with the example, that the colours are still a tad wrong.
Big Thanks,
THUMBZ
Here's my progress so far:
' ' OPENGL 2D Drawing Test Example ' Const XRES=640 Const YRES=480 bglCreateContext(XRES,YRES,32,0,BGL_BACKBUFFER|BGL_DEPTHBUFFER|BGL_FULLSCREEN) ' ' setup OpenGL for 2D Drawing ' glMatrixMode (GL_PROJECTION) glLoadIdentity () gluOrtho2D (0, XRES, YRES, 0) glMatrixMode (GL_MODELVIEW) glLoadIdentity () glDisable (GL_DEPTH_TEST) 'you may want to disable depth testing so 'you can define the render order exactly ' 'Image Properties ' Global Locked:TPixmap Global Image=LoadImage("../media/Image.Bmp",DynamicImage) Global IW=ImageWidth(Image) Global IH=ImageHeight(Image) Global ImageData#[IW,IH,4] create2DImage() ' ' the main loop ' While Not KeyHit(KEY_ESCAPE) Draw2D() bglSwapBuffers Wend Function Draw2D() glBegin (GL_Points) For Local y= 0 To IH-1 For Local x=0 To IW-1 glcolor3f( ImageData[x,y,1] , ImageData[x,y,2], ImageData[x,y,3] ) glVertex2f (x, y ) Next Next glEnd() End Function Function Create2DImage() Locked=LockImage(Image) For Local y=0 To IH-1 For Local x=0 To IW-1 Local RGB=ReadPixel(Locked,x,y) ' ' convert to 0-255 colours ' Local Red=(RGB Shr 16) & 255 Local Grn=(RGB Shr 8) & 255 Local Blu=(RGB Shr 0) & 255 ' ' convert to OpenGL values ' Local Red2#= 1.0 / (255.0 * Red) Local Grn2#= 1.0 / (255.0 * Grn) Local Blu2#= 1.0 / (255.0 * Blu) ' ' store the results. ' ImageData[x,y,1]=Red2 ImageData[x,y,2]=Grn2 ImageData[x,y,3]=Blu2 Next Next UnlockImage (Image) End Function
And as you'll see with using your own images with the example, that the colours are still a tad wrong.
Big Thanks,
THUMBZ