Skip to main content
gamedev.net
🔒 Locked

texture problem

Started by hello_there 7 replies 400+ views
Original Post
hello_there
hello_there
I''m using tga files for my textures. When i map it to a triangle is repeats a bit of the top on the bottom and it looks real bad. Anyone know what might cause it to do this. I don''t think it''s the texture coordinates.
____________How could hell be worse?
Myopic Rhino
Myopic Rhino
Sounds like the values you''re passing for format and/or type don''t match what''s actually in the TGA.
hello_there
hello_there
I''m using format GL_RGBA and type GL_UNSIGNED_BYTE. I''m also using gluBuild2DMipmaps(). When i try to use glTexImage2D() now the texture just appears as white.
____________How could hell be worse?
Fingers_
Fingers_
If your texture coordinates are from 0 to 1 and you''re using bilinear filtering, the bottom pixels of the texture will be visible at the top and vice versa (blended halfway). This will be more visible if it''s using a smaller mipmap so adjusting the texture coordinates won''t always help. Have you tried using CLAMP_TO_EDGE?
hello_there
hello_there
Nope. How do you do that? Also how would i make it trilinear filtering?
____________How could hell be worse?
Fingers_
Fingers_
trilinear would be GL_LINEAR_MIPMAP_LINEAR .. But any filtering besides GL_NEAREST (which you don''t want) will have the same problem. It''s just how texture coordinates work.

Edge clamping requires OpenGL 1.2 or later and you use it by putting GL_CLAMP_TO_EDGE (0x812f) in the texture parameters instead of GL_REPEAT or GL_CLAMP.
hello_there
hello_there
Thanks that worked but i had to use 0x812f because GL_CLAMP_TO_EDGE didn''t work.
____________How could hell be worse?
fireking
fireking
its not part of the original 1.1 spec, so it must be defined
--FirekingOwner/LeaderFiregames Development &Blackdragon Studios
_the_phantom_
_the_phantom_
for stuff beyond 1.1 i recomend getting a hold of benjamin bunny''s GLee lib as it makes using ''em painless and fun :D

also, there is an artical on Gamedev about going beyond 1.1''s features, its probably a good idea for you to take a shifty at that as well

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.