Hi,
This is my function for drawing vitual objects on the
right place, this function don't work(I use
ARToolKitPlus). Do you know what is wrong in my code ?
void VisualControl::draw()
{
float gl_para[16];
GLfloat mat_ambient[] = {0.0, 0.0, 1.0,
1.0};
GLfloat mat_flash[] = {0.0, 0.0, 1.0,
1.0};
GLfloat mat_flash_shiny[] = {50.0};
GLfloat light_position[] =
{100.0,-200.0,200.0,0.0};
GLfloat ambi[] = {0.1, 0.1, 0.1,
0.1};
GLfloat lightZeroColor[] = {0.9, 0.9, 0.9,
0.1};
argDrawMode3D();
argDraw3dCamera( 0, 0 );
glClearDepth( 1.0 );
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
/* load the camera transformation matrix */
argConvGlpara((float
*)tracker->getModelViewMatrix(), gl_para);
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf( gl_para );
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glLightfv(GL_LIGHT0, GL_AMBIENT, ambi);
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightZeroColor);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_flash);
glMaterialfv(GL_FRONT, GL_SHININESS,
mat_flash_shiny);
glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
glMatrixMode(GL_MODELVIEW);
glTranslatef( 0.0, 0.0, 25.0 );
glutSolidCube(50.0);
glDisable( GL_LIGHTING );
glDisable( GL_DEPTH_TEST );
}
void VisualControl::mixing(HWND hWnd)
{
int markerId = tracker->calc((unsigned
char*)(dataArray));
if(markerId!=(-1))
{
draw();
}
}
many thanks
___________________________________________________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses
http://fr.answers.yahoo.com
|