Skip to content

Instantly share code, notes, and snippets.

@YukiSnowy
YukiSnowy / main.cpp
Last active March 20, 2025 07:38
example SDL2 Direct3D9 application
// g++ *.cpp -o d3d9 -lmingw32 -lSDL2main -lSDL2 -I/dxsdk/include -L/dxsdk/lib -DUNICODE -ld3d9 -ld3dx9
// http://blog.fourthwoods.com/2011/08/11/setting-up-mingw-for-directx/
// http://www.directxtutorial.com/Lesson.aspx?lessonid=9-4-4
#include <iostream>
using namespace std;
#include <SDL2/SDL.h>
#include <windows.h>
@vittorioromeo
vittorioromeo / hello_triangle.cpp
Created October 10, 2015 11:07
SDL2 + OpenGL ES 2.0 - "Hello triangle" example that works both on X11 and Emscripten
#include <exception>
#include <functional>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
@marcosbitetti
marcosbitetti / gist:29563e142f0c01b2fa27
Last active January 8, 2017 17:06
MatCap shader prototype for Godot
// Vertex
VAR1 = vec4(normalize(MODELVIEW_MATRIX * VERTEX), 1.0);
// Fragment
uniform texture matcap;
vec3 r = reflect(VAR1.xyz, NORMAL);
float m = 2.0 * sqrt( pow( r.x, 2.0 ) + pow( r.y, 2.0 ) + pow( r.z + 1.0, 2.0 ) );