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;
}
Resolver problemas de Internet
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Descritores de Arquivos e Swappiness
Fez porcaria no teu repositório Git? Aprenda a restaurar uma versão anterior do seu código!
Restaurando Fontes de Download do Hydra no Linux
Atualizando "na marra" o YT-DLP quando começa a dar erro de downloads
Como instalar o WPS com interface e corretor ortográfico em PT-BR no Arch Linux
Bluetooth CSR 4.0 Dongle (Alternativo) (2)
Desbloquear chaveiro padrão (5)
como eu instalo o mali-t60x_r12... (5)