Help with touch movement

Posts: 7
Joined: 2008.12
Post: #1
Hi guys

I have recently decided to learn OpenGL and have begun the process of creating samples for myself. I have actually run into a ditch though that is hard to get out of. Basically, I have a texture that has been drawn on the screen, and I would like to be able to touch it which will cause the texture to follow a finger's movement. (using touchesMoved [or that's what I've used before outside of OGL])

Since I'm still new to OpenGL, I don't know how I'd store x and y data and then transfer it to the normal touch events (which I've used before without problems). I was told to use GLTranslations to move the texture which I guess is the right idea, but am unsure if it would work right with Texture2D.

Any help would be great; I didn't post code since I don't think it's really necessary for this topic. Let me know if you do need the relevant code though.

Thanks a lot. Smile
Quote this message in a reply
Posts: 94
Joined: 2008.08
Post: #2
Basically you should store a global x,y variable and when touchesMoved gets called you set the x,y variables to the x,y from touchesMoved... then in your draw code you would do a gl_translate(x,y,0);
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  3d movement jjslay 2 4,023 Jan 17, 2011 04:08 PM
Last Post: jjslay