View Full Version : why wont this texture map!!!!!!!!!!!!!!!!!

11-03-2002, 11:01 AM
I adopted nehe's example in tut #24 for texture mapping .TGA files. I can get it to texture map using the Floor.TGA file but File.TGA does not work. I tried using the File.TGA in textures[0].textID and the base won't texture map. I'm suspecting something is wrong with my File.TGA but I'm not completely sure. Is there something wrong with my code, am I leaving something out or have lines of code in the wrong place?
here is my code http://sourcepost.sytes.net/sourcepost/sourceview.aspx?source_id=1573

11-03-2002, 11:21 AM
Maybe your tga that doesn't work is using rle compression or isn't 24 bit. The tga loading code may not support every possible tga format.

11-03-2002, 11:57 AM
I know for sure that the loader doesn't support compressed tgas.

Also make sure that your image width and height follow the powers of two rule. That means widths and heights can only be these sizes: 1, 2, 4, 8, 16, 32, 64, 128, 256, and as high as your video card supports. Any other size will result in a blank texture.

11-03-2002, 12:17 PM
whats rle compression? How do I know if rle compression is being?

11-03-2002, 06:59 PM
The error has something to do with if( (LoadTGA(&textures[0],"wood.TGA")) | | (LoadTGA(&textures[1],"Floor.TGA") )) .Both files will texture map however whatever file tries to get stored to &textures[1], "....TGA" will not texture map to my object, it turns the rest of my objects gray. I've been at this problem for quite some time now and I can't see what the error is. texutre[0] should be able to generate and build any texture to textures[0] and textures[1] through the use of texture[0] (notice no 's'). Here's my code, please take a look and see if maybe there's a variable needed or missing or something because I don't see the problem. http://sourcepost.sytes.net/sourcepost/sourceview.aspx?source_id=1611

11-04-2002, 01:48 AM
Why do you call load inside an OR conditional like that?

I don't think the second term is evaluated if the first is true, and so your load call for the second texture will not be called.

Just call load twice without all the if | | crap.

[This message has been edited by dorbie (edited 11-04-2002).]

11-04-2002, 01:48 PM
I changed the | | in the if statement in init() to &&. I compiled and it works properly. I still don't know how I could map T amount of times across a texture. Is it possible to tile a texture T amount of times across a face of an object, if so how? Also, whenever I reshape my screen using 'f' or 'w' i lose my textures!

11-04-2002, 03:06 PM
Use coordinates greater than 1.0 and less than 0.0 and set the repeat wrap to repeat, not clamp. Your texture will repeat across the surface.

[This message has been edited by dorbie (edited 11-04-2002).]

11-04-2002, 04:06 PM
I am using coordinates greater than 0. I'm trying to map a face that is 10.2 units in the X-direction so I use glTexCoord2f( 10.0,...). What do you mean setting the repeat wrap to repeat and not clamp ?

11-04-2002, 05:58 PM
quasi code