   Confused Reagrding glvertexpointer
  I am having a problem reagrding glvertexpointer using with gldrawelementsBelow is my source code :load():vertex= new GLfloat[num_vert];for(int i=0;i<num_vetex;++i){fscanf(fp,"%f ",&vertex);}fscanf(fp,"%d\n",&num_index);index=new GLubyte[num_index];for(int j=0;j<num_index;j++){fscanf(fp,"%d \n",&index[j]);} Draw:glEnableClientState(GL_VERTEX_ARRAY);glVertexPointer(3,GL_FLOAT,0,vertex);glColor3f(1.0f,1.0f,0.0f);glDrawElements(GL_TRIANGLES,num_index,GL_UNSIGNED_BYTE,index);while vertex is GLfloat array and index is a GLubyte array which are declared globally if I use the above code it works fine and the primitve is rendered properly even if I change a code like below which logically is same, nothing is rendered on the screen. The only thing I change is the reading elemnet reversely and storing it reversly which should not make a difference in the way it is stored in buffer.the revised code is :load():vertex= new GLfloat[num_vert];for(int i=(num_vetex-1);i>=0;--i){fscanf(fp,"%f ",&vertex);}fscanf(fp,"%d\n",&num_index);index=new GLubyte[num_index];for(int j=(num_index-1);j>=0;--j){fscanf(fp,"%d \n",&index[j]);} Draw:glEnableClientState(GL_VERTEX_ARRAY);glVertexPointer(3,GL_FLOAT,0,vertex);glColor3f(1.0f,1.0f,0.0f);glDrawElements(GL_TRIANGLES,num_index,GL_UNSIGNED_BYTE,index);
  Hi brohan,Because you read one float value one at a time, the order of (x,y,z) might be swapped in the second code.The first code reads x, y, and z in order and store vertex array. But it seems to me that the second code reads the x-value(the first one) and puts it at last, which is actually z-value. So it looks like zyx zyx zyx ...in the array.