glDrawArray (how do you code it?)

In short, I have a 3Dmax file I exported and wanted to simply display it. I had to remove textures… all stuff that might make it complicated.

So far I’ve done this… (its not working)


#include <glut.h>
#include "my_modeldata.h"



GLfloat gfPosX = 0.0;//they control animation
GLfloat gfDeltaX = .0001;//determins the rate of change

void Draw()
{
	glClear(GL_COLOR_BUFFER_BIT);
	
	glEnableClientState(GL_VERTEX_ARRAY);
	glDrawArrays(GL_TRIANGLE_STRIP,0,4);
	glVertexPointer(3,GL_FLOAT,0,vertArray);
	//"vertArray" is my exported object
	//from 3Dmax
		
	glutPostRedisplay();
	glutSwapBuffers();//double buffering
}

void Init()
{	glClearColor(0.0,0.0,0.0,0.0);//background
	glMatrixMode(GL_PROJECTION);//??do research on it
	glLoadIdentity();
	glOrtho(0.0, 1.0,0.0,1.0,-1.0,1.0);
	
	glEnableClientState(GL_NORMAL_ARRAY);
}

int main()
{
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(250, 250); 
	glutInitWindowPosition(250, 250);
	glutCreateWindow("ANIMATION AND LIGHTING");
	Init();
	glutDisplayFunc(Draw);
	glutMainLoop();
	return 0;
}


#define TRIANGLECOUNT 1024
#define VERTEXCOUNT 3072


//this is my header file with my 3d max object.



float vertArray[] = {

0.7,0,1.2,.............

using a debugger, I found out that the error occurs on “glDrawArrays(GL_TRIANGLE_STRIP,0,4);” (in the draw function)

You enable normal array but dont set glNormalPointer.

You have the order of your glDrawArrays and your glVertexPointer the wrong way around. The correct order should be EnableClientState, set *Pointer, then Draw.

thanks it got rid of that error but, my screen is just blank now

In “glDrawArray” what should be the first and last count, I’ve looked I’m kinda confused and the definition is currently confusing at the moment