This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pages | |
import ( | |
"crypto/sha1" | |
"fmt" | |
"github.com/gorilla/sessions" | |
"github.com/nfnt/resize" | |
"image" | |
"image/gif" | |
"image/jpeg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2011 Michael Nicolella | |
Single file conversion by Jeffrey Jenner | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Before -- What the fuck tier | |
int Texture::LoadTexture(const char *fname){ | |
cl("Loading Texture: %s ", fname); | |
unique_ptr<FILE, int(*)(FILE*)> filePtr(fopen(fname, "rb"), fclose); | |
if(filePtr == nullptr){ | |
cl("[FAILED]\n"); | |
throw KLGLException("[KLGLTexture::LoadTexture][%d:%s] \nResource \"%s\" could not be opened.", __LINE__, __FILE__, fname); | |
return 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> struct Quad2D | |
{ | |
T x,y,z,w; | |
Quad2D(T X, T Y, T Z, T W) : x(X), y(Y), z(Z), w(W) {}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include // Your lib that includes all the OpenGL bindings and maybe some other stuff i've forgotten like vector | |
namespace gl4 { | |
template<int BufferType, typename StorageClass> class glBuffer | |
{ | |
public: | |
GLuint buffer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Vertex | |
#version 150 core | |
uniform mat4 trans; | |
in vec2 pos; | |
in float id; | |
out mat4 projection; | |
out float gId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma comment(lib,"kami.lib") | |
#pragma comment(lib,"Lua.lib") | |
#include <kami.h> | |
#include <resources.h> | |
#include <glm/glm.hpp> | |
#include <glm/gtc/matrix_transform.hpp> | |
#include <glm/gtc/type_ptr.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Shader { | |
public: | |
GLuint shader; | |
Shader() = default; | |
Shader(GLuint &shaderProgram, GLuint shaderType, std::string shaderSource){ | |
compile(shaderProgram, shaderType, shaderSource); | |
}; | |
~Shader() = default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shaderProgram.bind(); | |
glBindTexture(GL_TEXTURE_2D, sys.texture.get(1).gltexture); | |
glm::mat4 projection = glm::ortho(0.0f, (float)sys.gc.buffer.width, (float)sys.gc.buffer.height, 0.0f); | |
glm::mat4 trans = glm::translate( | |
glm::mat4(1.0f), | |
glm::vec3(translate.x, translate.y, 0.0f) | |
); | |
glm::mat4 view = glm::rotate( | |
trans, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto projection = glm::ortho(0.0f, (float)window.width, 0.0f, (float)window.height); | |
auto view = glm::mat4(1.); | |
auto ratio = ASPRatio(window, buffer, false); | |
auto model = glm::scale( | |
glm::mat4(1.0f), | |
glm::vec3(ratio.width / float(window.width), ratio.height / float(window.height), 0.0f) | |
); | |
auto MVP = projection*view*model; |
OlderNewer