Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Comas Fernández danicomas

View GitHub Profile
@danicomas
danicomas / fragment
Last active Oct 4, 2020
Opengl shading - Fragment
View 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 Oct 4, 2020
Opengl - vertex.vs
View vertex.vs
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}
@danicomas
danicomas / perspective-correct.cpp
Last active Oct 4, 2020
c++ Perspective-correct.cpp
View perspective-correct.cpp
#ifdef WIN32
#include <windows.h>
#endif
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include "GLShader.hpp"