Jump to content

  • Log In with Google      Sign In   
  • Create Account


zephyr87

Member Since 01 Nov 2010
Offline Last Active Feb 02 2011 11:39 AM

Topics I've Started

Rotate 3D Box Kinect

02 February 2011 - 08:09 AM

Hi! I'm writing a code for to rotate a 3D Cube using Kinect.
I have already solved the problem of drawing to cube in a window and the recognition of the hand, but I can not rotate my cube.
I also have a point with three coordinates X, Y, Z (Z fixed to 0) that move along a circle. Should I use this reference for to rotate.
Everything must be done when it is drawn my cube and then executed in loop.
Here is my code

void DrawCube(const XnPoint3D& ptCenter, const XnPoint3D& ptMaxs, double r, double g, double B)
{

glColor4f(r,g,b,1.0f); //Scelta del colore

#ifdef USE_GLUT
glBegin(GL_QUADS);

glColor3f(1.0f, 0.0f, 0.0f);
// FRONT
glVertex3f(-0.5f, -0.5f, 0.5f);
glVertex3f( 0.5f, -0.5f, 0.5f);
glVertex3f( 0.5f, 0.5f, 0.5f);
glVertex3f(-0.5f, 0.5f, 0.5f);
// BACK
glVertex3f(-0.5f, -0.5f, -0.5f);
glVertex3f(-0.5f, 0.5f, -0.5f);
glVertex3f( 0.5f, 0.5f, -0.5f);
glVertex3f( 0.5f, -0.5f, -0.5f);

glColor3f(0.0f, 1.0f, 0.0f);
// LEFT
glVertex3f(-0.5f, -0.5f, 0.5f);
glVertex3f(-0.5f, 0.5f, 0.5f);
glVertex3f(-0.5f, 0.5f, -0.5f);
glVertex3f(-0.5f, -0.5f, -0.5f);
// RIGHT
glVertex3f( 0.5f, -0.5f, -0.5f);
glVertex3f( 0.5f, 0.5f, -0.5f);
glVertex3f( 0.5f, 0.5f, 0.5f);
glVertex3f( 0.5f, -0.5f, 0.5f);

glColor3f(0.0f, 0.0f, 1.0f);
// TOP
glVertex3f(-0.5f, 0.5f, 0.5f);
glVertex3f( 0.5f, 0.5f, 0.5f);
glVertex3f( 0.5f, 0.5f, -0.5f);
glVertex3f(-0.5f, 0.5f, -0.5f);
// BOTTOM
glVertex3f(-0.5f, -0.5f, 0.5f);
glVertex3f(-0.5f, -0.5f, -0.5f);
glVertex3f( 0.5f, -0.5f, -0.5f);
glVertex3f( 0.5f, -0.5f, 0.5f);
//Ruoto
glRotatef(ptMaxs.X, 1.0f, 0.0f, 0.0f);
glRotatef(ptMaxs.Y, 0.0f, 1.0f, 0.0f);
glEnd();

#else
....

Thanks for the help.

Rotate 3D Box Kinect

02 February 2011 - 05:43 AM

Solved! Thanks:)

Help Crowd Simulation

01 November 2010 - 01:09 AM

Hello everyone! My name is Francesco, I am a new user. Forgive my bad English.
I wanted to ask where can I find the material on Collison detection and crowd simulation.
I have to do a job that uses OpenGL and 3D Horde but not very practical.
I have the source files of the crowd simulation, but there are collisions between objects and bipeds. I have to avoid collisions. Help me please?

PARTNERS