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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:08:06+00:00 2026-05-31T03:08:06+00:00

I’m using some demos that came with my OpenGL ES emulator as a starting

  • 0

I’m using some demos that came with my OpenGL ES emulator as a starting point. The demo I’m currently using is 960×540 pixels with a simple 2D triangle drawn in the middle of the screen.

I see that the triangle has been drawn with floats, and that the lower-left corner of the screen is (-1,-1) while the upper-right corner of the screen is (1,1).

Is it possible to change this? I would like to use integers instead of floats, and have the lower-left corner of the screen be (1,1) while the upper-right corner is (960,540).

This would be much easier to work with because I plan to make a 2D platformer game. I do not want to split any pixels in this game; everything (textures, player movement, camera movement) will conform to whole-pixel coordinates.

I tried crunching the numbers (using the regular grid and floats) to draw a right triangle that was 24×24 pixels. However, it ended up being 24×23 pixels on the screen. So I didn’t want to continue going forward if there was a more accurate, faster method that could use pixel coordinates.

  • 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-31T03:08:07+00:00Added an answer on May 31, 2026 at 3:08 am

    The values coming out of the vertex shader should be ready for projection into the normal OpenGL eye space, but you needn’t pass in vertices in that space. In ES 1 you’d have adjusted the projection stack; does your demo have any analogue to that?

    You should also take the filling rules into account. A pixel is always filled if its centre is within the geometry; if its centre is on the boundary then the implementation will make a decision usually depending on which boundary the pixel is on — the top, bottom, left or right boundaries (which make more sense if you think in terms of the pixel output; so a pixel on the left boundary is one that would be first on a scanline, a pixel on the right would be last, a pixel on the top would start the polygon further up the screen, a pixel on the bottom would extend it further down).

    The aim is that OpenGL doesn’t draw pixels twice where geometry meets on an edge.

    With that in mind, a triangle can be exactly 24 pixel units tall but if it runs from the centre of one pixel to the centre of another it will paint only [at most] 23 rows. So your maths may already be correct. Consider one polygon from y = 0 to y = 24 and one from y = 24 to y = 36 — you don’t want them both painting at y = 24, especially as they may be partially transparent.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of 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.