Ignore:
Timestamp:
06/22/08 05:24:22 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp

    r2786 r2795  
    1919mVboId(-1) 
    2020{ 
     21        mHasTexture = (mTexCoords != NULL); 
     22 
    2123        Prepare(); 
    2224 
    2325        if (delData) 
    2426        { 
    25                 delete [] mVertices; mVertices = NULL; 
    26                 delete [] mNormals;  mNormals = NULL; 
    27                 //if (mTexCoords) delete [] mTexCoords; mTexCoords = NULL; 
     27                DEL_ARRAY_PTR(mVertices); 
     28                DEL_ARRAY_PTR(mNormals); 
     29                DEL_ARRAY_PTR(mTexCoords); 
    2830        } 
    2931} 
     
    3234Geometry::~Geometry() 
    3335{ 
    34         if (mVertices) delete [] mVertices;      
    35         if (mNormals) delete [] mNormals; 
    36         if (mTexCoords) delete [] mTexCoords; 
     36        DEL_ARRAY_PTR(mVertices); 
     37        DEL_ARRAY_PTR(mNormals); 
     38        DEL_ARRAY_PTR(mTexCoords); 
    3739 
    3840        // delete vbo 
     
    6567 
    6668        glGenBuffersARB(1, &mVboId); 
    67          
    6869        glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVboId); 
    6970 
     
    9394        { 
    9495                glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVboId); 
    95                 glVertexPointer(3, GL_FLOAT, 0, (char *)NULL);   
     96                 
     97                if (mHasTexture) 
     98                        glTexCoordPointer(2, GL_FLOAT, 0, (char *)NULL + 2 * mNumVertices * sizeof(Vector3)); 
     99 
    96100                glNormalPointer(GL_FLOAT, 0, (char *)NULL + mNumVertices * sizeof(Vector3)); 
    97101 
    98                 if (mTexCoords) 
    99                         glTexCoordPointer(2, GL_FLOAT, 0, (char *)NULL + 2 * mNumVertices * sizeof(Vector3)); 
     102                glVertexPointer(3, GL_FLOAT, 0, (char *)NULL);   
    100103 
    101104                state->SetCurrentVboId(mVboId); 
Note: See TracChangeset for help on using the changeset viewer.