Rectangle* Rectangle::Create(Scalar Width, Scalar Height) { static const Scalar Normals[] = { 0, 0, +1.0f, 0, 0, +1.0f, 0, 0, +1.0f, 0, 0, +1.0f }; static const int Indices[] = { 0, 1, 2, 0, 2, 3 }; static const Scalar TexCoords[] = { 0, 0, 0, 1, 1, 1, 1, 0 }; Rectangle* R = new Rectangle; R->Width = Width; R->Height = Height; if(R->CreateBuffers() != BGE_SUCCESS) { delete R; return NULL; } if(R->SetDimensions(Width, Height) != BGE_SUCCESS) { delete R; return NULL; } if(R->SetNormalData(4, Normals) == BGE_FAILURE) { Log("Rectangle: Error setting Rectangle normal data\n"); delete R; return NULL; } if(R->SetTexCoordData(4, TexCoords) == BGE_FAILURE) { Log("Rectangle: Error setting Rectangle texture coordinate data\n"); delete R; return NULL; } if(R->SetIndexData(2, Indices) == BGE_FAILURE) { Log("Rectangle: Error setting Rectangle triangle indices data\n"); delete R; return NULL; } R->Unbind(); return R; }