Jump to content
  • Advertisement
Sign in to follow this  
tomsh

OpenGL border texture

This topic is 2380 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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);

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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)?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!