Skip to content

Instantly share code, notes, and snippets.

View mortennobel's full-sized avatar

Morten Nobel-Jørgensen mortennobel

View GitHub Profile
@mortennobel
mortennobel / Make environment definitions.txt
Created January 15, 2016 11:57
Make environment definitions
# Using standard definitions from the make environment, typically:
#
# CC cc C compiler
# CXX g++ C++ compiler
# CFLAGS [ ] flags for C and C++ compiler
# CPPFLAGS [ ] flags for C and C++ compiler
# TARGET_ARCH [ ] target architecture
# FFLAGS [ ] flags for Fortran compiler
# RM rm -f delete a file
# AR ar create a static *.a library archive
// Example program:
// Using SDL2 to create an application window
#include "SDL.h"
#include <iostream>
#include <ostream>
#include "SDL_opengl.h"
int main(int argc, char* argv[]) {
@mortennobel
mortennobel / main.cpp
Created November 6, 2014 22:36
Hello Modern OpenGL World (OSX, OGL3.2, GLUT, C++11)
//
// Single file OpenGL example
//
// Created by Morten Nobel-Jørgensen on 06/11/14.
// Copyright (c) 2014 morten. All rights reserved.
//
#include <OpenGL/gl3.h>
#include <GLUT/glut.h>
#include <string>
@mortennobel
mortennobel / main.cpp
Created July 31, 2014 14:50
deprecated
Based on http://stackoverflow.com/a/21265197/420250
#ifdef __GNUC__
#define DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define DEPRECATED __declspec(deprecated)
#else
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
#define DEPRECATED
#endif
@mortennobel
mortennobel / timer.cpp
Last active October 30, 2016 19:52
C++11 timer
#include <iostream>
#include <chrono>
using namespace std;
// Based on http://stackoverflow.com/a/5524138/420250
int main()
{
typedef std::chrono::high_resolution_clock Clock;
using FpMilliseconds = std::chrono::duration<float, std::chrono::milliseconds::period>;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class TRIANGLE {
public Vector3[] p = {Vector3.zero,Vector3.zero,Vector3.zero};
}
public class GRIDCELL {
public Vector3[] p = {Vector3.zero,Vector3.zero,Vector3.zero,Vector3.zero,Vector3.zero,Vector3.zero,Vector3.zero,Vector3.zero};
@mortennobel
mortennobel / MCSpacePartition.cs
Created May 21, 2014 08:58
Simple space partition algorithm which stores two Z planes and swaps between these two planes
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// Simple space partition algorithm which stores two Z planes and swaps between these two planes
/// </summary>
@mortennobel
mortennobel / sdl.cpp
Created May 13, 2014 15:41
OS/X SDL2 Test
#include <stdio.h>
#include <stdlib.h>
/* If using gl3.h */
/* Ensure we are using opengl's core profile only */
#define GL3_PROTOTYPES 1
#include <OpenGL/gl3.h>
#include <iostream>
#include <SDL2/SDL.h>
@mortennobel
mortennobel / ObjFile.cpp
Last active August 29, 2015 14:01
Simple Obj File Loader
//
// Created by Morten Nobel-Jørgensen on 06/05/14.
// Copyright (c) 2014 Morten Nobel-Joergensen. All rights reserved.
//
#include "ObjFile.h"
#include <fstream>
#include <sstream>