Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6218795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:40:15+00:00 2026-05-24T07:40:15+00:00

I am using a texture atlas which I have a made by stitching 2

  • 0

I am using a texture atlas which I have a made by stitching 2 identically sized images together side-by-side.
When I modify the texture co-ordinates I do the following in this order:

  1. if(texCoordx>1) texCoordx = texCoordx % 1 – So one texture doesn’t leak into another.
  2. if(texCoordx<0) texCoordx = 1 + texCoordx – Again, so one texture doesn’t leak into another.
  3. Scale the texture co-ordinates by 0.5.
  4. Add 0.5 if wanting to draw the texture on the right.

This works out mostly fine, however, I seem to get ‘smudging’ at the edges where the texture s co-ordinates approach 1 and 0. It looks like it is being smudged along the t axis. I have attached a screenshot.

Image smudged at border

I know that there was one answer found here but it only slightly narrows the smudging. I’m using my own shader, but it’s not doing any modification of texture co-ordinates. I am also enabling GL_REPEAT. Does anybody know any possible causes/solutions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:40:16+00:00Added an answer on May 24, 2026 at 7:40 am

    If I interpret your picture correctly, this texture is one of the two textures (suppose the left) from the atlas and your original texCoords were (from left to right) something like

    0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2
    

    after your own wrapping in step 1 you now got something like

    0.2, 0.4, 0.6, 0.8, 1, 0.2, 0.4, 0.6, 0.8, 1
    

    , which later became

    0.1, 0.2, 0.3, 0.4, 0.5, 0.1, 0.2, 0.3, 0.4, 0.5
    

    Here we see the problem at 0.5, 0.1, where the monotonicity changes. OpenGL doesn’t know that you want to go from 0.5 to 0.1 in the left-right direction. It just takes the difference, which is -0.4 and thus interpolates from right to left back to the beginning of the texture (and therefore squezes the whole texture inside this small interval backwards, so along the t-axis it’s actually correct). This is due to the fact, that OpenGL doesn’t know that your texture wraps at the middle of the texture, as it conceptually only sees one large texture and not an atlas of small textures and the GL_REPEAT wrapping mode only works at the edge of the large texture.

    You have to do the wrapping (the first two steps) in the fragment shader before accessing the texture. So your texture coordinates are all monotone and get interpolated correctly. Then at the fragment you can safely wrap the texture coordinates. Actually you can do all the steps in the fragment shader. Just give it a uniform for the offset inside the atlas (selecting the actual sub-texture). Then you do the wrapping, scaling and add the offset just before accessing the texture.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed an app in which Images needs to be shown using texture
I have a function which calculates image texture (using 2D convolution via NLFILTER): y=imagetexture(image,winsize)
I have recently switched from using separate resource files to using a texture atlas.
I'm doing heavy computation using the GPU, which involves a lot of render-to-texture operations.
I have a program in which I need to apply a 2-dimensional texture (simple
I'm using a library which provides me frames I have to blit to the
I'm currently using a VBO for the texture coordinates, normals and the vertices of
I need to display 2d images in opengl using textures. The image dimensions are
I have two textures generated using a fragment shader. I want to be able
Using online interfaces to a version control system is a nice way to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.