Skip to content

Instantly share code, notes, and snippets.

View gszauer's full-sized avatar
💻
Living life 16.6 ms at a time

Gabor Szauer gszauer

💻
Living life 16.6 ms at a time
View GitHub Profile
/*
* outline.c -- object outlining demo
* last modification: aug. 14, 2007
*
* Copyright (c) 2005-2007 David HENRY
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
/*
* tga.c -- tga texture loader
* last modification: aug. 14, 2007
*
* Copyright (c) 2005-2007 David HENRY
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
/*
* png_mem.c -- png texture loader
* last modification: sep. 22, 2012
*
* Copyright (c) 2005-2012 David HENRY
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
@gszauer
gszauer / pcx.c
Created February 28, 2014 17:50
/*
* pcx.c -- pcx texture loader
* last modification: aug. 14, 2007
*
* Copyright (c) 2005-2007 David HENRY
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
@gszauer
gszauer / microprofile.h
Created May 16, 2014 16:25
MicroProfile
// https://bitbucket.org/jonasmeyer/microprofile/src/978cab41db396a345928d90ead06d1c75d81789a/microprofile.h?at=default
#pragma once
// This is free and unencumbered software released into the public domain.
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
#import "OpenFile.h"
#if __APPLE__
#include <AppKit/AppKit.h>
#endif
/*
#ifndef FileOpen_OpenFile_h
#define FileOpen_OpenFile_h
#include <string>
@gszauer
gszauer / glslToken.cpp
Created July 25, 2014 21:37
Simple tokenizer sample
#include <iostream>
#include <assert.h>
#include <fstream>
#include <stdio.h>
#include <iostream>
#include <cstring>
int main(int argc, const char * argv[]) {
std::ifstream shaderFile("glslTest", std::ifstream::in);
assert (shaderFile);
@gszauer
gszauer / sfb.cpp
Last active August 29, 2015 14:04
ShaderForge Base
struct ShaderObject {
GLuint shaderObject;
SateBlock stateBlock;
std::vector<ShaderProp> publicProperties;
};
char* CompileShader(char* string) {
int numTokens = 0;
char** tokens = new char[][];
#include <X11/Xlib.h>
int main(int argc, char** argv) {
Display* display;
Window window;
Screen* screen;
XEvent ev;
int screenId;
@gszauer
gszauer / X11.md
Last active August 29, 2015 14:09

#Introduction Most tutorials seem to start off with a discussion of how hard X is, how it will mess up your head and how only a masochist would ever write X code with alternates such as SDL out there. This, in my opinion is just wrong. In the trinity of major operating systems i think X is the sanest, most reliable and cleanest designed window manager. With that in mind, lets create an OpenGL enabled X11 window for video games.

#Part 1, Creating a Window The X windowing system uses a client/server architecture. A single machine can have X running in multiple instances.

##Creating an X Window The first thing to do when opening a window under x is to tell it where the screen is. Altough there are several ways of telling the client where the server is, the most fullproof is the DISPLAY environment variable, or using NULL for default.

The function XOpenDisplay(char* display) makes the connection to the X server. It takes one argument, a string using the display format described above, or NULL to