Game Development Community

Texturing..

by Daniel Brown · in Torque Game Engine · 05/27/2004 (2:06 am) · 6 replies

I've just implemeted the object selection resource and I'm trying to add my own bounding box, i've made a new function to create a solid box opposed to a wireframe.

But how would i go about loading an image into Torque and converting it to a texture to use on my new bounding box? Is there any Torque command that does this already?

Im new to c++ so this is all a bit confusing! And any help is a appreciated!

#1
05/27/2004 (11:26 am)
Ok not sure if im on the right track here but I got:

ResourceInstance* constructBitmapBMP(Stream &stream)

which i think is for checking if &stream is readable?

If so, and im guessin stream would be a dir to the image? how do i write a Stream type variable?
#2
05/27/2004 (12:36 pm)
You want to use a TexHandle, I believe, to load the texture.
#3
05/27/2004 (1:51 pm)
You need to load a texture handle, turn on texturing, set up your texcoords and draw your box. The OpenGL red book or online examples should be able to help you out.

-s
#4
05/27/2004 (2:34 pm)
Setting up all the tecoords and drawing the box i think ive done, but this TexHandle thing is confusing me! I've looked through the engine, to try n find out how to use Texhandle's, but it's beyond me :( Can you explain to me how to use them or set one up?

Thanks
#5
05/28/2004 (5:52 am)
// Loading
TextureHandle handle = TextureHandle("pathToTexture", textureType);

// Using
glBindTexture(GL_TEXTURE_2D, handle.getGLName());

A far more detailed explanation can be found about midway through gTexManager.h
#6
05/28/2004 (9:06 am)
Thanks Matthew this is just what I needed!