Link to home
Start Free TrialLog in
Avatar of perdoname_
perdoname_

asked on

variable not in formal parameter list ???

Hello,

On the code below i get continually an error 'gSkel: not in formal parameter list

How can i solve that error ??

Thanks in advance for any help
Avatar of perdoname_
perdoname_

ASKER

sorry i forgot to attach the code:

#include "display.h"
 
 
SKELETON* gSkel;			/* Holds skeleton data - available to any function */
MOCAP*	  gMo;				/* Hold motion data - available to any function */
int		  gDelay=0;			/* Holds delay information - available to any function */
 
 
//camera
 
static float   camera_yaw = 0.0f;      
static float   camera_pitch = -20.0f;  
static float   camera_distance = 5.0f; 
 
//mouse
 
static int     drag_mouse_r = 0; 
static int     drag_mouse_l = 0;
static int     drag_mouse_m = 0; 
static int     last_mouse_x, last_mouse_y; 
 
 
static int     win_width, win_height;
 
 
/* Entry point from MAIN.C */
void dorender(int argc, char** argv, SKELETON* skel, MOCAP* mo, int delay) {
 
 
	/* Create GLUT window */
   glutInit(&argc, argv);
   glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
   glutInitWindowSize (600, 600);
   glutInitWindowPosition( 0, 0 );
   glutCreateWindow ("Mocap");
 
   /* Setup GLUT callbacks */
   glutReshapeFunc (reshape);
   glutKeyboardFunc (keyboard);
   glutDisplayFunc (display);
   glutMouseFunc( mouse );
   glutMotionFunc( motion );
   glutIdleFunc (idle);
 
   /* Initialise any OpenGL state */
   init();
   initEnvironment();
 
	/* Set global variables */
   gSkel=skel;
   gMo=mo;
   gDelay=delay;
 
   /* Kick off the GLUT main loop */
   glutMainLoop();
   
 
}
 
 
 
void  drawMessage( int line_no, const char * message )
{
	int   i;
	if ( message == NULL )
		return;
 
	glMatrixMode( GL_PROJECTION );
	glPushMatrix();
	glLoadIdentity();
	gluOrtho2D( 0.0, win_width, win_height, 0.0 );
 
	glMatrixMode( GL_MODELVIEW );
	glPushMatrix();
	glLoadIdentity();
 
	
	glDisable( GL_DEPTH_TEST );
	glDisable( GL_LIGHTING );
 
	glColor3f( 1.0, 0.0, 0.0 );
	glRasterPos2i( 8, 24 + 18 * line_no );
	for ( i=0; message[i]!='\0'; i++ )
		glutBitmapCharacter( GLUT_BITMAP_HELVETICA_18, message[i] );
 
 
	glEnable( GL_DEPTH_TEST );
	glEnable( GL_LIGHTING );
	glMatrixMode( GL_PROJECTION );
	glPopMatrix();
	glMatrixMode( GL_MODELVIEW );
	glPopMatrix();
}
 
 
/* Keyboard callback from GLUT */
void keyboard(unsigned char key, int x, int y)
{
 
	/* ESCAPE to exit */
	
 
	switch(key) {
 
			case 0x1b:  
						parser_free_skeleton(gSkel);
						parser_free_mocap(gMo);
						exit(0);
						break;
 
 
	}
 
}
 
 
/* Mouse callback from GLUT */ 
void  mouse( int button, int state, int mx, int my )
{
	
	if ( ( button == GLUT_LEFT_BUTTON ) && ( state == GLUT_DOWN ) )
		drag_mouse_l = 1;
	
	else if ( ( button == GLUT_LEFT_BUTTON ) && ( state == GLUT_UP ) )
		drag_mouse_l = 0;
 
	
	if ( ( button == GLUT_RIGHT_BUTTON ) && ( state == GLUT_DOWN ) )
		drag_mouse_r = 1;
	
	else if ( ( button == GLUT_RIGHT_BUTTON ) && ( state == GLUT_UP ) )
		drag_mouse_r = 0;
 
	
	if ( ( button == GLUT_MIDDLE_BUTTON ) && ( state == GLUT_DOWN ) )
		drag_mouse_m = 1;
	
	else if ( ( button == GLUT_MIDDLE_BUTTON ) && ( state == GLUT_UP ) )
		drag_mouse_m = 0;
 
	
	glutPostRedisplay();
 
	
	last_mouse_x = mx;
	last_mouse_y = my;
}
 
 
void  motion( int mx, int my )
{
	if ( drag_mouse_r )
	{
		camera_yaw -= ( mx - last_mouse_x ) * 1.0;
		if ( camera_yaw < 0.0 )
			camera_yaw += 360.0;
		else if ( camera_yaw > 360.0 )
			camera_yaw -= 360.0;
 
		camera_pitch -= ( my - last_mouse_y ) * 1.0;
		if ( camera_pitch < -90.0 )
			camera_pitch = -90.0;
		else if ( camera_pitch > 90.0 )
			camera_pitch = 90.0;
	}
	
	if ( drag_mouse_l )
	{
		
		camera_distance += ( my - last_mouse_y ) * 0.2;
		if ( camera_distance < 2.0 )
			camera_distance = 2.0;
	}
 
	
	last_mouse_x = mx;
	last_mouse_y = my;
 
	glutPostRedisplay();
}
 
 
/* Called back when GLUT idling */
void idle() {
 
}
 
/* Called back by GLUT when the window is resized */
void reshape(int w, int h)
{
 
   glViewport(0, 0, w, h);
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   
   gluPerspective(60,(GLfloat)w/(GLfloat)h,0.01,100.0);
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
 
   win_width = w;
   win_height = h;
 
}
 
/* Called by us in dorender() to init any OpenGL state */
void init(void)
{  
 
   glClearColor (0.0, 0.0, 0.0, 0.0);
 
}
 
 
 
void  initEnvironment( void )
{
 
	float  light0_position[] = { 10.0, 10.0, 10.0, 1.0 };
	float  light0_diffuse[] = { 0.8, 0.8, 0.8, 1.0 };
	float  light0_specular[] = { 1.0, 1.0, 1.0, 1.0 };
	float  light0_ambient[] = { 0.1, 0.1, 0.1, 1.0 };
	glLightfv( GL_LIGHT0, GL_POSITION, light0_position );
	glLightfv( GL_LIGHT0, GL_DIFFUSE, light0_diffuse );
	glLightfv( GL_LIGHT0, GL_SPECULAR, light0_specular );
	glLightfv( GL_LIGHT0, GL_AMBIENT, light0_ambient );
	glEnable( GL_LIGHT0 );
 
	
	glEnable( GL_LIGHTING );
 
	
	glEnable( GL_COLOR_MATERIAL );
 
	
	glEnable( GL_DEPTH_TEST );
 
	
	glCullFace( GL_BACK );
	glEnable( GL_CULL_FACE );
 
	glClearColor( 0.5, 0.5, 0.8, 0.0 );
 
}
 
 
 
 
 
/* Called when GLUT wants to repaint the screen */
void  display( void )
{
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
 
    glMatrixMode( GL_MODELVIEW );
	glLoadIdentity();
	glTranslatef( 0.0, 0.0, - camera_distance );
	glRotatef( - camera_pitch, 1.0, 0.0, 0.0 );
	glRotatef( - camera_yaw, 0.0, 1.0, 0.0 );
	glTranslatef( 0.0, -0.5, 0.0 );
 
	float  light0_position[] = { 10.0, 10.0, 10.0, 1.0 };
	glLightfv( GL_LIGHT0, GL_POSITION, light0_position );
 
	
	float  size = 1.5f;
	int  num_x = 10, num_z = 10;
	double  ox, oz;
	glBegin( GL_QUADS );
		glNormal3d( 0.0, 1.0, 0.0 );
		ox = -(num_x * size) / 2;
		for ( int x=0; x<num_x; x++, ox+=size )
		{
			oz = -(num_z * size) / 2;
			for ( int z=0; z<num_z; z++, oz+=size )
			{
				if ( ((x + z) % 2) == 0 )
					glColor3f( 1.0, 1.0, 1.0 );
				else
					glColor3f( 0.8, 0.8, 0.8 );
				glVertex3d( ox, 0.0, oz );
				glVertex3d( ox, 0.0, oz+size );
				glVertex3d( ox+size, 0.0, oz+size );
				glVertex3d( ox+size, 0.0, oz );
			}
		}
	glEnd();
   /**********
	*	glColor3f( 1.0f, 0.0f, 0.0f );
	*	if ( asf )
	*		asf->RenderFigure( frame_no, 0.02f );
	*
	*	
	*	char  message[ 64 ];
	*	if ( asf )
	*		sprintf( message, "%.2f (%d)", animation_time, frame_no );
	*	else
	*		sprintf( message, "Press 'L' key to Load ASF/AMC file" );
	*	drawMessage( 0, message );
	*
	*********/
	
    glutSwapBuffers();
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
//neader :
 
 
 
 
#ifdef WIN32
	#include "windows.h"
	#define strcasecmp stricmp
#endif
 
#include "GL/gl.h"
#include "GL/glut.h"
 
#include <math.h>
 
#include "parser.h"
 
void dorender(int argc, char** argv, SKELETON* skel, MOCAP* mo, int delay);
 
/* GLUT callbacks */
void keyboard(unsigned char key, int x, int y);
void reshape(int w, int h);
void init(void);
void initEnvironment(void);
void display(void);
void idle(void);
void mouse(int button, int state, int mx, int my )
 
#endif

Open in new window

Avatar of sunnycoder
which compiler/platform? Can you give exact error message and point out the line at which it is indicating the error ... normally this error is seen on old C function definitions where parameter types were declared after function signature.
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
good catch I08
K&R style function parameters cause a lot of difficult to pinpoint errors (like this one).