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
class TimeAccum | |
{ | |
public: | |
TimeAccum(int frequency) : time_previous(0), accum_delta_error(0), accum_time(0), time(0) | |
{ | |
/* frequency is updates / sec, for example 30 or 60 fps */ | |
/* almost everything is 15.16Q fixedpoint */ | |
timestep = 65536 / frequency; | |
} | |
void advanceTime() |
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 <sstream> | |
#include <string> | |
#include <vector> | |
#include <iostream> | |
#include <stdexcept> | |
/* Symptoms : std::istringstream::operator>> fails on the second run, while parsing "2.0" | |
Workaround: Recreate the istringstream object prior each call to operator>>, instead of resetting it with .str("") | |
But what causes this? | |
*/ |
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
CXX = g++ | |
CXXFLAGS = -c -O3 -fomit-frame-pointer -Wall -Wextra `pkg-config --cflags libxml++-2.6` | |
LDFLAGS = -lpthread -lpng -lz `pkg-config --libs libxml++-2.6` | |
OBJDIR = build | |
OBJS = $(OBJDIR)/main.o $(OBJDIR)/image.o $(OBJDIR)/primitives.o $(OBJDIR)/xmlconfig.o | |
.PHONY : all | |
.PHONY : dirtest | |
all: \ |
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 <QtGui/QApplication> | |
#include <QSplitter> | |
#include <QPushButton> | |
class QCustomSplitter : public QSplitter | |
{ | |
Q_OBJECT | |
public: | |
QCustomSplitter(QWidget* parent = 0); | |
QCustomSplitter(Qt::Orientation orient, QWidget* parent = 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
typedef struct TimeInfo | |
{ | |
uint32_t accum; | |
uint32_t delta_error_accum; | |
uint32_t previous_tick; | |
uint32_t globaltime; | |
uint32_t frequency; //like 1/60 in 15.16 fixedpoint | |
} TimeInfo; | |
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
test: main.c:24: main: Assertion `0' failed. | |
[New Thread 0xb7dd68d0 (LWP 32185)] | |
Program received signal SIGABRT, Aborted. | |
[Switching to Thread 0xb7dd68d0 (LWP 32185)] | |
0xb7fd0430 in __kernel_vsyscall () | |
(gdb) signal 0 | |
Continuing with no signal. | |
Program received signal SIGABRT, Aborted. |
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 <SDL/SDL.h> | |
SDL_Surface* s; SDL_Event e; | |
void render() | |
{ | |
unsigned char* pix = screen->pixels; | |
SDL_LockSurface(s); | |
for(int y=0;y<600;++y){ | |
int c=y*800; | |
for(int x=0;x<800;++x){ | |
int i= (col+x)*4; |
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
DrawArrays | |
MultiDrawArrays | |
DrawElements | |
MultiDrawElements | |
DrawRangeElements | |
DrawArraysInstanced | |
DrawElementsInstanced | |
DrawElementsBaseVertex | |
DrawRangeElementsBaseVertex | |
DrawElementsInstancedBaseVertex |
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
for(int i=0; i<NUM_JOBS; ++i){ | |
LoadResource(i); | |
glClear(GL_COLOR_BUFFER_BIT); | |
RenderProgress((float)i/(float)NUM_JOBS); | |
SwapBuffers(); | |
} |
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
class Base{ | |
public: | |
Base(){} | |
void Doit(){ | |
stage1(); | |
stage2(); | |
stage3(); | |
} | |
private; | |
void stage1(){ .. } |
OlderNewer