Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <=================== VertexObject.h ====================>
- #pragma once
- #include <stdio.h>
- #include <stdlib.h>
- #include <GL\glew.h>
- #include <GLFW\glfw3.h>
- class VertexObject
- {
- public:
- VertexObject ( );
- void SetArray ( GLfloat Points [] );
- void SetBuffer ( GLuint* VBO );
- GLfloat Points [ ] = {
- 1.0f , 0.0f , 1.0f,
- 0.0f , 1.0f , 1.0f,
- -1.0f , 0.0f , 1.0f
- };
- private:
- };
- <========================= VertexObjecct.cpp ==============================>
- #include "VertexObject.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <GL\glew.h>
- #include <GLFW\glfw3.h>
- void VertexObject::SetArray ( GLfloat Points [ ] )
- {
- //Generate Vertex Array Object
- GLuint vaoID1;
- //Generates an array for the VAO
- glGenVertexArrays ( 1 , &vaoID1 );
- //Assigns the array to the Vertex Array Object
- glBindVertexArray ( vaoID1 );
- //Fills in the array
- for ( int i = 0; i < sizeof ( Points ); i++ )
- {
- this->Points [ i ] = Points [ i ];
- }
- }
- void VertexObject::SetBuffer ( GLuint* VBO )
- {
- //Generate Vertex Buffer Object
- glGenBuffers ( 1 , VBO );
- glBindBuffer ( GL_ARRAY_BUFFER , *VBO );
- glBufferData ( GL_ARRAY_BUFFER ,sizeof(Points) , Points , GL_STATIC_DRAW );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement