diff --git a/apps/test/trackball/main.cpp b/apps/test/trackball/main.cpp index 9bd8956f..a3b23700 100644 --- a/apps/test/trackball/main.cpp +++ b/apps/test/trackball/main.cpp @@ -1,13 +1,15 @@ #include using namespace std; +#ifdef _WIN32 #include +#endif + #include -#include -#include -#include +//#include #include +#include using namespace vcg; @@ -59,8 +61,9 @@ bool init() { -int wmain(int argc, unsigned short **argv) { +int main(int argc, unsigned short **argv) { if(!init()) return -1; + glewInit(); Trackball trackball; @@ -113,18 +116,18 @@ int wmain(int argc, unsigned short **argv) { break; case SDL_MOUSEBUTTONDOWN: x = event.button.x; - y = event.button.y; + y = height - event.button.y; trackball.MouseDown(x, y, Trackball::BUTTON_LEFT); break; case SDL_MOUSEBUTTONUP: x = event.button.x; - y = event.button.y; + y = height - event.button.y; trackball.MouseUp(x, y, Trackball::BUTTON_LEFT); break; case SDL_MOUSEMOTION: while(SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_MOUSEMOTIONMASK)); x = event.motion.x; - y = event.motion.y; + y = height - event.motion.y; trackball.MouseMove(x, y); break; } @@ -134,15 +137,15 @@ int wmain(int argc, unsigned short **argv) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60, 1, 0.1, 100); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - gluLookAt(0,0,8, 0,0,0, 0,1,0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + gluLookAt(0,0,6, 0,0,0, 0,1,0); glRotatef(130, 1, 1, 0); - glTranslatef(0, 0.7, 1); + glTranslatef(0, 1, 1); - trackball.SetPosition(Similarityf(Point3f(1, 0, 0))); - trackball.local.sca = 0.5; + // trackball.SetPosition(Similarityf(Point3f(1, 0, 0))); + // trackball.local.sca = 0.5; trackball.GetView(); trackball.Apply(); trackball.Draw(); @@ -160,4 +163,4 @@ int wmain(int argc, unsigned short **argv) { return -1; } - \ No newline at end of file +