learn-opengl/32-text-rendering/src/screen.cpp

18 lines
616 B
C++

#include "screen.hpp"
#include <glad/glad.h>
#include <GLFW/glfw3.h>
void Screen::init() {
shader.use();
shader.setInt("screenTexture", 0);
glGenVertexArrays(1, &target_VAO);
glGenBuffers(1, &target_VBO);
glBindVertexArray(target_VAO);
glBindBuffer(GL_ARRAY_BUFFER, target_VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), &vertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void *)0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float)));
}