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
Solução rápida para o problema do Network Manager conectar mas não navegar
Como instalar no Linux Jogos da Steam só para Windows
Instalando o Team Viewer no Debian Trixie - problema no Policykit
Problemas latentes de performance no Ubuntu 25.04 (2)
Como rodo essa suinaria? [RESOLVIDO] (6)