Skip to content

Instantly share code, notes, and snippets.

View rxantos's full-sized avatar

Ricardo Santos rxantos

View GitHub Profile
@rxantos
rxantos / CHANGELOG.md
Created October 12, 2022 18:11 — forked from juampynr/CHANGELOG.md
Sample CHANGELOG

Change Log

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[Unreleased] - yyyy-mm-dd

Here we write upgrading notes for brands. It's a team effort to make them as

@rxantos
rxantos / image2clipboard.c
Created October 12, 2022 18:10 — forked from mmozeiko/image2clipboard.c
example how to put RGBA image in clipboard
#define STB_IMAGE_STATIC
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" // get from https://raw.githubusercontent.com/nothings/stb/master/stb_image.h
#include <windows.h>
int main(int argc, char* argv[])
{
int w, h;
stbi_uc* data = stbi_load(argv[1], &w, &h, NULL, 4);
@rxantos
rxantos / windows_modern_opengl_context.c
Created October 12, 2022 18:05 — forked from nickrolfe/windows_modern_opengl_context.c
Sample code showing how to create a window using a modern OpenGL core profile context without any libraries other than the standard Win32 wglXXX calls.
// Sample code showing how to create a modern OpenGL window and rendering context on Win32.
#include <windows.h>
#include <gl/gl.h>
#include <stdbool.h>
typedef HGLRC WINAPI wglCreateContextAttribsARB_type(HDC hdc, HGLRC hShareContext,
const int *attribList);
wglCreateContextAttribsARB_type *wglCreateContextAttribsARB;
@rxantos
rxantos / win32_opengl.c
Created October 12, 2022 18:05 — forked from mmozeiko/win32_opengl.c
setting up and using modern OpenGL 4.5 core context on Windows
// example how to set up OpenGL core context on Windows
// and use basic functionality of OpenGL 4.5 version
// important extension functionality used here:
// (4.3) KHR_debug: https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_debug.txt
// (4.5) ARB_direct_state_access: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_direct_state_access.txt
// (4.1) ARB_separate_shader_objects: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_separate_shader_objects.txt
// (4.2) ARB_shading_language_420pack: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_shading_language_420pack.txt
// (4.3) ARB_explicit_uniform_location: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_explicit_uniform_location.txt
@rxantos
rxantos / tls_client.c
Created October 12, 2022 18:04 — forked from mmozeiko/tls_client.c
simple example of TLS socket client using win32 schannel api
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#define SECURITY_WIN32
#include <security.h>
#include <schannel.h>
#include <shlwapi.h>
#include <assert.h>
#include <stdio.h>
@rxantos
rxantos / FlushFileCache.c
Created October 12, 2022 18:04 — forked from mmozeiko/FlushFileCache.c
flush file cache on Windows
// clang.exe -Os -fno-unwind-tables -nostdlib -fuse-ld=lld -Wl,-fixed,-merge:.rdata=.text,-subsystem:console FlushFileCache.c -o FlushFileCache.exe
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#pragma comment (lib, "kernel32.lib")
#pragma comment (lib, "advapi32.lib")
#define error(str) do { DWORD written; WriteFile(GetStdHandle(STD_ERROR_HANDLE), str, sizeof(str)-1, &written, NULL); } while (0)
@rxantos
rxantos / win32_opengl_multi.c
Created October 12, 2022 18:04 — forked from mmozeiko/win32_opengl_multi.c
setting up modern OpenGL 4.5 context for drawing to multiple windows
// example how to set up OpenGL core context on Windows for rendering to multiple windows
#define WINDOW_COUNT 4 // how many windows we'll be opening?
// important extension functionality used here:
// (4.3) KHR_debug: https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_debug.txt
// (4.5) ARB_direct_state_access: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_direct_state_access.txt
// (4.1) ARB_separate_shader_objects: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_separate_shader_objects.txt
// (4.2) ARB_shading_language_420pack: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_shading_language_420pack.txt
// (4.3) ARB_explicit_uniform_location: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_explicit_uniform_location.txt
@rxantos
rxantos / billboard.h
Created October 12, 2022 18:02 — forked from satoruhiga/billboard.h
OpenGL Billboard
// http://marina.sys.wakayama-u.ac.jp/~tokoi/?date=20110221
inline void billboard()
{
GLfloat m[16];
glGetFloatv(GL_MODELVIEW_MATRIX, m);
float inv_len;
m[8] = -m[12];
@rxantos
rxantos / glNotes.c
Created October 12, 2022 18:02 — forked from SimonJinaphant/glNotes.c
OpenGL Notes
/*
CREATING THE VAO & VBO
======================
Objects must be generated via its corresponding glGen...() function
To perform any operations on any of OpenGL's objects, we must bind
the objects by invoking it corresponding glBind...() function
For @param GLenum target:
GL_ARRAY_BUFFER for Vertex attributes (Non-indexing method)
GL_ELEMENT_ARRAY_BUFFER for Vertex array indices (Indexing method)