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 6390163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:29:36+00:00 2026-05-25T03:29:36+00:00

How can I get my textures to align with the screen pixels for pixel

  • 0

How can I get my textures to align with the screen pixels for pixel perfect graphics in OpenGL ES 2.0? This is critical for a project I’m working on which uses pixel art graphics. Any help on this would be great!

  • 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-25T03:29:36+00:00Added an answer on May 25, 2026 at 3:29 am

    See my answer here: OpenGL Texture Coordinates in Pixel Space


    This has been asked a few times, but I don’t have the links at hand, so a quick and rough explanation. Let’s say the texture is 8 pixels wide:

     | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
     ^   ^   ^   ^   ^   ^   ^   ^   ^
    0.0  |   |   |   |   |   |   |  1.0
     |   |   |   |   |   |   |   |   |
    0/8 1/8 2/8 3/8 4/8 5/8 6/8 7/8 8/8
    

    The digits denote the texture’s pixels, the bars the edges of the texture and in case of nearest filtering the border between pixels. You however want to hit the pixels’ centers. So you’re interested in the texture coordinates

    (0/8 + 1/8)/2 = 1 / (2 * 8)

    (1/8 + 2/8)/2 = 3 / (2 * 8)

    …

    (7/8 + 8/8)/2 = 15 / (2 * 8)

    Or more generally for pixel i in a N wide texture the proper texture coordinate is

    (2i + 1)/(2N)

    However if you want to perfectly align your texture with the screen pixels, remember that what you specify as coordinates are not a quad’s pixels, but edges, which, depending on projection may align with screen pixel edges, not centers, thus may require other texture coordinates.

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

Sidebar

Related Questions

Can I get paletted textures with RGB palette and 8-bit alpha channel in OpenGL
I can get easily see what projects and dlls a single project references from
I can get the element like this $(#txtEmail) but I'm not sure how to
How can I efficently interpolate per-pixel two textures A and B by a dynamic
Imagine this: a 32 bit application which has 2 GB address space and can
I can get a shader to read in two textures but for output it
Can get all triples with value null in specific field? All people with date_of_birth
I can get both System.Net.Mail and System.Web.Mail to work with GMail, but I can't
Logging can get complicated, quickly. Considering that you have some code, how do you
I can get the executable location from the process, how do I get the

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.