예제 #1
0
VBO* VBO::CreateIndex(const GLenum type) {
    VBO* indexBuffer = new VBO();

    indexBuffer->SetTarget(GL_ELEMENT_ARRAY_BUFFER);
    indexBuffer->SetType(type);
    indexBuffer->SetUsage(GL_STATIC_DRAW);

    return indexBuffer;
}
예제 #2
0
VBO* VBO::CreateInterleaved(const std::vector<GLuint>& sizes, const GLenum usage){

    VBO* buffer = new VBO();

    buffer->SetTarget(GL_ARRAY_BUFFER);
    buffer->SetType(GL_FLOAT);
    buffer->SetUsage(usage);

    buffer->m_sizes = sizes;

    buffer->m_offsets.reserve(sizes.size());

    GLuint totalOffset = 0;
    for(size_t i = 0; i <buffer->m_sizes.size(); ++i) {

	buffer->m_offsets.push_back(totalOffset);
        totalOffset += buffer->m_sizes[i] * sizeof(GLfloat);


    }
    buffer->STRIDE = totalOffset;

    return buffer;
}