border texture

Started by
6 comments, last by tomsh 12 years, 1 month ago
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.
Advertisement
What does the texture look like? What does it look like on the square? How should it look? Did you define correct UV coordinates?
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.
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);
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 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.
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)?
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?

This topic is closed to new replies.

Advertisement