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

  • Home
  • SEARCH
  • 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 8577117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:05:21+00:00 2026-06-11T20:05:21+00:00

I have a problem with implementing touch events on GLSurfaceView . Views size is

  • 0

I have a problem with implementing touch events on GLSurfaceView. Views size is 1280×696, because of android (tablet) status bar at bottom with soft keys, time etc.., (screen resolution is 1280×800), but OnTouchListener is receiving touch events with coords [646.0,739.0], and thus my gluunproject method fails to return correct values
is there any way to return events that respect these boundaries? or how should I recalculate the position?

  • 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-06-11T20:05:22+00:00Added an answer on June 11, 2026 at 8:05 pm

    In general to transition between such coordinate systems: If you transition from system A to B and you have points

    • AOrigin (left upper corner of your receiver view)
    • AEnd (right bottom corner of your receiver view (origin + size))
    • BOrigin (left upper corner of your GL view)
    • BEnd (right bottom corner of your GL view (origin + size))

    where AOrigin and BOrigin represent the same location in view and same goes for AEnd and BEnd
    then for point P in the receiver view:

    X = B.Origin.x + ((P.x - AOrigin.x)/(AEnd.x - AOrigin.x)) * (BEnd.x - B.Origin.x)
    Y = B.Origin.y + ((P.y - AOrigin.y)/(AEnd.y - AOrigin.y)) * (BEnd.y - B.Origin.y)
    

    For your case (I’m not sure because of lack of information) AOrigin is at (0,0), AEnd is at (646, 739), BOrigin is at (0,0) and BEnd is at (1280, 800):

    X = P.x/646 * 1280
    Y = P.y/739 * 800
    

    You can also use this to transition to/from “GL” coordinates. A common case is having a view with upper left corner at (0, 0) and lower bottom at (1280, 800) and your “GL” coordinates are from (-1, 1) to (1, -1):

    X = -1 + (P.x/1280)*2
    Y = 1 + (P.y/800)*(-2)
    

    Also note that you may use any 2 pairs of points that represent same location on screen as long as (origin-end).x != 0 AND (origin-end).y != 0

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

Sidebar

Related Questions

I have a weird problem: Implementing an interface to a webserver in my Android
I have some problem implementing a segment control. Because i want it to be
I have a problem implementing Oauth in Android using signpost library. Everything is fine
We have a strange problem when implementing sessions with ColdFusion in IE6. After login
i have a little problem implementing some serialization/deserialization logic. I have several classes that
I have a problem with a command button (implementing the ICommand). I want, when
I'm implementing Google Maps service with PHP/CURL and currently have a problem with Maps
I'm implementing a Skein hash function in Java, and I have a problem with
I have a slight problem implementing vibration functionality in my application. My code is:
I have a problem in implementing Mashups in PHP. Now I am using PHP

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.