VertexArrayObjectLoadStore.cc 1.29 KB
Newer Older
1
2
3
4
5
6
7
8
/***********************************************************************
 * Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
 * All rights reserved.                                                *
 * Distributed under the terms of the MIT License (see LICENSE.TXT).   *
 **********************************************************************/

#include <ACGL/OpenGL/Data/VertexArrayObjectLoadStore.hh>
#include <ACGL/OpenGL/Data/ArrayBufferLoadStore.hh>
9
#include <ACGL/Base/FileHelpers.hh>
10
11
12
13
14
15
16
17
18
19

using namespace ACGL;
using namespace ACGL::OpenGL;
using namespace ACGL::Utils;

namespace ACGL{
namespace OpenGL{

SharedVertexArrayObject loadVertexArrayObject(const std::string& _filename)
{
20
21
22
23
    // lower case file ending:
    std::string fileEnding = Base::FileHelpers::getFileEnding(_filename);

    if(fileEnding == "vao")
24
    {
25
        return loadVertexArrayObjectVAO(_filename);
26
27
28
    }
    else
    {
29
30
31
32
33
34
35
36
37
38
39
40
        // Generic load: Try to load the file as an ArrayBuffer and attach it to a VAO
        SharedArrayBuffer ab = loadArrayBuffer(_filename);
        if(ab)
        {
            SharedVertexArrayObject vao(new VertexArrayObject);
            vao->attachAllAttributes(ab);
            return vao;
        }
        else
        {
            return SharedVertexArrayObject();
        }
41
    }
42
43
44
45
}

}
}