Skip to main content
GameDev.net gamedev.net
🔒 Locked

border texture

Started by tomsh Mar 13, 2012 at 5:32 PM 6 replies 1.7k views
Original Post
tomsh
tomsh
Hello, I'm using opengl and load my textures with soil.
When I render my square, it makes a border to the texture.

Here the code of the soil's load:


textur[fNum] = SOIL_load_OGL_texture
(
(char*)fName.c_str(),
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y
);

thanks.
WhiskyJoe
WhiskyJoe
What does the texture look like? What does it look like on the square? How should it look? Did you define correct UV coordinates?
tomsh
tomsh
The texture doesn't have a border, she looks normal.
And here one of the coordinate's code for example:


glBegin(GL_QUADS); //create polygon
glTexCoord2f((part/maxParts), 0.0f);glVertex2d(x, y);
glTexCoord2f(((part+1.f)/maxParts), 0.0f);glVertex2d(x2, y);
glTexCoord2f(((part+1.f)/maxParts), 1.0f);glVertex2d(x2, ny2);
glTexCoord2f((part/maxParts), 1.0f);glVertex2d(x, ny2);
glEnd();

the variables are float.
I thought maybe it because one of them isn't excatly 1.f
but it happend in the y too, and I checked with 1.f, and still happend.
6itru
6itru
i had the same ;p
try add something like this after image loading

glBindTexture(GL_TEXTURE_2D, textur[fNum]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
Hodgman
Hodgman
So you've got many small images packed next to each other in a single texture? And when you render quads using these sub-images, the edges of the next sub-image bleed into your quad?
tomsh
tomsh

i had the same ;p
try add something like this after image loading

glBindTexture(GL_TEXTURE_2D, textur[fNum]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);


Thanks, I had already tried that.
It doesn't work.

So you've got many small images packed next to each other in a single texture? And when you render quads using these sub-images, the edges of the next sub-image bleed into your quad?

I didn't understand what you asked.
Hodgman
Hodgman
I didn't understand what you asked.
I was trying to clarify what it is that you're doing, as you've not given us much information or pictures of the problem.

To try again: the [font=courier new,courier,monospace](part/maxParts)[/font] code implies that you've got several "sub images" inside the same texture, and you're trying to draw quads that use different "sub images". Is your problem that the edges of each sub-image look wrong (they're blended with the next sub-image)?
tomsh
tomsh
Oh, no.
It happend too with images which has only one part.
What information do you need about the picture?
Can it help you if I show you a screenshot?

Topic Locked

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

Sign in to reply to this topic.