Files
Hoops_Exchange/exchange/exchangesource/MeshViewer/application/render/vao.cpp
2025-12-15 23:22:33 +08:00

40 lines
1.3 KiB
C++

/***********************************************************************************************************************
*
* Copyright (c) 2010 - 2025 by Tech Soft 3D, Inc.
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
* employees of Tech Soft 3D, Inc. is granted only under a written non-disclosure agreement, expressly prescribing the
* scope and manner of such use.
*
***********************************************************************************************************************/
#include "vao.h"
VAO::VAO()
{
glGenVertexArrays(1, &id);
}
void VAO::LinkAttrib(VBO& vbo, GLuint layout, GLuint numComponents, GLenum type, GLsizei stride, void* offset)
{
vbo.Bind();
glVertexAttribPointer(layout, numComponents, type, GL_FALSE, stride, offset);
glEnableVertexAttribArray(layout);
vbo.Unbind();
}
void VAO::Bind()
{
glBindVertexArray(id);
}
void VAO::Unbind()
{
glBindVertexArray(0);
}
void VAO::Delete()
{
glDeleteVertexArrays(1, &id);
}