Android :: Detecting User's Touches Over An OpenGL Square
Nov 11, 2010
I'm developing an Android application.I'm also working with OpenGL graphics.I have a square drawn on the screen and I want to let user move it when he touches over it. In other words, user should be able to move square when he puts his finger on the square.If he touches outside the square nothing happens.How can I detect when user touches over square?
View 2 Replies
Nov 10, 2010
I'm developing an Android application. I'm very new on it. I have the following classes:
class CustomGLSurfaceView extends GLSurfaceView
class CustomRenderer implements GLSurfaceView.Renderer
CustomGLSurfaceView uses CustomRenderer to render a cube on onDrawFrame method.
I've added an onTouchEvent(MotionEvent event) on CustomGLSurfaceView to manage touch events:
class CustomGLSurfaceView extends GLSurfaceView {
// For touch inputs - previous touch (x, y)
private float previousX; private float previousY;
private CustomRenderer myRenderer; public CustomGLSurfaceView(Context context) {
super(context); myRenderer = new CustomRenderer(); setRenderer(myRenderer);
} @Override public boolean onTouchEvent(MotionEvent event) {
float currentX = event.getX(); float currentY = event.getY();
switch (event.getAction()) { case MotionEvent.ACTION_MOVE:
myRenderer.handleMovement(currentY, currentY, previousX, previousY);
} // Save current x, y
previousX = currentX; previousY = currentY;
return true; // Event handled } }
May I have to modify onDrawFrame to draw something new or to rotate the cube? I thing I must do it on handleMovement.
View 1 Replies
View Related
Nov 24, 2010
After much waiting for my desire HD I was (and am) really pleased with it. However in the last couple of days my screen appears to be detecting a second touch which pretty much prevents me playing games and is a real hindrance when typing. I could accept this if it were the gel protector or my hand running over the side of the screen, but it seems to be around the "rtuio" bit of the keyboard when holding the phone in portrait mode (i.e. the centre). I do have a screen protector on there but there are no air bubbles or anything visible underneath it. So yeah, has this been raised before? I couldn't find anything. Do I need to recalibrate the screen somehow?
View 1 Replies
View Related
Aug 1, 2009
I've this code:
Java: (http://nopaste.me/4449 )
package com.patrick.games.whackgroundhog; import android.app.Activity;
import android.content.Context; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Paint;
import android.os.Bundle; import android.view.MotionEvent; import android.view.View;
public class Game extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(new Ground(this));
} class Ground extends View { public Ground(Context context) { super(context);
} public void onDraw(Canvas canvas) { canvas.drawColor(Color.BLACK);
} @Override public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
//TODO: draw the circle } return true;
} } }
View 2 Replies
View Related
Nov 19, 2010
I'm new to android development. Is it possible for a view (with a particular layout) to "appear" at the location where the user "touches"? If so, how? Like the idea of right-clicking on your computer - a menu pops down wherever you right-click and when you navigate away, it disappears.
View 1 Replies
View Related
Feb 4, 2009
Here is the problem, I am building an application and have multiple images that need to switch when the user touches the screen, doesn't matter where the users touches. The press the screen and the images switch randomly. I purchased the ebook "Professional Android Application Development" and have torn though it. I am stumped. I'm thoroughly confused at this point. Any ideas on where I can go or how I can accomplish this?
View 11 Replies
View Related
Feb 25, 2009
Single Threaded OpenGL game ! (check bottom, you can download and use the helper class) Lighting disabled ! Depth Buffer disabled ! Culling enabled ! Textures disabled !
Just 176 integers (x,y values only) making 88 vertexes along with 132 index numbers making "44 triangles only"
Framerates I get is
with GL_BLENDING disabled - 145 fps approx only! enabled - 110 fps approx only!
I have the screenshot of exact code in the draw function here.. just 2 damn lines ! I have hidden only the comments.. click here to see it http://prasna991.googlepages.com/drawframe.png
variable details in the 2 lines of code =========================== ipts = 176 elements (only x and y for each vertex) totallinetriangles * 3 = 176 lineindexes = 132 elements - type "short"
Here is the screenshot of output drawing and how it will look like http://prasna991.googlepages.com/screen.png
OpenGL single threaded Initialization Helper ================================ Here is my OpenGL helper class.. makes the OpenGL initialization for newbies a cakewalk http://prasna991.googlepages.com/OpenGLHelperclass.txt
I tested by rendering on the touch event only.. frame rate drops only when u touch and drag and here I have just tested by tapping and releasing gently on the emulator and on the device
Is this the device limitations ? So graphics is actually a lot lot lot slower than on iPhone ?
View 8 Replies
View Related
Jul 24, 2010
I would like to be able to use the OpenGL API from both Java and C (via NDK).
In Java, there is a GL object passed, which has all GL methods on it.
In C, you just talk to the native library.
In a single onDrawFrame callback (for which Java is passed a GL), can I use methods on the GL object, and also call NDK methods which access the openGL library?
In other words, is the GL object just a wrapper for the same instance of the native library?
View 3 Replies
View Related
Nov 5, 2009
I have written a simple map application using the Google API. I have the apikey set and the map displays properly on the android phone. However, there is always a red square on the bottom left of the map, that I don't know how to get rid off. Here is the URL of the snapshot: http://picasaweb.google.com/mcornill/Screenshots#5399362615931619762 The Java code...
View 5 Replies
View Related
Sep 5, 2009
I downloaded the new FourSquare app from the market. It's another social media, location aware app with a game type twist. (designed with Android in mind = no battery drain.) foursquare They also made it open source. I have been scoring various points for my travels today. Let's start playing here on AF.
View 1 Replies
View Related
Aug 7, 2010
Alright, so I've got this OpenGL tutorial I'm basing from, my current code is equivalent to Part II of it, which is here:
http://blog.jayway.com/2009/12/04/opengl-es-tutorial-for-android-%E2%80%93-part-ii-building-a-polygon/
The code for that can be downloaded near the bottom of the page. It leaves you with a white square, and I want to apply a texture to it, which this tutorial series doesn't cover. I can't figure out how to texture my white square, in Android.
View 1 Replies
View Related
Oct 30, 2010
I would like to have a layout with 5 times 5 buttons. Each of them should have the same width and height (they should be square). And I want the whole matrix to use the screen width (or height, depending on rotation).
I currently do it "by hand" in the Java code:
CODE:...........
This can be improved by obtaining screen width first and then dividing by 5 to get rid of this literal 60. But I'm wondering how I can do this in the res/layout XML file? How can I specify for the height to be the same as the width? (I can set the width to match_parent.)
View 4 Replies
View Related
Oct 17, 2010
I want to create a mobile learning for an high school. Is there a way to display math notation like square, exponent etc in textview? Or should we use another component?
View 3 Replies
View Related
Feb 12, 2010
In a Listview I want create a square button that is as wide as the list item is heigh.I don't want to set fixed width and height as it should work for different resolutions.
Is is possible?
View 2 Replies
View Related
Jun 15, 2010
What's the best way of intercepting screen touches and coords during a game loop? At this point, I don't have a View from my main.xml file, so the normal OnTouchEvent doesn't apply, as far as I can tell. What's the usual procedure for this?
View 2 Replies
View Related
Feb 24, 2010
I am using the MapsDemo example for a mapping application where I rotate the map in direction of travel. This works well even without the canvas smoothing in the example.
However, I haven't yet managed to adjust the dispatchTouchEvent code to counter the map rotation effect for the user touches (right now when the map is rotated 90 degrees a user's horizontal sweep will move the map vertically etc). The sample code only offers the teaser:
CODE:..........
And while I am at it - Is it still possible to position the zoom controls separately, so that they do NOT rotate when the map rotates? I read that the getZoomControls() is deprecated.
View 2 Replies
View Related
Nov 24, 2010
I just switched from Evo to Epic. (Loved Evo but mine had known h/w issue where screen does not respond to touch).
The Evo had a Google search icon that was the same square size as other icons. The Epic has the big horizontal one. I would like smaller icon to regain some real estate. Possible?
Also, on my default 5th home screen are icons for Cnn, youtube, and ESPN. I would like icons for my fave websites. Any easy way to do that. I bookmarked them in my browser, but that involves opening browser and clicking bookmarks, etc.
View 1 Replies
View Related
Jan 8, 2014
Tonight I was taking videos and a couple of pictures with my droid mini. I was also switching to the gallery to view what I was taking and everything was there. In the middle of the last video, the screen freezes and I had to power down because my phone was just frozen. When I powered back up, I saw just 5 gray squares where those last 5 pieces of media should have been. They were saved and viewable before this happened!! How can I open or get them back! I've read a few threads, but all the back up methods do not work. My phone is not rooted. I uploaded all my files into my computer, and they are simply not there. It's not a huge giant issue, because everything else remained as it was, but these were videos of me playing with my kid. They didn't even get backed up onto google plus yet. I did shoot a test video right after my phone came back on...and the gray squares are still there.
View 1 Replies
View Related
Dec 27, 2009
I see this square bar code looking image on a lot of android sites. what is this and how does it work? It appears to be somekind of identifier for apps and such.
View 2 Replies
View Related
Feb 20, 2014
For the longest time since I purchased my phone a year ago, it has periodically, upon receiving picture messages, shown up as a gray square with an orange triangle. This was alright because it was a once in a blue moon type ordeal. However, recently since I updated to 4.3 it's consistently happening more times than not. My s3 carrier is Metro PCS, it runs 4.3 as stated again.
View 8 Replies
View Related
Apr 29, 2010
Mine just started registering phantom screen touches a little while ago.It seems to think there is either and up-swipe or some kind of touch near the top of the screen randomly. For example, an email or list will constantly be scrolling up or if I leave it on a screen with Power Panel on it, one of the icons will randomly highlight orange. The page with the google search widget will have the search field highlight orange on it's own too. When entering text, the cursor will randomly jump back to the beginning.
View 6 Replies
View Related
Nov 5, 2010
Anyone notice a change since the last update with inaccurate touches in the TM directory?I've lost count on how many times I'd touch on one person to text and it brings up someone completely different.
View 6 Replies
View Related
Sep 23, 2010
I plan to get an HTC Desire soon and have one last question on mind.The best phone I've used so far is the iPhone. If anyone's used/compared the iPhone and Desire with a hands-on experience, could you please let me know how well the touch sensitivity/responsiveness of the HTC Desire compares with the iPhones? i.e. does it respond as well to soft/light touches as the iPhone does? Also, how well would you place the touch sensitivity (good, better, best, equal) for Apple iPhone, HTC Desire, Samsung Galaxy i9000, if you've personally experienced all 3, or any 2 of them.I haven't been able to get my hands on one unfortunately. This seemed to be the only way left to find out.
View 9 Replies
View Related
Jun 24, 2010
I've never had a smartphone YET, but my daughter has a Droid and says she hates that when talking on it, her cheek touches the screen and changes stuff while talking. She's new to the phone itself, so is she doing something wrong or is this just a con of smartphones? Or is this a Droid thing and not an EVO thing?
View 13 Replies
View Related
Apr 21, 2014
my phone has been randomly spazzing out. I have a LG G2 with 4.4.2
It will slide left to right, open and close apps, etc. without me touching it.
It will go periods of time without doing this, then not stop doing it for a good few minutes. i did just factory reset it, but it is still doing the same thing.
View 1 Replies
View Related
Apr 5, 2014
I have a xi electronics chinese crappy tablet, it came pre rooted. So I changed he cpu governor and I pressed apply, after that it stuck , and I needed to reboot using power and vol -It booted up but now my TouchScreen doesnt respond on my touches!, I have already tried factory reset using adb , didn't work.
View 8 Replies
View Related
Apr 11, 2014
I am looking for an app, that makes the touches visible.
I do not mean a Touch-Test App, but one that creates an Overlay and displays the touches, with variable graphics.
Something like that, what can be activated in the developer options but with variable Graphics, not such a simple circle.
View 1 Replies
View Related
Sep 22, 2010
I have a EditText in android in which i want the user to enter the text and checks for the condition "BYE"
Code sample..
How can i make user to enter the text?The UI should wait for the text to be entered(something like we have InputStreamReader in java applications).
View 2 Replies
View Related
Nov 19, 2013
My sero pro produce random false touches when connected to computer via usb cable. That makes it very inconvinient to use for development. It does not have this problem when the cable is not connected. That is most apparent when "Show touches" is turned on in developer settings.
I opened it up looking for loose joints on usb or digitizer ports, but everything seems good with that.
View 1 Replies
View Related
Jul 7, 2010
I have a single bitmap with several individual pictures in (each one is an option) and I would like to detect when the user touches these pictures. I am using the event.getX and event.getY to detect where is pressed, I know the top left X Y and bottom right location of each of the pictures. What is the best way of detecting which one is pressed? (i.e. tieing up the event press and which picture has been pressed?
View 2 Replies
View Related