Author Message

<  visual studio  ~  Windows 7 and multitouch with openframeworks

PostPosted: Fri Jan 08, 2010 3:23 pm
Joined: Fri Jan 08, 2010 2:50 pmPosts: 5
Hello

Forgive me if this question sounds dumb, but I dont have much experience in C++.

So I just recently aquired a windows 7 machine with a multitouch enabled screen, and just started using Visual studio for the first time.
I'm wondering how I could get multitouch, gesture messages from windows 7 working with an OpenFrameworks application? Any hints of how I could get started on this would be greatly appreciated

thanks


Offline Profile
PostPosted: Tue Feb 02, 2010 11:05 pm
Joined: Tue May 12, 2009 9:41 amPosts: 1
Hi,

I am currently looking into interfacing with off the shelf multitouch monitors as well.

I have found that most of the monitors out there HP, Dell etc are using Nextwindow technology (is is not really multitouch since it can only detect two touch points). You can download dll-files that give you access to their multitouch api:
http://www.nextwindow.com/nextwindow_support/api.html
There is a c++ example on the page - I haven't tried it myself yet, but I guess it should be relatively easy to use this in openframeworks.

Alternatively, someone has written a TUIO bridge - translating the touch events to TUIO events
http://nuigroup.com/forums/viewthread/4687/
This is quite a nice way of handling the touch events and makes it easy to run your apps on other TUIO hardware.

/lars


Offline Profile
PostPosted: Thu Feb 04, 2010 6:27 pm
Joined: Sun Apr 26, 2009 7:28 amPosts: 16
Yeah,

I just managed to get Windows 7 "native" Gesture support working in OpenFrameworks. (Haven't tested anything yet except the "Two finger Tap" & zooming
I guess it is more of a hack though than anything else. But than, I wouldn't consider myself a "real" or good programmer.
Anyways.

Changes:

ofConstants.h, line 42
from:
Code:
#   define _WIN32_WINNT 0x400


to
Code:
#define _WIN32_WINNT 0x0601

You have to do this, otherwise WM_GESTURE won't be available. Don't know if there are any sideEffects.

Next you have to extract the attached files into
Code:
of_preRelease_v0061_vs2008_FAT\libs\openFrameworks\app\

Attachment:
File comment: taken from http://code.msdn.microsoft.com/WindowsTouch and modified.
GestureEngine.zip [4.91 KiB]
Downloaded 20 times



They are taken from http://code.msdn.microsoft.com/WindowsTouch and modified.
I do not know about legal issues using this stuff though..

Next open up
ofAppGlutWindow.cpp and
add around line 4
Code:
#include "MyGestureEngine.h"


as well as

Code:
CMyGestureEngine * gestureEnginePtr;

below ofBaseApp * pfAppPtr (around Line 33)

next, you have to add a case statement below case WM_DESTROY:
Code:
     case WM_GESTURE:
        //std::cout << "Gesture caught" << std::endl;
        return gestureEnginePtr->WndProc(hwnd, wParam, lParam);


The last change to this file is around line 225 (in runAppViaInfininteLoop)

add

Code:
gestureEnginePtr->setAppPointer(appPtr);
below ofAppPtr = appPtr

next, you have to adjust ofBaseApp.h

just add
Code:
      virtual void twoFingerTap(){}
      virtual void twoFingerZoom(double dZoomFactor,const LONG lZx,const LONG lZy) {}

somewhere.
You can get the changed files hier
Attachment:
File comment: Changes made
changedInOF.zip [5.43 KiB]
Downloaded 12 times



At last, you have to add
Code:
   void twoFingerTap();
   void twoFingerZoom(double dZoomFactor,const LONG lZx,const LONG lZy);

to your testApp.h and (as you all know, I guess)
Code:
void testApp::twoFingerTap(){
   std::cout << "Two Fingers Tapped in TestApp.cpp" << std::endl;
}
void testApp::twoFingerZoom(double dZoomFactor,const LONG lZx,const LONG lZy){
   std::cout << "Zooming with a factor of " << dZoomFactor << std::endl;
}


That's it. -- Doesn't seem that difficult now. ^^
As I said, it is far from being done and ready, however I heard "post early, post often" is the way to go ;)
What I especially like about this solution is, that it just blends into of seamlessly.
I wouldn't now how to make an ofx.. Extension out of it.

PS: Just tested on one machine,
HP TouchSmart IQ820 with 64Bit Windows 7. It should work in 32 Bit windows 7 as well. (Not earlier Version, as WM_GESTURE then)

http://img188.imageshack.us/img188/3227/zoomandtap.png


Offline Profile
PostPosted: Wed Feb 17, 2010 4:31 am
Joined: Fri Jan 08, 2010 2:50 pmPosts: 5
Hey guys thanks for the replies

Im currently using a sony Vaio L-series. Ill need to dig around and find our what drivers Im using. Ill let you know of any progress I make after I investigater these options

thanks!


Offline Profile

Display posts from previous:  Sort by:

All times are UTC
Page 1 of 1
4 posts
Users browsing this forum: No registered users and 1 guest
Search for:
Post new topic  Reply to topic
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron