In the cube VA example change GLubyte to GLuint and GL_UNSIGNED_BYTE to 
GL_UNSIGNED_INT, no more crashes (don’t ask me why)
VBOs and vertexarrays are working, tested on stanford models within custom 
tool...
check attachment

From: Steven Caron 
Sent: Thursday, August 02, 2012 6:59 PM
To: softimage@listproc.autodesk.com 
Subject: SDK : using vertex arrays in a custom tool?

hey brent! 

i was reading about vertex arrays... 
http://www.songho.ca/opengl/gl_vertexarray.html

i tried to implement this and got crashes, before i investigate further are 
these even usable? or is custom tools restricted to immediate mode?

how about VBOs and display lists? any restrictions with these open gl features?

thanks!
steven
#ifndef OGL_PRIMITIVES_H_INCLUDED
#define OGL_PRIMITIVES_H_INCLUDED

#ifndef linux
#define WIN32_LEAN_AND_MEAN
#include <windows.h> // Needed for OpenGL on windows
#endif

#include <xsi_longarray.h>
#include <xsi_doublearray.h>
#include <xsi_math.h>
#include <xsi_floatarray.h>
#include <xsi_polygonmesh.h>
#include <xsi_primitive.h>
#include <xsi_geometry.h>
#include <xsi_geometryaccessor.h>
#include <ppl.h>
#include <concurrent_vector.h>

using namespace XSI;
using namespace XSI::MATH;

void ogl_getXSIpolymeshArrays(X3DObject& in_obj,LONG &out_indiciesCount, 
CLongArray& out_indices, CDoubleArray& out_positions, CFloatArray& out_normals);

#define NFACE 6
#define NVERT 8

static void ogl_drawRoundedRectangle(int x,int y,int w,int h,int radius)
{
        glBegin(GL_POLYGON);
                glVertex2i(x+radius,y);
                glVertex2i(x+w-radius,y);
                for(float i=(float)PI*1.5f;i<PI*2;i+=0.1f)
                        
glVertex2f(x+w-radius+cos(i)*radius,y+radius+sin(i)*radius);
                glVertex2i(x+w,y+radius);
                glVertex2i(x+w,y+h-radius);
                for(float i=0;i<(float)PI*0.5f;i+=0.1f)
                        
glVertex2f(x+w-radius+cos(i)*radius,y+h-radius+sin(i)*radius);
                glVertex2i(x+w-radius,y+h);
                glVertex2i(x+radius,y+h);
                for(float i=(float)PI*0.5f;i<PI;i+=0.1f)
                        
glVertex2f(x+radius+cos(i)*radius,y+h-radius+sin(i)*radius);
                glVertex2i(x,y+h-radius);
                glVertex2i(x,y+radius);
                for(float i=(float)PI;i<PI*1.5f;i+=0.1f)
                        
glVertex2f(x+radius+cos(i)*radius,y+radius+sin(i)*radius);
        glEnd();
}

static void ogl_drawLinedRoundedRectangle(int x,int y,int w,int h,int 
radius,double line_width) 
{  

        glLineWidth((GLfloat)line_width);
        glBegin(GL_LINE_STRIP);
                for(float i=(float)PI;i<=1.5f*PI;i+=0.1f)
                        
glVertex2f(radius*cos(i)+x+radius,radius*sin(i)+y+radius);
                for(float i=1.5f*(float)PI;i<=2*PI; i+=0.1f)
                        
glVertex2f(radius*cos(i)+x+w-radius,radius*sin(i)+y+radius);
                for(float i=0;i<=0.5f*PI; i+=0.1f)
                        
glVertex2f(radius*cos(i)+x+w-radius,radius*sin(i)+y+h-radius);
                for(float i=0.5f*(float)PI;i<=PI;i+=0.1f) 
                        
glVertex2f(radius*cos(i)+x+radius,radius*sin(i)+y+h-radius);
                glVertex2i(x,y+radius);
        glEnd();
}

static void ogl_drawCube(GLfloat size)
{

        typedef GLfloat point3[3];
        int numCubeVerts = 8;

        const point3 vertices [] = {
                 {-size, -size, size},
                 {size, -size, size},
                 {size, size, size},
                 {-size, size, size},
                 {size, -size, -size},
                 {-size, -size, -size},
                 {-size, size, -size},
                 {size, size, -size},
         };


        const GLuint indices [][3] = {
                 {0, 1, 2},
                 {0, 2, 3},
                 {4, 5, 6},
                 {4, 6, 7},
                 {5, 0, 3},
                 {5, 3, 6},
                 {1, 4, 7},
                 {1, 7, 2},
                 {5, 4, 1},
                 {5, 1, 0},
                 {3, 2, 7},
                 {3, 7, 6},
        };

        const point3 normals [] = {
                 {-0.408248290463863, -0.408248290463863, 0.816496580927726},
                 {0.666666666666667, -0.666666666666667, 0.333333333333333},
                 {0.408248290463863, 0.408248290463863, 0.816496580927726},
                 {-0.666666666666667, 0.666666666666667, 0.333333333333333},
                 {0.408248290463863, -0.408248290463863, -0.816496580927726},
                 {-0.666666666666667, -0.666666666666667, -0.333333333333333},
                 {-0.408248290463863, 0.408248290463863, -0.816496580927726},
                 {0.666666666666667, 0.666666666666667, -0.333333333333333},
        };

        glEnableClientState (GL_VERTEX_ARRAY);
        glEnableClientState(GL_NORMAL_ARRAY);
        glVertexPointer (3, GL_FLOAT, 0, vertices); 
        glNormalPointer(GL_FLOAT, 0, normals);
        glDrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_INT, indices); 
        glDisableClientState (GL_VERTEX_ARRAY);
        glDisableClientState(GL_NORMAL_ARRAY);

}

static void __constructCircle (LONG in_segments, double in_r, CDoubleArray 
&out_points) 
{
        out_points.Clear();
        int i = 0;
        const double kRadianIncr = 6.28f/in_segments;
        for (i = 0; i < in_segments; i++)
        {
                double angleRadians = kRadianIncr*i;
                out_points.Add(in_r * cos(angleRadians));
                out_points.Add(in_r * sin(angleRadians));
        }
}
static void ogl_drawCircle(GLdouble rad,LONG in_segments, bool smoothdraw)
{
        CDoubleArray circle;
                
        __constructCircle(in_segments,rad, circle);
        if(smoothdraw){
                glEnable(GL_LINE_SMOOTH);
        }
        glBegin(GL_LINE_LOOP);
                for(int i=0;i<circle.GetCount();i+=2)
                        glVertex3d(circle[i],0,circle[i+1]);
        glEnd();
        if(smoothdraw){
                glDisable(GL_LINE_SMOOTH);
        }
}

static void ogl_drawDisc(GLubyte colorCenter[4],GLubyte colorOuter[4],GLdouble 
rad,LONG in_segments, bool smoothdraw)
{
        CDoubleArray circle;
                
        __constructCircle(in_segments,rad, circle);
        if(smoothdraw){
                glEnable(GL_LINE_SMOOTH);
        }
        glBegin(GL_TRIANGLE_FAN);
                
glColor4ub(colorCenter[0],colorCenter[1],colorCenter[2],colorCenter[3]);
                glVertex3d(0,0,0);
                
glColor4ub(colorOuter[0],colorOuter[1],colorOuter[2],colorOuter[3]);
                for(int i=0;i<circle.GetCount();i+=2)
                        glVertex3d(circle[i],0,circle[i+1]);
                glVertex3d(circle[0],0,circle[1]); //1st point
        glEnd();
        if(smoothdraw){
                glDisable(GL_LINE_SMOOTH);
        }
}
static void ogl_drawLine(double start[3], double end[3], bool smoothdraw)
{
        if(smoothdraw){
                glEnable(GL_LINE_SMOOTH);
        }
        glBegin(GL_LINES);
                glVertex3d(start[0],start[1],start[2]);
                glVertex3d(end[0],end[1],end[2]);
        glEnd();
        if(smoothdraw){
                glDisable(GL_LINE_SMOOTH);
        }
}
static void ogl_drawLine(double sx, double sy, double sz, double ex,double ey, 
double ez, bool smoothdraw)
{
        if(smoothdraw){
        glEnable(GL_LINE_SMOOTH); }
        glBegin(GL_LINES);
                glVertex3d(sx,sy,sz);
                glVertex3d(ex,ey,ez);   
        glEnd();
        if(smoothdraw){
        glDisable(GL_LINE_SMOOTH);
        }
}
//draw polymesh with gldrawelements
static void ogl_drawXSIpolymesh(X3DObject &in_obj)
{
        if(in_obj.IsValid())
        {
                CLongArray indices;
                CDoubleArray positions;
                CFloatArray normals;

                LONG indiciesCnt;
                ogl_getXSIpolymeshArrays(in_obj, indiciesCnt,indices, 
positions, normals);
                const LONG              *ind_ptr=indices.GetArray();
                const double    *pos_ptr=positions.GetArray();          
                const float             *nor_ptr=normals.GetArray();

                glEnableClientState (GL_VERTEX_ARRAY);
                glEnableClientState (GL_NORMAL_ARRAY);
                glNormalPointer(GL_FLOAT,0, nor_ptr);
                glVertexPointer (3, GL_DOUBLE, 0, pos_ptr); 
                glDrawElements (GL_TRIANGLES, indiciesCnt, GL_UNSIGNED_INT , 
ind_ptr); 
                glDisableClientState (GL_NORMAL_ARRAY);
                glDisableClientState (GL_VERTEX_ARRAY);

        }
}

static void ogl_drawXSIpolymesh(LONG indicesCount,const LONG *indicesPtr,const 
double *positionsPtr, const float *normalsPtr)
{
        glEnableClientState (GL_VERTEX_ARRAY);
        glEnableClientState (GL_NORMAL_ARRAY);
        glNormalPointer(GL_FLOAT,0, normalsPtr);
        glVertexPointer (3, GL_DOUBLE, 0, positionsPtr); 
        glDrawElements (GL_TRIANGLES, indicesCount, GL_UNSIGNED_INT , 
indicesPtr); 
        glDisableClientState (GL_NORMAL_ARRAY);
        glDisableClientState (GL_VERTEX_ARRAY);
}
//buffered draw
static GLuint createVBO(const void* data, int dataSize, GLenum target, GLenum 
usage)
{
    GLuint id = 0;  // 0 is reserved, glGenBuffersARB() will return non-zero id 
if success

    glGenBuffers(1, &id);                        // create a vbo
    glBindBuffer(target, id);                    // activate vbo id to use
    glBufferData(target, dataSize, data, usage); // upload data to video card

    // check data size in VBO is same as input array, if not return 0 and 
delete VBO
    int bufferSize = 0;
    glGetBufferParameteriv(target, GL_BUFFER_SIZE, &bufferSize);
    if(dataSize != bufferSize)
    {
        glDeleteBuffers(1, &id);
        id = 0;
    }
    return id;      // return VBO id
}
static void ogl_deleteBuffers(GLuint &out_vboInd,GLuint &out_vboNormalsInd)
{
        glDeleteBuffers(1, &out_vboInd);
    glDeleteBuffers(1, &out_vboNormalsInd);
}

static void ogl_createBuffers(X3DObject& in_obj,GLuint &out_vboInd,GLuint 
&out_vboNormalsInd, LONG& indiciesCount, CLongArray& indices, CDoubleArray& 
positions, CFloatArray& normals)
{
        ogl_getXSIpolymeshArrays(in_obj,indiciesCount, indices, positions, 
normals);
        int bufferSize;
        glGenBuffers(1, &out_vboInd);

    glBindBuffer(GL_ARRAY_BUFFER, out_vboInd);
        glBufferData(GL_ARRAY_BUFFER, 
(positions.GetCount()*sizeof(double)+normals.GetCount()*sizeof(float)), 0, 
GL_STATIC_DRAW);
        glBufferSubData(GL_ARRAY_BUFFER, 0, 
positions.GetCount()*sizeof(double), positions.GetArray());
        glBufferSubData(GL_ARRAY_BUFFER, 
positions.GetCount()*sizeof(double),normals.GetCount()*sizeof(float), 
normals.GetArray());
    glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &bufferSize);
        out_vboNormalsInd = createVBO(indices.GetArray(), 
indices.GetCount()*sizeof(LONG), GL_ELEMENT_ARRAY_BUFFER, GL_STATIC_DRAW);
        glGetBufferParameteriv(GL_ELEMENT_ARRAY_BUFFER, GL_BUFFER_SIZE, 
&bufferSize);
}

static void ogl_drawXSIpolymeshBuffered(X3DObject& in_obj, GLuint 
&in_vboInd,GLuint &in_vboNormalsInd,LONG& indiciesCount, CLongArray& indices, 
CDoubleArray& positions, CFloatArray& normals)
{
        glBindBuffer(GL_ARRAY_BUFFER, in_vboInd);
         // before draw, specify vertex and index arrays with their offsets
    glNormalPointer(GL_FLOAT, 0, (void*)(positions.GetCount()*sizeof(double)));
    glVertexPointer(3, GL_DOUBLE, 0, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, in_vboNormalsInd);
    glIndexPointer(GL_INT, 0, 0);
///draw

        glEnableClientState (GL_VERTEX_ARRAY);
        glEnableClientState (GL_NORMAL_ARRAY);

        glDrawElements (GL_TRIANGLES, indiciesCount, GL_UNSIGNED_INT ,(GLuint*) 
0); 
        glDisableClientState (GL_NORMAL_ARRAY);
        glDisableClientState (GL_VERTEX_ARRAY);

///
    // it is good idea to release VBOs with ID 0 after use.
    // Once bound with 0, all pointers in gl*Pointer() behave as real
    // pointer, so, normal vertex array operations are re-activated
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
   
}
//dump polymesh data to array
static void ogl_getXSIpolymeshArrays(X3DObject& in_obj,LONG& out_indiciesCount, 
CLongArray& out_indices, CDoubleArray& out_positions, CFloatArray& out_normals)
{
        if(in_obj.IsValid())
        {               
                PolygonMesh p(in_obj.GetActivePrimitive().GetGeometry() );
                CGeometryAccessor cgeo = 
p.GetGeometryAccessor(siConstructionModeModeling,siCatmullClark,0,false,false,0);
                
                CLongArray      trinodeInd;     
                CFloatArray normals;
                cgeo.GetTriangleNodeIndices(trinodeInd);        
                cgeo.GetTriangleVertexIndices(out_indices);
                cgeo.GetVertexPositions(out_positions);
                cgeo.GetNodeNormals(normals);
        
                out_normals.Resize( normals.GetCount() );
                
                //remap for opengl...
                //multicore loop
                //for(int i=0;i<trinodeInd.GetCount();i++)
                Concurrency::parallel_for( 0, (int) trinodeInd.GetCount(),1, 
[&] (int i)        
                
                {
                        LONG nodeInd =  trinodeInd[ i ];
                        LONG posInd  = out_indices[ i ];
                        out_normals[posInd*3 ] = normals[nodeInd*3];
                        out_normals[posInd*3+1 ] = normals[nodeInd*3+1];
                        out_normals[posInd*3+2 ] = normals[nodeInd*3+2];        
                }       );
                
                out_indiciesCount = out_indices.GetCount();
        }
}

static void ogl_drawCone()
{
        GLuint coneNumVerts = 111;

float coneVerts [] = {
  // # Hierarchy (from self to top father)
  -0.23492325, -0.05, -0.085505,
  -0.23492325, -0.05, -0.085505,
  -0.23492325, -0.05, -0.085505,
  // f 4//1 3//2 1//3 
  -0.23492325, -0.05, 0.085505,
  -0.25, -0.05, -1.38777878078145e-018,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 3//4 4//5 2//6 
  -0.25, -0.05, -1.38777878078145e-018,
  -0.23492325, -0.05, 0.085505,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 5//7 4//8 1//9 
  -0.191511, -0.05, 0.160697,
  -0.23492325, -0.05, 0.085505,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 4//10 5//11 2//12 
  -0.23492325, -0.05, 0.085505,
  -0.191511, -0.05, 0.160697,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 6//13 5//14 1//15 
  -0.125, -0.05, 0.21650625,
  -0.191511, -0.05, 0.160697,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 5//16 6//17 2//18 
  -0.191511, -0.05, 0.160697,
  -0.125, -0.05, 0.21650625,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 7//19 6//20 1//21 
  -0.043412, -0.05, 0.246202,
  -0.125, -0.05, 0.21650625,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 6//22 7//23 2//24 
  -0.125, -0.05, 0.21650625,
  -0.043412, -0.05, 0.246202,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 8//25 7//26 1//27 
  0.043412, -0.05, 0.246202,
  -0.043412, -0.05, 0.246202,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 7//28 8//29 2//30 
  -0.043412, -0.05, 0.246202,
  0.043412, -0.05, 0.246202,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 9//31 8//32 1//33 
  0.125, -0.05, 0.21650625,
  0.043412, -0.05, 0.246202,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 8//34 9//35 2//36 
  0.043412, -0.05, 0.246202,
  0.125, -0.05, 0.21650625,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 10//37 9//38 1//39 
  0.191511, -0.05, 0.160697,
  0.125, -0.05, 0.21650625,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 9//40 10//41 2//42 
  0.125, -0.05, 0.21650625,
  0.191511, -0.05, 0.160697,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 11//43 10//44 1//45 
  0.23492325, -0.05, 0.085505,
  0.191511, -0.05, 0.160697,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 10//46 11//47 2//48 
  0.191511, -0.05, 0.160697,
  0.23492325, -0.05, 0.085505,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 12//49 11//50 1//51 
  0.25, -0.05, -1.38777878078145e-018,
  0.23492325, -0.05, 0.085505,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 11//52 12//53 2//54 
  0.23492325, -0.05, 0.085505,
  0.25, -0.05, -1.38777878078145e-018,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 13//55 12//56 1//57 
  0.23492325, -0.05, -0.085505,
  0.25, -0.05, -1.38777878078145e-018,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 12//58 13//59 2//60 
  0.25, -0.05, -1.38777878078145e-018,
  0.23492325, -0.05, -0.085505,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 14//61 13//62 1//63 
  0.191511, -0.05, -0.160697,
  0.23492325, -0.05, -0.085505,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 13//64 14//65 2//66 
  0.23492325, -0.05, -0.085505,
  0.191511, -0.05, -0.160697,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 15//67 14//68 1//69 
  0.125, -0.05, -0.21650625,
  0.191511, -0.05, -0.160697,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 14//70 15//71 2//72 
  0.191511, -0.05, -0.160697,
  0.125, -0.05, -0.21650625,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 16//73 15//74 1//75 
  0.043412, -0.05, -0.246202,
  0.125, -0.05, -0.21650625,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 15//76 16//77 2//78 
  0.125, -0.05, -0.21650625,
  0.043412, -0.05, -0.246202,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 17//79 16//80 1//81 
  -0.043412, -0.05, -0.246202,
  0.043412, -0.05, -0.246202,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 16//82 17//83 2//84 
  0.043412, -0.05, -0.246202,
  -0.043412, -0.05, -0.246202,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 18//85 17//86 1//87 
  -0.125, -0.05, -0.21650625,
  -0.043412, -0.05, -0.246202,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 17//88 18//89 2//90 
  -0.043412, -0.05, -0.246202,
  -0.125, -0.05, -0.21650625,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 19//91 18//92 1//93 
  -0.191511, -0.05, -0.160697,
  -0.125, -0.05, -0.21650625,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 18//94 19//95 2//96 
  -0.125, -0.05, -0.21650625,
  -0.191511, -0.05, -0.160697,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 20//97 19//98 1//99 
  -0.23492325, -0.05, -0.085505,
  -0.191511, -0.05, -0.160697,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 19//100 20//101 2//102 
  -0.191511, -0.05, -0.160697,
  -0.23492325, -0.05, -0.085505,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
  // f 3//103 20//104 1//105 
  -0.25, -0.05, -1.38777878078145e-018,
  -0.23492325, -0.05, -0.085505,
  -1.38777878078145e-018, -0.05, -1.38777878078145e-018,
  // f 20//106 3//107 2//108 
  -0.23492325, -0.05, -0.085505,
  -0.25, -0.05, -1.38777878078145e-018,
  -1.38777878078145e-018, 0.95, -1.38777878078145e-018,
};

float coneNormals [] = {
  // # Hierarchy (from self to top father)
  0, 1, -0,
  0, 1, -0,
  0, 1, -0,
  // f 4//1 3//2 1//3 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 3//4 4//5 2//6 
  -0.970142441321808, 0.242535860330308, 0,
  -0.911635791848047, 0.242535944622259, 0.331807924238969,
  0, 1, -0,
  // f 5//7 4//8 1//9 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 4//10 5//11 2//12 
  -0.911635791848047, 0.242535944622259, 0.331807924238969,
  -0.74317188700221, 0.242535963122895, 0.623595905183497,
  0, 1, -0,
  // f 6//13 5//14 1//15 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 5//16 6//17 2//18 
  -0.74317188700221, 0.242535963122895, 0.623595905183497,
  -0.485071035274124, 0.242536017637099, 0.840168061096604,
  0, 1, -0,
  // f 7//19 6//20 1//21 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 6//22 7//23 2//24 
  -0.485071035274124, 0.242536017637099, 0.840168061096604,
  -0.168462974993274, 0.242535963997843, 0.955403858179384,
  0, 1, -0,
  // f 8//25 7//26 1//27 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 7//28 8//29 2//30 
  -0.168462974993274, 0.242535963997843, 0.955403858179384,
  0.168462974993274, 0.242535963997843, 0.955403858179384,
  0, 1, -0,
  // f 9//31 8//32 1//33 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 8//34 9//35 2//36 
  0.168462974993274, 0.242535963997843, 0.955403858179384,
  0.485071035274124, 0.242536017637099, 0.840168061096604,
  0, 1, -0,
  // f 10//37 9//38 1//39 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 9//40 10//41 2//42 
  0.485071035274124, 0.242536017637099, 0.840168061096604,
  0.74317188700221, 0.242535963122895, 0.623595905183497,
  0, 1, -0,
  // f 11//43 10//44 1//45 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 10//46 11//47 2//48 
  0.74317188700221, 0.242535963122895, 0.623595905183497,
  0.911635791848047, 0.242535944622259, 0.331807924238969,
  0, 1, -0,
  // f 12//49 11//50 1//51 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 11//52 12//53 2//54 
  0.911635791848047, 0.242535944622259, 0.331807924238969,
  0.970142441321808, 0.242535860330308, 0,
  0, 1, -0,
  // f 13//55 12//56 1//57 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 12//58 13//59 2//60 
  0.970142441321808, 0.242535860330308, 0,
  0.911635791848047, 0.242535944622259, -0.331807924238969,
  0, 1, -0,
  // f 14//61 13//62 1//63 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 13//64 14//65 2//66 
  0.911635791848047, 0.242535944622259, -0.331807924238969,
  0.74317188700221, 0.242535963122895, -0.623595905183497,
  0, 1, -0,
  // f 15//67 14//68 1//69 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 14//70 15//71 2//72 
  0.74317188700221, 0.242535963122895, -0.623595905183497,
  0.485071035274124, 0.242536017637099, -0.840168061096604,
  0, 1, -0,
  // f 16//73 15//74 1//75 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 15//76 16//77 2//78 
  0.485071035274124, 0.242536017637099, -0.840168061096604,
  0.168462974993274, 0.242535963997843, -0.955403858179384,
  0, 1, -0,
  // f 17//79 16//80 1//81 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 16//82 17//83 2//84 
  0.168462974993274, 0.242535963997843, -0.955403858179384,
  -0.168462974993274, 0.242535963997843, -0.955403858179384,
  0, 1, -0,
  // f 18//85 17//86 1//87 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 17//88 18//89 2//90 
  -0.168462974993274, 0.242535963997843, -0.955403858179384,
  -0.485071035274124, 0.242536017637099, -0.840168061096604,
  0, 1, -0,
  // f 19//91 18//92 1//93 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 18//94 19//95 2//96 
  -0.485071035274124, 0.242536017637099, -0.840168061096604,
  -0.74317188700221, 0.242535963122895, -0.623595905183497,
  0, 1, -0,
  // f 20//97 19//98 1//99 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 19//100 20//101 2//102 
  -0.74317188700221, 0.242535963122895, -0.623595905183497,
  -0.911635791848047, 0.242535944622259, -0.331807924238969,
  0, 1, -0,
  // f 3//103 20//104 1//105 
  0, -1, 0,
  0, -1, 0,
  0, -1, 0,
  // f 20//106 3//107 2//108 
  -0.911635791848047, 0.242535944622259, -0.331807924238969,
  -0.970142441321808, 0.242535860330308, 0,
  0, 1, -0,
};


        glEnableClientState (GL_VERTEX_ARRAY);
        glEnableClientState(GL_NORMAL_ARRAY);
        
        glVertexPointer (3, GL_FLOAT, 0, coneVerts); 
        glNormalPointer(GL_FLOAT, 0, coneNormals);

        glDrawArrays(GL_TRIANGLES, 0, coneNumVerts);
        
        glDisableClientState (GL_VERTEX_ARRAY);
        glDisableClientState(GL_NORMAL_ARRAY);


}







#endif

Reply via email to