Native Activity Touch coordinates are different that screen coordinates.

130 views
Skip to first unread message

David Seabolt

unread,
Dec 12, 2013, 6:37:35 PM12/12/13
to andro...@googlegroups.com
Hi,

I'm fairly new to Android NDK, so bear with me if this is a stupid question.

I'm running on a Nexus 7 and I'm trying to get my screen right.
I've called this code:

eglGetConfigAttrib(display, selectedConfig, EGL_NATIVE_VISUAL_ID, &format);
ANativeWindow_setBuffersGeometry(g_AndroidEngine.app->window, 1920, 1080, format);
To set my resolution to 1920x1080. But all my touch input coordinates are coming in at the range of ~1000x~640. Is there another function I need to call to update the size of a screen?

Jesse Hall

unread,
Dec 15, 2013, 12:30:49 AM12/15/13
to andro...@googlegroups.com
You can't change the resolution of the display on Android. This call sets the size in pixels of the buffer you're rendering into, but doesn't change the size of your window on the screen. The compositor will scale your buffer contents to the size of your window during composition. Your input coordinates are always relative to the window size (and are in dp, not pixels, I think).

David Seabolt

unread,
Dec 17, 2013, 5:30:29 PM12/17/13
to andro...@googlegroups.com
Sorry, what do you mean dp? Is there a function that I can use to get the hardware dimensions of the screen?

David Turner

unread,
Dec 18, 2013, 5:28:19 AM12/18/13
to andro...@googlegroups.com


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages