Apply a fragment shader on a bmax image
BlitzMax Forums/OpenGL Module/Apply a fragment shader on a bmax image
| ||
Hey there, propably a very newb and simple question; is it impossible/ possible/ easy to apply a OGL fragment program on a BlitzMax Image? Actually it should be possible, but at the very moment i got absolutely no idea where the hell in bmax source i gotta seek access to the ogl context of the bmax image... maybe a little example would be great! Thanx for fast answers, BeAnAge |
| ||
Something I found, cannot currently try this though:Local myimage:TImage = CreateImage(128,128) Local ifr:TImageFrame = myimage.Frame(0) Local TGL:TGLImageFrame = TGLImageFrame(ifr) Local texture:Int = TGL.name Some bmx code.. Type TGLImageFrame Extends TImageFrame Field u0#,v0#,u1#,v1# Field name,seq '.. Method Draw( x0#,y0#,x1#,y1#,tx#,ty# ) Assert seq=GraphicsSeq Else "Image does not exist" EnableTex name glBegin GL_QUADS glTexCoord2f u0,v0 glVertex2f x0*ix+y0*iy+tx,x0*jx+y0*jy+ty glTexCoord2f u1,v0 glVertex2f x1*ix+y0*iy+tx,x1*jx+y0*jy+ty glTexCoord2f u1,v1 glVertex2f x1*ix+y1*iy+tx,x1*jx+y1*jy+ty glTexCoord2f u0,v1 glVertex2f x0*ix+y1*iy+tx,x0*jx+y1*jy+ty glEnd End Method '.. End Type |
| ||
aaah nice.. so in fact this means, the TImage OGL context handler gets stored at the TGLImageFrame.name field? .. ah found it at .glmax2d^^ .. OMG this is INDEED interesting, need some coffee :) what means the "seq" field? found some lines on error checking "assert seq=GraphicsSeq ..." but .. (GraphicsSeq?, again such a ridiculous global :| ) but hell yeah ACTUALLY my QUESTION IS more then answered, thank you again (your ngl engine still does great services :)! regarts, BeAnAge |
| ||
Glad to be of help. |