Commit f96665f2 authored by Mathieu Faverge's avatar Mathieu Faverge

Cleanup DOS files to unix files

parent 1c96b263
 
Microsoft Visual Studio Solution File, Format Version 10.00 Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008 # Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libotf", "otflib\libotf_vs08.vcproj", "{6B9B49C9-75CD-400D-B736-5EACA04D0A82}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libotf", "otflib\libotf_vs08.vcproj", "{6B9B49C9-75CD-400D-B736-5EACA04D0A82}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfaux", "tools\otfaux\otfaux_vs08.vcproj", "{24587836-ED5E-49DF-A7AD-419FDC208C08}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfaux", "tools\otfaux\otfaux_vs08.vcproj", "{24587836-ED5E-49DF-A7AD-419FDC208C08}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfcompress", "tools\otfcompress\otfcompress_vs08.vcproj", "{B6BBC220-1492-4BEA-A299-9D062133ABAA}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfcompress", "tools\otfcompress\otfcompress_vs08.vcproj", "{B6BBC220-1492-4BEA-A299-9D062133ABAA}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfdump", "tools\otfdump\otfdump_vs08.vcproj", "{508A823C-8EAB-4C56-9DFE-4D85B0D24491}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfdump", "tools\otfdump\otfdump_vs08.vcproj", "{508A823C-8EAB-4C56-9DFE-4D85B0D24491}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfmerge", "tools\otfmerge\otfmerge_vs08.vcproj", "{1B9223C8-DE20-4538-8214-776C6017D22B}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfmerge", "tools\otfmerge\otfmerge_vs08.vcproj", "{1B9223C8-DE20-4538-8214-776C6017D22B}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Release Static|Win32 = Release Static|Win32 Release Static|Win32 = Release Static|Win32
Release Static|x64 = Release Static|x64 Release Static|x64 = Release Static|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|Win32.ActiveCfg = Debug|Win32 {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|Win32.ActiveCfg = Debug|Win32
{6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|Win32.Build.0 = Debug|Win32 {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|Win32.Build.0 = Debug|Win32
{6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|x64.ActiveCfg = Debug|x64 {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|x64.ActiveCfg = Debug|x64
{6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|x64.Build.0 = Debug|x64 {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|x64.Build.0 = Debug|x64
{6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|Win32.ActiveCfg = Release Static|Win32 {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|Win32.ActiveCfg = Release Static|Win32
{6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|Win32.Build.0 = Release Static|Win32 {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|Win32.Build.0 = Release Static|Win32
{6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|x64.ActiveCfg = Release Static|x64 {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|x64.ActiveCfg = Release Static|x64
{6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|x64.Build.0 = Release Static|x64 {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|x64.Build.0 = Release Static|x64
{24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|Win32.ActiveCfg = Debug|Win32 {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|Win32.ActiveCfg = Debug|Win32
{24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|Win32.Build.0 = Debug|Win32 {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|Win32.Build.0 = Debug|Win32
{24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|x64.ActiveCfg = Debug|x64 {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|x64.ActiveCfg = Debug|x64
{24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|x64.Build.0 = Debug|x64 {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|x64.Build.0 = Debug|x64
{24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|Win32.ActiveCfg = Release Static|Win32 {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|Win32.ActiveCfg = Release Static|Win32
{24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|Win32.Build.0 = Release Static|Win32 {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|Win32.Build.0 = Release Static|Win32
{24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|x64.ActiveCfg = Release Static|x64 {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|x64.ActiveCfg = Release Static|x64
{24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|x64.Build.0 = Release Static|x64 {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|x64.Build.0 = Release Static|x64
{B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|Win32.ActiveCfg = Debug|Win32 {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|Win32.ActiveCfg = Debug|Win32
{B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|Win32.Build.0 = Debug|Win32 {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|Win32.Build.0 = Debug|Win32
{B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|x64.ActiveCfg = Debug|x64 {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|x64.ActiveCfg = Debug|x64
{B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|x64.Build.0 = Debug|x64 {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|x64.Build.0 = Debug|x64
{B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|Win32.ActiveCfg = Release Static|Win32 {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|Win32.ActiveCfg = Release Static|Win32
{B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|Win32.Build.0 = Release Static|Win32 {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|Win32.Build.0 = Release Static|Win32
{B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|x64.ActiveCfg = Release Static|x64 {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|x64.ActiveCfg = Release Static|x64
{B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|x64.Build.0 = Release Static|x64 {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|x64.Build.0 = Release Static|x64
{508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|Win32.ActiveCfg = Debug|Win32 {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|Win32.ActiveCfg = Debug|Win32
{508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|Win32.Build.0 = Debug|Win32 {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|Win32.Build.0 = Debug|Win32
{508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|x64.ActiveCfg = Debug|x64 {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|x64.ActiveCfg = Debug|x64
{508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|x64.Build.0 = Debug|x64 {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|x64.Build.0 = Debug|x64
{508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|Win32.ActiveCfg = Release Static|Win32 {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|Win32.ActiveCfg = Release Static|Win32
{508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|Win32.Build.0 = Release Static|Win32 {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|Win32.Build.0 = Release Static|Win32
{508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|x64.ActiveCfg = Release Static|x64 {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|x64.ActiveCfg = Release Static|x64
{508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|x64.Build.0 = Release Static|x64 {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|x64.Build.0 = Release Static|x64
{1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|Win32.ActiveCfg = Debug|Win32 {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|Win32.ActiveCfg = Debug|Win32
{1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|Win32.Build.0 = Debug|Win32 {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|Win32.Build.0 = Debug|Win32
{1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|x64.ActiveCfg = Debug|x64 {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|x64.ActiveCfg = Debug|x64
{1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|x64.Build.0 = Debug|x64 {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|x64.Build.0 = Debug|x64
{1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|Win32.ActiveCfg = Release Static|Win32 {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|Win32.ActiveCfg = Release Static|Win32
{1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|Win32.Build.0 = Release Static|Win32 {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|Win32.Build.0 = Release Static|Win32
{1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|x64.ActiveCfg = Release Static|x64 {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|x64.ActiveCfg = Release Static|x64
{1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|x64.Build.0 = Release Static|x64 {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|x64.Build.0 = Release Static|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal
This diff is collapsed.
#ifndef DEF_SHADER #ifndef DEF_SHADER
#define DEF_SHADER #define DEF_SHADER
//#include <GL/glew.h> //#include <GL/glew.h>
#include "common/common.hpp" #include "common/common.hpp"
// Includes communs // Includes communs
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <fstream> #include <fstream>
// Classe Shader // Classe Shader
class Shader class Shader
{ {
public: public:
/* Default constructor*/ /* Default constructor*/
Shader(); Shader();
/*Constructor for shaders using textures. Parameter n is not used, it just allow to create a have another constructor. */ /*Constructor for shaders using textures. Parameter n is not used, it just allow to create a have another constructor. */
Shader(int glsl, int n); Shader(int glsl, int n);
/* Construct a Shader reading colors in the VBO. Still used for containers and selection*/ /* Construct a Shader reading colors in the VBO. Still used for containers and selection*/
Shader(int glsl); Shader(int glsl);
/* Construct Shaders we use for entities /* Construct Shaders we use for entities
param glsl says which version of GL Shading Language we are using param glsl says which version of GL Shading Language we are using
param rgb define the color param rgb define the color
param shade should be true for states, false either*/ param shade should be true for states, false either*/
Shader(int glsl, Element_col, Element_col, Element_col, bool); Shader(int glsl, Element_col, Element_col, Element_col, bool);
//Destructor //Destructor
~Shader(); ~Shader();
Shader& operator=(Shader const &shaderACopier); Shader& operator=(Shader const &shaderACopier);
/*Loading function*/ /*Loading function*/
bool charger(); bool charger();
/*Compilation function*/ /*Compilation function*/
bool compilerShader(GLuint &shader, GLenum type, const std::string &code); bool compilerShader(GLuint &shader, GLenum type, const std::string &code);
/*Getter*/ /*Getter*/
GLuint getProgramID() const; GLuint getProgramID() const;
private: private:
GLuint m_vertexID {0}; GLuint m_vertexID {0};
GLuint m_fragmentID {0}; GLuint m_fragmentID {0};
GLuint m_programID {0}; GLuint m_programID {0};
std::string m_vertex_code; std::string m_vertex_code;
std::string m_fragment_code; std::string m_fragment_code;
}; };
#endif #endif
#version 330 core #version 330 core
// Interpolated values from the vertex shaders // Interpolated values from the vertex shaders
in vec2 UV; in vec2 UV;
// Ouput data // Ouput data
out vec4 color; out vec4 color;
// Values that stay constant for the whole mesh. // Values that stay constant for the whole mesh.
uniform sampler2D myTextureSampler; uniform sampler2D myTextureSampler;
void main(){ void main(){
color = texture2D( myTextureSampler, UV ); color = texture2D( myTextureSampler, UV );
} }
\ No newline at end of file
#version 330 core #version 330 core
// Input vertex data, different for all executions of this shader. // Input vertex data, different for all executions of this shader.
layout(location = 0) in vec2 vertexPosition_screenspace; layout(location = 0) in vec2 vertexPosition_screenspace;
layout(location = 1) in vec2 vertexUV; layout(location = 1) in vec2 vertexUV;
// Output data ; will be interpolated for each fragment. // Output data ; will be interpolated for each fragment.
out vec2 UV; out vec2 UV;
void main(){ void main(){
// Output position of the vertex, in clip space // Output position of the vertex, in clip space
// map [0..800][0..600] to [-1..1][-1..1] // map [0..800][0..600] to [-1..1][-1..1]
vec2 vertexPosition_homoneneousspace = vertexPosition_screenspace - vec2(400,300); // [0..800][0..600] -> [-400..400][-300..300] vec2 vertexPosition_homoneneousspace = vertexPosition_screenspace - vec2(400,300); // [0..800][0..600] -> [-400..400][-300..300]
vertexPosition_homoneneousspace /= vec2(400,300); vertexPosition_homoneneousspace /= vec2(400,300);
gl_Position = vec4(vertexPosition_homoneneousspace,0,1); gl_Position = vec4(vertexPosition_homoneneousspace,0,1);
// UV of the vertex. No special space for this one. // UV of the vertex. No special space for this one.
UV = vertexUV; UV = vertexUV;
} }
#include <vector> #include <vector>
#include <cstring> #include <cstring>
#include <GL/glew.h> #include <GL/glew.h>
#define GLM_FORCE_RADIANS #define GLM_FORCE_RADIANS
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp> #include <glm/gtc/type_ptr.hpp>
using namespace glm; using namespace glm;
#include "Shader.hpp" #include "Shader.hpp"
#include "texture.hpp" #include "texture.hpp"
#include "text2D.hpp" #include "text2D.hpp"
unsigned int Text2DTextureID; unsigned int Text2DTextureID;
unsigned int Text2DVertexBufferID; unsigned int Text2DVertexBufferID;
unsigned int Text2DUVBufferID; unsigned int Text2DUVBufferID;
Shader* _shader; Shader* _shader;
unsigned int Text2DUniformID; unsigned int Text2DUniformID;
void initText2D(const char * texturePath){ void initText2D(const char * texturePath){
// Initialize texture // Initialize texture
Text2DTextureID = loadDDS(texturePath); Text2DTextureID = loadDDS(texturePath);
// Initialize VBO // Initialize VBO
glGenBuffers(1, &Text2DVertexBufferID); glGenBuffers(1, &Text2DVertexBufferID);
glGenBuffers(1, &Text2DUVBufferID); glGenBuffers(1, &Text2DUVBufferID);
// Initialize Shader // Initialize Shader
_shader = new Shader("TextVertexShader.vertexshader", "TextVertexShader.fragmentshader"); _shader = new Shader("TextVertexShader.vertexshader", "TextVertexShader.fragmentshader");
_shader->charger(); _shader->charger();
// Initialize uniforms' IDs // Initialize uniforms' IDs
Text2DUniformID = glGetUniformLocation( _shader->getProgramID(), "myTextureSampler" ); Text2DUniformID = glGetUniformLocation( _shader->getProgramID(), "myTextureSampler" );
} }
void printText2D(const char * text, int x, int y, int size, glm::mat4 projection, glm::mat4 modelview){ void printText2D(const char * text, int x, int y, int size, glm::mat4 projection, glm::mat4 modelview){
unsigned int length = strlen(text); unsigned int length = strlen(text);
// Fill buffers // Fill buffers
std::vector<glm::vec2> vertices; std::vector<glm::vec2> vertices;
std::vector<glm::vec2> UVs; std::vector<glm::vec2> UVs;
for ( unsigned int i=0 ; i<length ; i++ ){ for ( unsigned int i=0 ; i<length ; i++ ){
glm::vec2 vertex_up_left = glm::vec2( x+i*size , y+size ); glm::vec2 vertex_up_left = glm::vec2( x+i*size , y+size );
glm::vec2 vertex_up_right = glm::vec2( x+i*size+size, y+size ); glm::vec2 vertex_up_right = glm::vec2( x+i*size+size, y+size );
glm::vec2 vertex_down_right = glm::vec2( x+i*size+size, y-size ); glm::vec2 vertex_down_right = glm::vec2( x+i*size+size, y-size );
glm::vec2 vertex_down_left = glm::vec2( x+i*size , y-size ); glm::vec2 vertex_down_left = glm::vec2( x+i*size , y-size );
vertices.push_back(vertex_up_left ); vertices.push_back(vertex_up_left );
vertices.push_back(vertex_down_left ); vertices.push_back(vertex_down_left );
vertices.push_back(vertex_up_right ); vertices.push_back(vertex_up_right );
vertices.push_back(vertex_down_right); vertices.push_back(vertex_down_right);
vertices.push_back(vertex_up_right); vertices.push_back(vertex_up_right);
vertices.push_back(vertex_down_left); vertices.push_back(vertex_down_left);
char character = text[i]; char character = text[i];
float uv_x = (character%16)/16.0f; float uv_x = (character%16)/16.0f;
float uv_y = (character/16)/16.0f; float uv_y = (character/16)/16.0f;
glm::vec2 uv_up_left = glm::vec2( uv_x , uv_y ); glm::vec2 uv_up_left = glm::vec2( uv_x , uv_y );
glm::vec2 uv_up_right = glm::vec2( uv_x+1.0f/16.0f, uv_y ); glm::vec2 uv_up_right = glm::vec2( uv_x+1.0f/16.0f, uv_y );
glm::vec2 uv_down_right = glm::vec2( uv_x+1.0f/16.0f, (uv_y + 1.0f/16.0f) ); glm::vec2 uv_down_right = glm::vec2( uv_x+1.0f/16.0f, (uv_y + 1.0f/16.0f) );
glm::vec2 uv_down_left = glm::vec2( uv_x , (uv_y + 1.0f/16.0f) ); glm::vec2 uv_down_left = glm::vec2( uv_x , (uv_y + 1.0f/16.0f) );
UVs.push_back(uv_up_left ); UVs.push_back(uv_up_left );
UVs.push_back(uv_down_left ); UVs.push_back(uv_down_left );
UVs.push_back(uv_up_right ); UVs.push_back(uv_up_right );
UVs.push_back(uv_down_right); UVs.push_back(uv_down_right);
UVs.push_back(uv_up_right); UVs.push_back(uv_up_right);
UVs.push_back(uv_down_left); UVs.push_back(uv_down_left);
} }
glBindBuffer(GL_ARRAY_BUFFER, Text2DVertexBufferID); glBindBuffer(GL_ARRAY_BUFFER, Text2DVertexBufferID);
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(glm::vec2), &vertices[0], GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(glm::vec2), &vertices[0], GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, Text2DUVBufferID); glBindBuffer(GL_ARRAY_BUFFER, Text2DUVBufferID);
glBufferData(GL_ARRAY_BUFFER, UVs.size() * sizeof(glm::vec2), &UVs[0], GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, UVs.size() * sizeof(glm::vec2), &UVs[0], GL_STATIC_DRAW);
// Bind shader // Bind shader
glUseProgram(_shader->getProgramID()); glUseProgram(_shader->getProgramID());
// Bind texture // Bind texture
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, Text2DTextureID); glBindTexture(GL_TEXTURE_2D, Text2DTextureID);
// Set our "myTextureSampler" sampler to user Texture Unit 0 // Set our "myTextureSampler" sampler to user Texture Unit 0
glUniform1i(Text2DUniformID, 0); glUniform1i(Text2DUniformID, 0);
glUniformMatrix4fv(glGetUniformLocation(_shader->getProgramID(), "modelview"), 1, GL_FALSE, glm::value_ptr(modelview)); glUniformMatrix4fv(glGetUniformLocation(_shader->getProgramID(), "modelview"), 1, GL_FALSE, glm::value_ptr(modelview));
glUniformMatrix4fv(glGetUniformLocation(_shader->getProgramID(), "projection"), 1, GL_FALSE, glm::value_ptr(projection)); glUniformMatrix4fv(glGetUniformLocation(_shader->getProgramID(), "projection"), 1, GL_FALSE, glm::value_ptr(projection));
// 1rst attribute buffer : vertices // 1rst attribute buffer : vertices
glEnableVertexAttribArray(0); glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, Text2DVertexBufferID); glBindBuffer(GL_ARRAY_BUFFER, Text2DVertexBufferID);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, (void*)0 ); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, (void*)0 );
// 2nd attribute buffer : UVs // 2nd attribute buffer : UVs
glEnableVertexAttribArray(1); glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, Text2DUVBufferID); glBindBuffer(GL_ARRAY_BUFFER, Text2DUVBufferID);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (void*)0 ); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (void*)0 );
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Draw call // Draw call
glDrawArrays(GL_TRIANGLES, 0, vertices.size() ); glDrawArrays(GL_TRIANGLES, 0, vertices.size() );
glDisable(GL_BLEND); glDisable(GL_BLEND);
glDisableVertexAttribArray(0); glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1); glDisableVertexAttribArray(1);
} }
void cleanupText2D(){ void cleanupText2D(){
// Delete buffers // Delete buffers
glDeleteBuffers(1, &Text2DVertexBufferID); glDeleteBuffers(1, &Text2DVertexBufferID);
glDeleteBuffers(1, &Text2DUVBufferID); glDeleteBuffers(1, &Text2DUVBufferID);
// Delete texture // Delete texture
glDeleteTextures(1, &Text2DTextureID); glDeleteTextures(1, &Text2DTextureID);
// Delete shader // Delete shader
glDeleteProgram(_shader->getProgramID()); glDeleteProgram(_shader->getProgramID());
} }
#ifndef TEXT2D_HPP #ifndef TEXT2D_HPP
#define TEXT2D_HPP #define TEXT2D_HPP
void initText2D(const char * texturePath); void initText2D(const char * texturePath);
void printText2D(const char * text, int x, int y, int size, glm::mat4, glm::mat4); void printText2D(const char * text, int x, int y, int size, glm::mat4, glm::mat4);
void cleanupText2D(); void cleanupText2D();
#endif #endif
This diff is collapsed.
#ifndef TEXTURE_HPP #ifndef TEXTURE_HPP
#define TEXTURE_HPP #define TEXTURE_HPP
// Load a .BMP file using our custom loader // Load a .BMP file using our custom loader
//GLuint loadBMP_custom(const char * imagepath); //GLuint loadBMP_custom(const char * imagepath);
//// Since GLFW 3, glfwLoadTexture2D() has been removed. You have to use another texture loading library, //// Since GLFW 3, glfwLoadTexture2D() has been removed. You have to use another texture loading library,
//// or do it yourself (just like loadBMP_custom and loadDDS) //// or do it yourself (just like loadBMP_custom and loadDDS)
//// Load a .TGA file using GLFW's own loader //// Load a .TGA file using GLFW's own loader
//GLuint loadTGA_glfw(const char * imagepath); //GLuint loadTGA_glfw(const char * imagepath);
// Load a .DDS file using GLFW's own loader // Load a .DDS file using GLFW's own loader
GLuint loadDDS(const char * imagepath); GLuint loadDDS(const char * imagepath);
#endif #endif
#pragma once #pragma once
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/archive/basic_archive.hpp> #include <boost/archive/basic_archive.hpp>
#include <boost/archive/archive_exception.hpp> #include <boost/archive/archive_exception.hpp>
namespace eos { namespace eos {
// this value is written to the top of the stream // this value is written to the top of the stream
const signed char magic_byte = 'e' | 'o' | 's'; const signed char magic_byte = 'e' | 'o' | 's';
// flag for fp serialization // flag for fp serialization
const unsigned no_infnan = 64; const unsigned no_infnan = 64;
// integral type for the archive version // integral type for the archive version
#if BOOST_VERSION < 104400 #if BOOST_VERSION < 104400
typedef boost::archive::version_type archive_version_type; typedef boost::archive::version_type archive_version_type;
#else