Getting a TGLImageFrame from a TImage

BlitzMax Forums/BlitzMax Beginners Area/Getting a TGLImageFrame from a TImage

Gabriel(Posted 2005) [#1]
I'm trying to get the handle of a TglImageFrame from a loaded image. The image is definitely loaded ( verified in that I can draw with it and it returns it's width correctly ) and I'm using the GL drivers with SetGraphicsDriver GLMax2DDriver()


However, the frame is always null. Just not sure what else I need to do before retrieving the imageframe.

Local frm:TGLImageFrame
frm=TGLImageFrame(Image.frames[0])
If Frm=Null Then RuntimeError "NO FRAME"


It errors with "NO FRAME" every time.


SoggyP(Posted 2005) [#2]
Hello.

Should it be frames[1]? Or perhaps you need to cast after your 'frm='?

Goodbye.


Dreamora(Posted 2005) [#3]
Are you sure that you are in OpenGL and not D3D? :)


Gabriel(Posted 2005) [#4]
Should it be frames[1]?


Nope, it throws an error for trying to go beyond the bounds of the array if I go beyond 0.

Or perhaps you need to cast after your 'frm='?


I tried cutting out casting altogether and just going for the ImageFrame base class.

Local TFrame:TImageFrame
TFrame=Image.frames[0]


TFrame is also Null.

Are you sure that you are in OpenGL and not D3D? :)


Well I'm sure I have SetGraphicsDriver GLMax2DDriver() at the beginning of my code and I'm sure I don't called SetGraphicsDriver ever again, so I'm pretty sure. By not casting to the GL-specific version, and still getting a null TImageFrame, that would appear to indicate that it's another problem. I'm baffled though.


Dreamora(Posted 2005) [#5]
strange ... as I know that it works if you use image.frame[0] to modify u0,v0,u1,v1, as I was in need to use that for an energy bar ...

will have a look after I got some sleep ... looks somehow quite strange ...