Enviado em 21/09/2021 - 13:19h
Boa tarde senhores(as),#include <fstream>
#include <string>
#include <GL/gl.h>
std::string ReadFile(const char* path)
{
std::ifstream fs{path, std::ios::in};
std::string ret, line;
while (!fs.eof()) {
std::getline(fs, line);
ret.append(line + "\n");
}
return ret;
}
GLuint CreateVertexShader(const char* filePath)
{
auto code{ReadFile(filePath)};
const GLchar* constCodePtr = code.c_str();
GLuint vShader{glCreateShader(GL_VERTEX_SHADER)};
glShaderSource(vShader, 1, &constCodePtr, NULL);
glCompileShader(vShader);
return vShader;
}
GLuint CreateFragmentShader(const char* filePath)
{
auto code{ReadFile(filePath)};
const GLchar* constCodePtr = code.c_str();
GLuint fShader{glCreateShader(GL_FRAGMENT_SHADER)};
glShaderSource(fShader, 1, &constCodePtr, NULL);
glCompileShader(fShader);
return fShader;
}
GLuint ConstructShaderProgram(const char* vertexShaderPath, const char* fragmentShaderPath)
{
GLuint program{glCreateProgram()};
glAttachShader(program, CreateVertexShader(vertexShaderPath));
glAttachShader(program, CreateFragmentShader(fragmentShaderPath));
glLinkProgram(program);
return program;
}
Como gerar um podcast a partir de um livro em PDF
Automatizando digitação de códigos 2FA no browser
Resolver problemas de Internet
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Músicas de Andrew Hulshult no DOOM (WAD)
Instalar o Apache, MySQL e PHP no Oracle Linux 8
Bloqueando telemetria no Deepin 23.1
Como converter imagens PNG/JPEG para SVG em linha de comando
Fez porcaria no teu repositório Git? Aprenda a restaurar uma versão anterior do seu código!
Impossível ativar audio 5.1 (2)
Alguém pode me explicar essa matemática? (1)