Skip to content

Instantly share code, notes, and snippets.

View kioba's full-sized avatar
🏠
Working from home

kioba kioba

🏠
Working from home
View GitHub Profile
@kioba
kioba / shader_compile.cpp
Last active November 17, 2015 17:16
Vertex and Fragment shader compile function
GLuint Shader::LoadShaders(const std::string VertexShaderCode, const std::string FragmentShaderCode)
{
GLint Result = GL_FALSE;
glGetIntegerv(GL_SHADER_COMPILER, &Result);
if (Result == GL_FALSE) {
return Result;
}
@kioba
kioba / nullptr.cpp
Last active January 2, 2017 22:07
c++11 what is 0, NULL and nullptr?
#include <iostream>
void whatis(int*& pointer);
int main()
{
int* isempty;
int* zero = 0;
@kioba
kioba / deletedfunc.cpp
Created November 10, 2015 15:20
C11 explicit delete class function
#include <iostream>
class Destructor
{
public:
Destructor();
virtual ~Destructor() = delete;
void print();
};
@kioba
kioba / shared_ptr.cpp
Last active November 8, 2015 23:06
std::shared_ptr question! "Is it correct?"
#include <iostream>
#include <memory>
class Base
{
public:
Base()
{
std::cout << "Base Constructor!" << std::endl;
}
@kioba
kioba / QuadCurvePix.c
Last active November 7, 2015 11:24
Quadratic Curve Pixel Shader
float4 QuadraticPS(float2 p : TEXCOORD0,
float4 color : COLOR0) : COLOR
{
// Gradients
float2 px = ddx(p);
float2 py = ddy(p);
// Chain rule
float fx = (2*p.x)*px.x - px.y;
float fy = (2*p.x)*py.x - py.y;
// Signed distance