PDA

View Full Version : Problem with texture mapping



obastob
11-19-2010, 08:16 AM
Hi,
I am new in this forum but i little know and work with opengl.
My question is , in order to do texture mapping we actually try to fit the image in a square box. But if the image is not entirely covered with the box for example if the image is a plane and it is concave , when i try to fit the image in a box many area will remain with the background color (as the object of the image is concave) which is not at all required in my aero fighter game . Because in my game the background color changes with every stage i enter.

So, what should i do so that the empty area of the image should not show but only the object of the image will show??

Plz help me..

ZbuffeR
11-19-2010, 08:47 AM
You mean : make the background part transparent ?
You have to add an alpha channel to your textures : 0 in for the background, 255 for the plane.

obastob
11-20-2010, 12:30 AM
Sorry i can not explain it properly.
Plz Look at the picture below

(1,0) (1,1)
----_------
| _/ \_ |
| | | |
| |____| |
|__________|(1,0)
(0,0)

The square will be the box and the image of the house i want to add. I don't want to show the outside of the house(image)(vacent area enclosed by square). What should i do for this?

_arts_
11-20-2010, 05:57 AM
You should add transparent values out of the house image. Image formats like jpg and bmp don't support transparency, you can try with tga or png.

obastob
11-20-2010, 11:38 PM
thanks. I will try.

obastob
11-21-2010, 05:37 AM
plz give me some suggestions to do it or any link so that i can do it.