b494f68d0c
Now using GLFW3 instead of the custom window class. This library looks like it will make development much simpler and will make it so that I am less worried about my windows code breaking. Currently setup the http://antongerdelan.net/opengl/hellotriangle.html tutorial in the MySimpleScene. Will probably create another scene file to try to get the object oriented stuff working.
57 lines
979 B
C++
57 lines
979 B
C++
#include "MySimpleScene.h"
|
|
|
|
MySimpleScene::MySimpleScene()
|
|
//: m_batch(m_triangle)
|
|
{
|
|
}
|
|
|
|
|
|
MySimpleScene::~MySimpleScene()
|
|
{
|
|
}
|
|
|
|
void MySimpleScene::init()
|
|
{
|
|
glEnable(GL_DEPTH_TEST);
|
|
glDepthFunc(GL_LESS);
|
|
|
|
float points[] = {
|
|
0.0f, 0.5f, 0.0f,
|
|
0.5f, -0.5f, 0.0f,
|
|
-0.5f, -0.5f, 0.0f
|
|
};
|
|
|
|
glGenBuffers(1, &m_vbo);
|
|
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
|
|
glBufferData(GL_ARRAY_BUFFER, 9 * sizeof(float), points, GL_STATIC_DRAW);
|
|
|
|
glGenVertexArrays(1, &m_vao);
|
|
glBindVertexArray(m_vao);
|
|
glEnableVertexAttribArray(0);
|
|
glBindBuffer(GL_ARRAY_BUFFER, m_vao);
|
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
|
|
}
|
|
|
|
void MySimpleScene::use()
|
|
{
|
|
}
|
|
|
|
void MySimpleScene::unuse()
|
|
{
|
|
}
|
|
|
|
void MySimpleScene::update(float delta_time, clock_t clock)
|
|
{
|
|
}
|
|
|
|
void MySimpleScene::render()
|
|
{
|
|
//m_shader_program.use();
|
|
//m_batch.render();
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
m_shader_program.use();
|
|
glBindVertexArray(m_vao);
|
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
|
|
}
|