Opengl can open saves now, just need to get it to render accurately later

This commit is contained in:
Bryan Hoyle 2012-06-20 14:23:22 -04:00
parent 088b2f678d
commit c9f837f21d
6 changed files with 30 additions and 26 deletions

View File

@ -21,13 +21,13 @@ powder-x: build/powder-x
powder-x.jnilib: build/powder-x.jnilib powder-x.jnilib: build/powder-x.jnilib
build/powder-release.exe: CFLAGS += -DWIN32 -O3 -ftree-vectorize -msse2 -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -funsafe-loop-optimizations -Wunsafe-loop-optimizations build/powder-release.exe: CFLAGS += -DWIN32 -O3 -ftree-vectorize -msse2 -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -funsafe-loop-optimizations -Wunsafe-loop-optimizations
build/powder-release.exe: LFLAGS := -lmingw32 -lregex -lws2_32 -lSDLmain -lpthread -lSDL -lm -lbz2 -llua -lfftw3f-3 -mwindows build/powder-release.exe: LFLAGS := -lmingw32 -lregex -lws2_32 -lSDLmain -lpthread -lSDL -lm -lbz2 -llua5.1 -lfftw3f-3 -mwindows
build/powder.exe: CFLAGS += -DWIN32 build/powder.exe: CFLAGS += -DWIN32
build/powder.exe: LFLAGS := -lmingw32 -lregex -lws2_32 -lSDLmain -lpthread -lSDL -lm -lbz2 -llua -lfftw3f-3 #-mwindows build/powder.exe: LFLAGS := -lmingw32 -lregex -lws2_32 -lSDLmain -lpthread -lSDL -lm -lbz2 -llua -lfftw3f-3 #-mwindows
build/powder-release: CFLAGS += -DLIN32 -O3 -ftree-vectorize -msse2 -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -funsafe-loop-optimizations -Wunsafe-loop-optimizations build/powder-release: CFLAGS += -DLIN32 -O3 -ftree-vectorize -msse3 -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -funsafe-loop-optimizations -Wunsafe-loop-optimizations -I/usr/include/SDL -I/usr/include/lua50 -DOGLR -DPIX32OGL -DPIXALPHA
build/powder-release: LFLAGS := -lSDL -lm -lbz2 -llua -lfftw3f build/powder-release: LFLAGS := -lSDL -lm -lbz2 -llua5.1 -lfftw3f -lGL -lGLEW -ggdb
build/powder: CFLAGS += -DLIN32 build/powder: CFLAGS += -DLIN32 -DOGLR -DPIX32OGL -DPIXALPHA -I/usr/include/SDL -I/usr/include/lua50
build/powder: LFLAGS := -lSDL -lm -lbz2 -llua -lfftw3f build/powder: LFLAGS := -lSDL -lm -lbz2 -llua5.1 -lfftw3f -lGL -lGLEW -ggdb
#build/powder-x: CFLAGS += -DMACOSX -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/Lua.framework/Headers -I/Library/Frameworks/OpenGL.framework/Headers -DOGLR -DPIX32OGL -DPIXALPHA #build/powder-x: CFLAGS += -DMACOSX -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/Lua.framework/Headers -I/Library/Frameworks/OpenGL.framework/Headers -DOGLR -DPIX32OGL -DPIXALPHA
#build/powder-x: LFLAGS := -lm -lbz2 -lfftw3f -framework SDL -framework Lua -framework Cocoa -framework OpenGL #build/powder-x: LFLAGS := -lm -lbz2 -lfftw3f -framework SDL -framework Lua -framework Cocoa -framework OpenGL
build/powder-x: CFLAGS += -DMACOSX -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/Lua.framework/Headers -DPIX32BGRA build/powder-x: CFLAGS += -DMACOSX -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/Lua.framework/Headers -DPIX32BGRA
@ -45,7 +45,6 @@ build/powder-res.o: resources/powder-res.rc resources/powder.ico resources/docum
mv resources/powder-res.o build/powder-res.o mv resources/powder-res.o build/powder-res.o
build/powder-release: $(SOURCES) build/powder-release: $(SOURCES)
$(CPPC) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(SOURCES) $(LFLAGS) -o $@ $(CPPC) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(SOURCES) $(LFLAGS) -o $@
strip $@
build/powder.exe: buildpaths-powder.exe generate $(patsubst build/obj/%.o,build/obj/powder.exe/%.o,$(OBJS)) build/powder-res.o build/powder.exe: buildpaths-powder.exe generate $(patsubst build/obj/%.o,build/obj/powder.exe/%.o,$(OBJS)) build/powder-res.o
$(CPPC_WIN) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(patsubst build/obj/%.o,build/obj/powder.exe/%.o,$(OBJS)) build/powder-res.o $(LFLAGS) -o $@ -ggdb $(CPPC_WIN) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(patsubst build/obj/%.o,build/obj/powder.exe/%.o,$(OBJS)) build/powder-res.o $(LFLAGS) -o $@ -ggdb

View File

@ -18,7 +18,7 @@
#else #else
//#include <GL/glew.h> #include <GL/glew.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#endif #endif

View File

@ -114,7 +114,7 @@ SDL_Surface * SDLOpen()
surface = SDL_SetVideoMode(XRES + BARSIZE, YRES + MENUSIZE, 32, SDL_OPENGL); surface = SDL_SetVideoMode(XRES + BARSIZE, YRES + MENUSIZE, 32, SDL_OPENGL);
#endif #endif
#if defined(WIN32) && defined(OGLR) #if defined(OGLR)
int status = glewInit(); int status = glewInit();
if(status != GLEW_OK) if(status != GLEW_OK)
{ {

View File

@ -4,7 +4,6 @@
* Created on: Jan 7, 2012 * Created on: Jan 7, 2012
* Author: Simon * Author: Simon
*/ */
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
#include <vector> #include <vector>

View File

@ -2,7 +2,7 @@
#define RENDERER_H #define RENDERER_H
#include <vector> #include <vector>
#if defined(OGLR) #ifdef OGLR
#include "OpenGLHeaders.h" #include "OpenGLHeaders.h"
#endif #endif

View File

@ -19,6 +19,7 @@ SaveRenderer::SaveRenderer(){
Thumbnail * SaveRenderer::Render(GameSave * save) Thumbnail * SaveRenderer::Render(GameSave * save)
{ {
#ifndef OGLR
Thumbnail * tempThumb = NULL; Thumbnail * tempThumb = NULL;
int width, height; int width, height;
width = save->blockWidth; width = save->blockWidth;
@ -30,26 +31,31 @@ Thumbnail * SaveRenderer::Render(GameSave * save)
g->Clear(); g->Clear();
sim->clear_sim(); sim->clear_sim();
if(sim->Load(save)) if(!sim->Load(save))
goto finish;
ren->render_parts();
dst = pData = (pixel *)malloc(PIXELSIZE * ((width*CELL)*(height*CELL)));
for(int i = 0; i < height*CELL; i++)
{ {
memcpy(dst, src, (width*CELL)*PIXELSIZE); ren->render_parts();
dst+=(width*CELL);///PIXELSIZE;
src+=XRES+BARSIZE; pData = (pixel *)malloc(PIXELSIZE * ((width*CELL)*(height*CELL)));
dst = pData;
for(int i = 0; i < height*CELL; i++)
{
printf("%d\n",i);
memcpy(dst, src, (width*CELL)*PIXELSIZE);
dst+=(width*CELL);///PIXELSIZE;
src+=XRES+BARSIZE;
}
tempThumb = new Thumbnail(0, 0, pData, ui::Point(width*CELL, height*CELL));
} }
tempThumb = new Thumbnail(0, 0, pData, ui::Point(width*CELL, height*CELL));
finish:
if(pData) if(pData)
free(pData); free(pData);
return tempThumb; return tempThumb;
#else
VideoBuffer buffer(64, 64);
buffer.SetCharacter(32, 32, 'x', 255, 255, 255, 255);
Thumbnail * thumb = new Thumbnail(0, 0, buffer.Buffer, ui::Point(64, 64));
return thumb;
#endif
} }
Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize) Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize)