Skip to content

Instantly share code, notes, and snippets.

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()
#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?
*/
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: \
#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);
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;
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.
#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;
DrawArrays
MultiDrawArrays
DrawElements
MultiDrawElements
DrawRangeElements
DrawArraysInstanced
DrawElementsInstanced
DrawElementsBaseVertex
DrawRangeElementsBaseVertex
DrawElementsInstancedBaseVertex
for(int i=0; i<NUM_JOBS; ++i){
LoadResource(i);
glClear(GL_COLOR_BUFFER_BIT);
RenderProgress((float)i/(float)NUM_JOBS);
SwapBuffers();
}
class Base{
public:
Base(){}
void Doit(){
stage1();
stage2();
stage3();
}
private;
void stage1(){ .. }