Texture borders
I tried to use borders in NeHe''s Lesson 06. I simply increased the size of the image from 256x256 to 260x260 and changed the line:
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 2, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
so that border is 2. However, the output is all white. There is no texture at all. Where am I mistaking?
Probably can''t support a texture of 260x260. Scale it back down to 256x256.
Still not working. I tried 68x68 also and many variants in sizes. Nobody uses borders I guess. So how should I map the lightmaps with linear interpolation?
If I remember right OpenGL can only use textures with a size that is a square of 2 (32x32, 64x64, 128x126, 256x256, 512x512, etc). Other dimensions will not work. Also some cards can''t support texture resolutions higher then 256x256.
Prosser: But the plans were on display.Arthur Dent: On display? I eventually had to go down to the cellar.Prosser: That's the display department.Arthur Dent: With a torch.Prosser: The lights had probably gone.Arthur Dent: So had the stairs.Prosser: But you did see the notice, didn't you?Arthur Dent: Oh, yes. It was on display in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign outside the door saying "Beware of the Leopard." Ever thought of going into advertising?
Mars and miles are right. If you try to use a texture that doesn''t have dimensions that are integer powers of 2 then it usually won''t display right. If you want a border, draw it in then scale your image back to 256x256. If you want to use images that aren''t of the appropriate size, you can use mipmapping. I really don''t know much about it, but I believe it''s rather inefficient.
From the red book:
"
The width and height parameters give the dimensions of the texture image; border indicates the width of the border, which is usually zero. (See "Using a Texture's Borders." ) Both width and height must have the form 2m+2b, where m is an integer (which can have a different value for width than for height) and b is the value of border. The maximum size of a texture map depends on the implementation of OpenGL, but it must be at least 64 × 64 (or 66 × 66 with borders). If width or height is set to zero, texture mapping is effectively disabled
"
I think 2m+2b->2^m+2b. b = 0,1,2.
Also OpenGL supports non 2^m size textures. It depends on implementation. I can use the halflife textures without any problem yet. This makes me think the rule is 16m.
Edited by - oztanharmanci on May 23, 2001 9:09:42 AM
Edited by - oztanharmanci on May 23, 2001 9:11:48 AM
"
The width and height parameters give the dimensions of the texture image; border indicates the width of the border, which is usually zero. (See "Using a Texture's Borders." ) Both width and height must have the form 2m+2b, where m is an integer (which can have a different value for width than for height) and b is the value of border. The maximum size of a texture map depends on the implementation of OpenGL, but it must be at least 64 × 64 (or 66 × 66 with borders). If width or height is set to zero, texture mapping is effectively disabled
"
I think 2m+2b->2^m+2b. b = 0,1,2.
Also OpenGL supports non 2^m size textures. It depends on implementation. I can use the halflife textures without any problem yet. This makes me think the rule is 16m.
Edited by - oztanharmanci on May 23, 2001 9:09:42 AM
Edited by - oztanharmanci on May 23, 2001 9:11:48 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement