Game Development Community

GBitmaps and TextureHandle

by Tim Newell · in Torque Game Engine · 01/18/2002 (4:25 am) · 2 replies

I'm working on getting the lens flare code running. Everything is working fine except i can't get a texture to show up. My problem is this. The lens flare code has a texture handle in it. I can't figure out how to create this handle. If I do:

lf.tex = TextureHandle("./THP2/data/shapes/rifle/smokeParticle.png",BitmapTexture,true);

then nothing gets created. i.e. lf.tex == NULL

If I try:

GBitmap * bitmap = (GBitmap*)constructBitmapPNG(fStream);

and then do:

lf.tex = TextureHandle("./THP2/data/shapes/rifle/smokeParticle.png",bitmap,BitmapTexture, true);

then it crashes on the line glGenTextures(1, &to->texGLName); in TextureManager::createGLName

Anyone have any idea what my flaw is?

-Tim aka Spock

#1
01/18/2002 (5:34 am)
Tim, you'll probably want something like TextureHandle = new Texture("TextureNameHere");

the texture handle is basically a handle to a texture, I am assuming the textureclass has functions to create them.

I'd have a look in the gui controls as an example, specifically guiBitmap.SetBitmap that'll have the specific calls you need.

Is lens flare code already in the engine? I wasnt aware of it, but I didnt bother looking yet :)

Phil.
#2
01/18/2002 (1:41 pm)
Well, setBitmap is what I looked at and it is done just like my first example there. In that second example I am creating a bitmap (debugging the only thing I see that isnt there is the palette) and when I call the texture handler it goes through the steps to register my texture and all of that but it throws an error on that opnegl function I have pasted there.

-Tim aka Spock