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
static const char * const glGetTypeString(GLenum type) | |
{ | |
switch (type) | |
{ | |
case GL_BYTE : return "GLbyte"; | |
case GL_UNSIGNED_BYTE : return "GLubyte"; | |
case GL_SHORT : return "GLshort"; | |
case GL_UNSIGNED_SHORT : return "GLushort"; | |
case GL_INT : return "GLint"; | |
case GL_UNSIGNED_INT : return "GLuint"; |
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
#include <type_traits> | |
#include <stdio.h> | |
using namespace std; | |
template <typename T, typename Ty> | |
typename enable_if<sizeof(Ty)==sizeof(T), typename T>::type convertToType(Ty type) | |
{ | |
return *(T*)&type; | |
} |
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 <cstdio> | |
#include <sstream> | |
#include <iomanip> | |
#include <CL\cl.h> | |
void print_cl_status(const cl_int status, const int line) { | |
if (status != CL_SUCCESS) { |
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
#include <xmmintrin.h> | |
#include <cmath> | |
#include <iostream> | |
#include <omp.h> | |
/* | |
* void example() | |
* { | |
* // Size of float array | |
* const int size = 4; |
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
// Some C++11 features in use. | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <type_traits> | |
using namespace std; | |
// Raw string literal | |
string vertex_shader_source = R"glsl(#version 330 |
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
#include <string> | |
#include <sstream> | |
// Convert string to type T | |
template <class T> bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&)) { | |
std::istringstream iss(s); | |
return !(iss >> f >> t).fail(); | |
} |
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
#version 330 | |
struct material_data | |
{ | |
vec4 emissive; | |
vec4 ambient; | |
vec4 diffuse; | |
vec4 specular; | |
float shininess; | |
}; |
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
#include "where_T.h" | |
#include <iostream> | |
struct IComponent { | |
virtual void init = 0; | |
virtual void update(double dt) = 0; | |
virtual void render() = 0; | |
} | |
struct ConcreateComponent : public IComponent { |
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
#include <type_traits> | |
#include <stdio.h> | |
using namespace std; | |
template <typename T, typename Ty> | |
typename enable_if<sizeof(Ty)==sizeof(T), typename T>::type convertToType(Ty type) | |
{ | |
return *(T*)&type; | |
} |
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
if (glewInit() != GLEW_OK) { | |
glfwTerminate(); | |
exit(EXIT_FAILURE); | |
} |
NewerOlder