This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
class NaturalTimeSpan: | |
time = 0 | |
def __init__(self, time_string): | |
BAD_STRING = 'Unsupported format string provided: %s' | |
matches = re.search('^(?P<quantity>\d+)\s+(?P<format>second|minute|hour|day|week|year)s?$', time_string) | |
if not matches: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <GL/glew.h> | |
#include <GL/freeglut.h> | |
#define WINDOW_TITLE_PREFIX "Chapter 1" | |
int | |
CurrentWidth = 800, | |
CurrentHeight = 600, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Initialize(int argc, char* argv[]) | |
{ | |
GLenum GlewInitResult; | |
InitWindow(argc, argv); | |
GlewInitResult = glewInit(); | |
if (GLEW_OK != GlewInitResult) { | |
fprintf( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int | |
CurrentWidth = 800, | |
CurrentHeight = 600, | |
WindowHandle = 0; | |
unsigned FrameCount = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Initialize(int, char*[]); | |
void InitWindow(int, char*[]); | |
void ResizeFunction(int, int); | |
void RenderFunction(void); | |
void TimerFunction(int); | |
void IdleFunction(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
glutReshapeFunc(ResizeFunction); | |
glutDisplayFunc(RenderFunction); | |
glutIdleFunc(IdleFunction); | |
glutTimerFunc(0, TimerFunction, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
++FrameCount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void IdleFunction(void) | |
{ | |
glutPostRedisplay(); | |
} | |
void TimerFunction(int Value) | |
{ | |
if (0 != Value) { | |
char* TempString = (char*) | |
malloc(512 + strlen(WINDOW_TITLE_PREFIX)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GLuint | |
VertexShaderId, | |
FragmentShaderId, | |
ProgramId, | |
VaoId, | |
VboId, | |
ColorBufferId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const GLchar* VertexShader = | |
{ | |
"#version 400\n"\ | |
"layout(location=0) in vec4 in_Position;\n"\ | |
"layout(location=1) in vec4 in_Color;\n"\ | |
"out vec4 ex_Color;\n"\ | |
"void main(void)\n"\ | |
"{\n"\ |
OlderNewer