Skip to content

Instantly share code, notes, and snippets.

View capnramses's full-sized avatar
🖥️
coding...

Anton Gerdelan capnramses

🖥️
coding...
View GitHub Profile
@capnramses
capnramses / gist:203c00dbff43e55155574a7dee81cf4e
Created April 20, 2017 13:36
OpenGL multi-version cubemap shadow texture creation for point lights
bool change_shadow_size (int dims) {
game_log ("generating shadow textures, size %i", dims);
g_sett.shadow_size = dims;
glBindFramebuffer(GL_FRAMEBUFFER, g_shads.cube_fb);
{ // colour cube texture
bind_cube_texture (0, g_shads.cube_colour_tex);
for (int i = 0; i < 6; i++) {
// NOTE: 16F and FLOAT are NOT part of GL 2.1 but MESA didn't support
// the 16 and INT which ARE part of GL 2.1
glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA16F,
these are all my text strings at the moment.
i store them like this per language:
wchar_t* g_english_strings[] = {
[TEXT_STRING_NAME_OF_LANG] = L"English",
[TEXT_STRING_NEW_GAME] = L"New Game",
[TEXT_STRING_QUIT] = L"Quit",
[TEXT_STRING_OPTIONS] = L"Options",
[TEXT_STRING_HOST] = L"Host Game",
[TEXT_STRING_JOIN] = L"Join Game",
@capnramses
capnramses / gist:8dfacfddb315fc1a33ae
Created January 20, 2016 17:19
depth-write pre-pass to fight overdraw. inspired by Doom3
static void draw_frame (double elapsed) {
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (do_pre_pass) { // depth-writing pre-pass
glUseProgram (dshader_programme);
for (int i = 0; i < NUM_MONKEYS; i++) {
float x = 0.0f;
float y = 0.0f;
float z = sinf ((float)i) * 100.0f - 100.0f;
mat4 M = translate_mat4 (vec3_from_3f (x, y, z));
mat4 PVM = mult_mat4_mat4 (PV, M);
@capnramses
capnramses / gist:9126337
Created February 21, 2014 00:22
test gist
public gist contents