Game Development Community

GlEnable(AUTO_NORMAL); //problem

by Altair M. Martinez · in Technical Issues · 09/19/2005 (2:08 pm) · 2 replies

Hi there i got a problem with my autonormals set up, when i compile it says...

program.cpp(541) : error C2065: 'AUTO_NORMAL' : undeclared identifier

my program function that calls this is...

void renderBunny(void)
{
	runonce = 1; /////Altair 9-4-05
	FILE *model=fopen("bunny.dat","rb");
	if (!model)
	{
		printf("error loading model\n");
		exit(-1);
	}
	
	fread(&bunny_vertex_count,sizeof(float),1,model);

	bunny_mesh=new float[3*bunny_vertex_count];
	fread(bunny_mesh,sizeof(float),3*bunny_vertex_count,model);

	fclose(model);

	glEnable(AUTO_NORMAL);
	glColor3ub(255,255,255);
	glInterleavedArrays( GL_V3F, 0, bunny_mesh );
	glDrawArrays( GL_TRIANGLES, 0, bunny_vertex_count );
}

in my header i have included...

#include <gl/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <Cg/cgGL.h>

what seems to be my problem?
do i need to set up something else?

Thanks!!!

#1
09/19/2005 (2:14 pm)
By the way, I just want my normals coz when i call this function i it doesn't generate the normals for my bunny mesh so the shading is incorrect.

I hack it sometime using the vertex as the normal just to see if there are no other problems. And i'm glad there aren't any.

Except for my missing normals, that is. So i thought it would be easier to use glEnable(AUTO_NORMALS); so it could generate the normals for me. Seeing this function/program, are there any other ways to get my normals from these vertex points in my bunny mesh?

Thanks again!!!
#2
09/19/2005 (3:34 pm)
Double check the spelling of AUTO_NORMALS

And double check in the red book the best way to implement it


BTW, it is best to precalculate the normals as AUTO normals is calculating them at run time. It is fine for a few thousand polys on screen but having heaps of them will be a problem.