
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;
}
Boas Práticas e Padrões Idiomáticos em Go e C
Vale a pena ter mais de uma interface grafica no seu Linux?
Estrutura e Funcionamento de um Ebuild no Gentoo Linux
[Resolvido] Google Chrome reclamando de perfil em uso após mudar hostname
Instalando o Tema de Ícones Tela Circle
Copiar Para e Mover Para no menu de contexto do Nautilus e Dolphin
Dotando o Thunar das opcoes Copiar para e Mover para no menu de contexto
Instalação Dual Boot Linux+Windows 11 (4)
No Ubuntu 26.04, sudo passou a mostrar os asteriscos ao digitar por pa... (5)
Como instalar Warsaw no Gentoo? (0)
Como insiro e excluo um elemento XML e JSON ao código Javascript (1)









