Skip to content

Instantly share code, notes, and snippets.

View danicomas's full-sized avatar

Daniel Comas Fernández danicomas

View GitHub Profile
@danicomas
danicomas / fragment
Last active October 4, 2020 09:07
Opengl shading - Fragment
uniform sampler2D sampler;
void main()
{
vec2 perturbatedTexCoords = vec2(gl_TexCoord[0].s * 4.0, gl_TexCoord[0].t * 4.0);
gl_FragColor = texture2D(sampler, perturbatedTexCoords);
}
@danicomas
danicomas / vertex.vs
Created October 4, 2020 08:58
Opengl - vertex.vs
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}
@danicomas
danicomas / perspective-correct.cpp
Last active October 4, 2020 09:07
c++ Perspective-correct.cpp
#ifdef WIN32
#include <windows.h>
#endif
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include "GLShader.hpp"