Skip to content

Instantly share code, notes, and snippets.

std::string PreprocessGLES3Shader (const std::string& source, bool autoNormalizeNormals, bool fullVertexShaderPreprocess)
{
std::string remainder1, remainder2;
std::string vertexShaderSource = ExtractDefineBlock (source, "VERTEX", &remainder1);
std::string fragmentShaderSource = ExtractDefineBlock (remainder1, "FRAGMENT", &remainder2);
if (fullVertexShaderPreprocess)
vertexShaderSource = PreprocessGLESVertexShader (vertexShaderSource, kShaderAPIGLES3, autoNormalizeNormals);
vertexShaderSource = PreprocessVertexShader(vertexShaderSource, autoNormalizeNormals);
@Groovounet
Groovounet / gist:7258805
Created October 31, 2013 23:21
Checking all the OpenGL capabilities from 2.1 to 4.4
struct caps
{
enum profile
{
CORE = 0x00000001,
COMPATIBILITY = 0x00000002,
ES = 0x00000004
};
private:
@Groovounet
Groovounet / gist:7392871
Last active December 27, 2015 21:39
Use sample for GLI 0.5.0. A single mem alloc with C++11 regardless of the actual texture in the file. 2 mem alloc with C++98. GLI also has gli::dxgi_format function to be used with D3D11
#include <gli/gli.hpp>
GLuint create_texture_2d(gli::storage const & Storage)
{
gli::texture2D Texture(Storage);
if(Texture.empty())
return 0;
GLuint Name(0);
glGenTextures(1, &Name);
@Groovounet
Groovounet / gist:7639664
Created November 25, 2013 10:57
Ah twitter!
OpenGL is thread-safe which is actually pretty annoying and expective.
OpenGL traditionally uses the "Bind to Edit" model. An alternative is called "Direct State Access" (DSA).
Bind to Edit:
GLuint Texture(0);
glGenTextures(1, &Texture);
glBindTexture(GL_TEXTURE_2D, Texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() constin libGeoRayTrace.a(accel.o)
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
embree::Ref<embree::Accel> embree::build<embree::BVH2Builder<embree::HeuristicBinning<2> > >(embree::TriangleType const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, embree::BuildTriangle const*, unsigned long, embree::Vec3fa const*, unsigned long, embree::BBox<embree::Vec3<float> > const&, bool)in libGeoRayTrace.a(accel.o)
embree::Ref<embree::Accel> embree::build<embree::BVH2Builder<embree::HeuristicBinning<0> > >(embree::TriangleType const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, embree::BuildTriangle const*, unsigned long, embree::Vec3fa const*, unsigned long, embree::BBox<embree::Vec3<float>
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Samples Pack (ogl-samples.g-truc.net)
///
/// Copyright (c) 2004 - 2014 G-Truc Creation (www.g-truc.net)
/// 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:
@Groovounet
Groovounet / gist:e5f10d405fecf8b63e5b
Created October 28, 2014 23:53
GLM 0.9.6 Cuda performance test
time for cuda glm (matrix): 233 milliseconds
time for cuda helper math (matrix): 225 milliseconds
time for cuda glm (dot): 187 milliseconds
time for cuda helper math (dot): 307 milliseconds
time for cuda glm (cross): 45 milliseconds
time for cuda helper math (cross): 163 milliseconds
https://bitbucket.org/adamce/cuda-glm-performance-test
@Groovounet
Groovounet / gist:84a830eb286539c686c7
Created February 15, 2016 22:37
KTX concerns (not exhaustive)
Depends on OpenGL
Doesn't distinguish OpenGL profiles
Doesn't support texture swizzle
Doesn't explicitly export texture target, no texture rectangle support
Doesn't support texture formats from others graphics APIs than OpenGL
Doesn't make it easy to load only a subset of layers
Doesn't store faces continuously in memory
No sparse storage
#if GLM_COMPILER & GLM_COMPILER_CUDA
template <>
GLM_FUNC_QUALIFIER float max<float>(float x, float y)
{
return fmaxf(x, y);
}
#endif//GLM_COMPILER & GLM_COMPILER_CUDA
@Groovounet
Groovounet / WGL_ARB_colorspace.txt
Created August 31, 2016 14:49
WGL_ARB_colorspace extension proposal
Name
ARB_colorspace
Name Strings
WGL_ARB_colorspace
Contact