Thursday, 23 August 2012

Segfault, an impasse.

SDL2.0 to create a modern OpenGL context.

I've been having difficulty finding documentation for SDL2.0 so I'm going to record the invocations here as I find them... (With thanks to everyone who's helped me find them)

Once I've got a better (and full) handle on it I might try to right a well written tutorial... For now I'll just record my findings.

Requesting a given version of OpenGL


This appears to disable the compatibility profile/enable the core profile only. I need to check this though.

Creating an OpenGL context...

int width = 640; int height = 480;
SDL_Window* pWindow;
SDL_GLContext context;
int other_flags = 0;

pWindow = SDL_CreateWindow("Title", 
width, height, 

context = SDL_GL_CreateContext(pWindow);

Verifying that the Context was created successfully...

const unsigned char* version = glGetString(GL_VERSION);
if (version == NULL) {
// Failed to initialise, error logging here

Flushing pipeline...


Todo: Figure out how to compile/link a shader.

Tuesday, 14 August 2012

Crossplatform Development?

So. I'm finally going back to C++... and remembering why I learned Python to get away from certain things.

Most notably is the pain of setting up Makefiles by hand. Still. I think I've hit on something. Relative to my project's directory...

I have a folder for my build which contains a Makefile customised for that platform. On windows this is...


CFLAGS=-g -O0 -Wall -pedantic -Wno-long-long
LIBS=-lmingw32 -lSDLmain -lSDL -lopengl32 -lphysfs

DLL=SDL.dll libphysfs.dll

include ../src/Makefile.core

It explicitly specifies CC and CXX because I tend to use Cygwin as a replacement shell and it allows me to use make instead of mingw32-make.exe.




all: Coulomb.exe $(DLL)

-include $(DEPS)

Coulomb.exe: $(OBJECTS)
$(CXX) -o Coulomb.exe $(OBJECTS) $(LIBS)

define cc-command
$(CXX) -o $@ -c $< $(CFLAGS)

define depend-command
$(CXX) -MM -MF $(patsubst %.o,%.d,$@) $< $(CFLAGS)

data/%.o: ../src/data/%.cxx

%.o: ../src/%.cxx

%.dll: ../%.dll
cp $< .

.phony: all clean

rm -rf *.exe
rm -rf *.o
rm -rf data/*.o
rm -rf *.d
rm -rf data/*.d
rm -rf *.dll

Unfortunately I still don't really know what I'm going to do with this set up yet. I'd appreciate any comments on the Makefile set up though.

Saturday, 4 August 2012

DuelFieldStars v1 release

I have decided that the DuelFieldStars project no-longer interests me.

Originally I was only going to implement the features it has now and everything else, that I did not implement, were extra things I added to my ambitions. So I am quite happy calling it here.

This has also given me opportunity to play with py2exe. I think in the future I will try to organise my project with py2exe in mind.

Windows distributable:
Clone source (reqs. Python2.7 and Pygame):

I guess this means I need to look for a new project now...