Remove pre-processor conditional blocks for OpenGL Renderer and OpenGL Interface graphics.
This commit is contained in:
parent
da5f8068c0
commit
3b3a80d7de
@ -506,11 +506,6 @@ if not GetOption('nolua') and not GetOption('renderer') and not GetOption('font'
|
|||||||
if GetOption('nohttp') or GetOption('renderer'):
|
if GetOption('nohttp') or GetOption('renderer'):
|
||||||
env.Append(CPPDEFINES=['NOHTTP'])
|
env.Append(CPPDEFINES=['NOHTTP'])
|
||||||
|
|
||||||
if GetOption('opengl') or GetOption('opengl-renderer'):
|
|
||||||
env.Append(CPPDEFINES=['OGLI', 'PIX32OGL'])
|
|
||||||
if GetOption('opengl-renderer'):
|
|
||||||
env.Append(CPPDEFINES=['OGLR'])
|
|
||||||
|
|
||||||
if GetOption('renderer'):
|
if GetOption('renderer'):
|
||||||
env.Append(CPPDEFINES=['RENDERER'])
|
env.Append(CPPDEFINES=['RENDERER'])
|
||||||
|
|
||||||
|
@ -135,12 +135,6 @@ void CalculateMousePosition(int *x, int *y)
|
|||||||
*y = (globalMy - windowY) / scale;
|
*y = (globalMy - windowY) / scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OGLI
|
|
||||||
void blit()
|
|
||||||
{
|
|
||||||
SDL_GL_SwapBuffers();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void blit(pixel * vid)
|
void blit(pixel * vid)
|
||||||
{
|
{
|
||||||
SDL_UpdateTexture(sdl_texture, NULL, vid, WINDOWW * sizeof (Uint32));
|
SDL_UpdateTexture(sdl_texture, NULL, vid, WINDOWW * sizeof (Uint32));
|
||||||
@ -150,7 +144,6 @@ void blit(pixel * vid)
|
|||||||
SDL_RenderCopy(sdl_renderer, sdl_texture, NULL, NULL);
|
SDL_RenderCopy(sdl_renderer, sdl_texture, NULL, NULL);
|
||||||
SDL_RenderPresent(sdl_renderer);
|
SDL_RenderPresent(sdl_renderer);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void RecreateWindow();
|
void RecreateWindow();
|
||||||
int SDLOpen()
|
int SDLOpen()
|
||||||
@ -520,11 +513,7 @@ void EngineProcess()
|
|||||||
engine->GetForceIntegerScaling());
|
engine->GetForceIntegerScaling());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OGLI
|
|
||||||
blit();
|
|
||||||
#else
|
|
||||||
blit(engine->g->vid);
|
blit(engine->g->vid);
|
||||||
#endif
|
|
||||||
|
|
||||||
int frameTime = SDL_GetTicks() - frameStart;
|
int frameTime = SDL_GetTicks() - frameStart;
|
||||||
frameTimeAvg = frameTimeAvg * 0.8 + frameTime * 0.2;
|
frameTimeAvg = frameTimeAvg * 0.8 + frameTime * 0.2;
|
||||||
@ -590,11 +579,8 @@ void BlueScreen(String detailMessage)
|
|||||||
while (SDL_PollEvent(&event))
|
while (SDL_PollEvent(&event))
|
||||||
if(event.type == SDL_QUIT)
|
if(event.type == SDL_QUIT)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
#ifdef OGLI
|
|
||||||
blit();
|
|
||||||
#else
|
|
||||||
blit(engine->g->vid);
|
blit(engine->g->vid);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,18 +703,6 @@ int main(int argc, char * argv[])
|
|||||||
showDoubleScreenDialog = true;
|
showDoubleScreenDialog = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OGLI
|
|
||||||
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
|
||||||
//glScaled(2.0f, 2.0f, 1.0f);
|
|
||||||
#endif
|
|
||||||
#if defined(OGLI) && !defined(MACOSX)
|
|
||||||
int status = glewInit();
|
|
||||||
if(status != GLEW_OK)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Initializing Glew: %d\n", status);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ui::Engine::Ref().g = new Graphics();
|
ui::Engine::Ref().g = new Graphics();
|
||||||
ui::Engine::Ref().Scale = scale;
|
ui::Engine::Ref().Scale = scale;
|
||||||
ui::Engine::Ref().SetResizable(resizable);
|
ui::Engine::Ref().SetResizable(resizable);
|
||||||
@ -806,11 +780,9 @@ int main(int argc, char * argv[])
|
|||||||
engine->g->drawrect((engine->GetWidth()/2)-100, (engine->GetHeight()/2)-25, 200, 50, 255, 255, 255, 180);
|
engine->g->drawrect((engine->GetWidth()/2)-100, (engine->GetHeight()/2)-25, 200, 50, 255, 255, 255, 180);
|
||||||
engine->g->drawtext((engine->GetWidth()/2)-(Graphics::textwidth("Loading save...")/2), (engine->GetHeight()/2)-5, "Loading save...", style::Colour::InformationTitle.Red, style::Colour::InformationTitle.Green, style::Colour::InformationTitle.Blue, 255);
|
engine->g->drawtext((engine->GetWidth()/2)-(Graphics::textwidth("Loading save...")/2), (engine->GetHeight()/2)-5, "Loading save...", style::Colour::InformationTitle.Red, style::Colour::InformationTitle.Green, style::Colour::InformationTitle.Blue, 255);
|
||||||
|
|
||||||
#ifdef OGLI
|
|
||||||
blit();
|
|
||||||
#else
|
|
||||||
blit(engine->g->vid);
|
blit(engine->g->vid);
|
||||||
#endif
|
|
||||||
ByteString ptsaveArg = arguments["ptsave"];
|
ByteString ptsaveArg = arguments["ptsave"];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1061,10 +1061,7 @@ pixel *Graphics::render_packed_rgb(void *image, int width, int height, int cmp_s
|
|||||||
|
|
||||||
VideoBuffer Graphics::DumpFrame()
|
VideoBuffer Graphics::DumpFrame()
|
||||||
{
|
{
|
||||||
#ifdef OGLI
|
|
||||||
#else
|
|
||||||
VideoBuffer newBuffer(WINDOWW, WINDOWH);
|
VideoBuffer newBuffer(WINDOWW, WINDOWH);
|
||||||
std::copy(vid, vid+(WINDOWW*WINDOWH), newBuffer.Buffer);
|
std::copy(vid, vid+(WINDOWW*WINDOWH), newBuffer.Buffer);
|
||||||
return newBuffer;
|
return newBuffer;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
#define GRAPHICS_H
|
#define GRAPHICS_H
|
||||||
|
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#if defined(OGLI)
|
|
||||||
#include "OpenGLHeaders.h"
|
|
||||||
#endif
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "common/tpt-inline.h"
|
#include "common/tpt-inline.h"
|
||||||
#include "Pixel.h"
|
#include "Pixel.h"
|
||||||
@ -25,20 +22,6 @@ public:
|
|||||||
void Resize(int width, int height, bool resample = false, bool fixedRatio = true);
|
void Resize(int width, int height, bool resample = false, bool fixedRatio = true);
|
||||||
TPT_INLINE void BlendPixel(int x, int y, int r, int g, int b, int a)
|
TPT_INLINE void BlendPixel(int x, int y, int r, int g, int b, int a)
|
||||||
{
|
{
|
||||||
#ifdef PIX32OGL
|
|
||||||
pixel t;
|
|
||||||
if (x<0 || y<0 || x>=Width || y>=Height)
|
|
||||||
return;
|
|
||||||
if (a!=255)
|
|
||||||
{
|
|
||||||
t = Buffer[y*(Width)+x];
|
|
||||||
r = (a*r + (255-a)*PIXR(t)) >> 8;
|
|
||||||
g = (a*g + (255-a)*PIXG(t)) >> 8;
|
|
||||||
b = (a*b + (255-a)*PIXB(t)) >> 8;
|
|
||||||
a = a > PIXA(t) ? a : PIXA(t);
|
|
||||||
}
|
|
||||||
Buffer[y*(Width)+x] = PIXRGBA(r,g,b,a);
|
|
||||||
#else
|
|
||||||
pixel t;
|
pixel t;
|
||||||
if (x<0 || y<0 || x>=Width || y>=Height)
|
if (x<0 || y<0 || x>=Width || y>=Height)
|
||||||
return;
|
return;
|
||||||
@ -50,18 +33,13 @@ public:
|
|||||||
b = (a*b + (255-a)*PIXB(t)) >> 8;
|
b = (a*b + (255-a)*PIXB(t)) >> 8;
|
||||||
}
|
}
|
||||||
Buffer[y*(Width)+x] = PIXRGB(r,g,b);
|
Buffer[y*(Width)+x] = PIXRGB(r,g,b);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TPT_INLINE void SetPixel(int x, int y, int r, int g, int b, int a)
|
TPT_INLINE void SetPixel(int x, int y, int r, int g, int b, int a)
|
||||||
{
|
{
|
||||||
if (x<0 || y<0 || x>=Width || y>=Height)
|
if (x<0 || y<0 || x>=Width || y>=Height)
|
||||||
return;
|
return;
|
||||||
#ifdef PIX32OGL
|
|
||||||
Buffer[y*(Width)+x] = PIXRGBA(r,g,b,a);
|
|
||||||
#else
|
|
||||||
Buffer[y*(Width)+x] = PIXRGB((r*a)>>8, (g*a)>>8, (b*a)>>8);
|
Buffer[y*(Width)+x] = PIXRGB((r*a)>>8, (g*a)>>8, (b*a)>>8);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TPT_INLINE void AddPixel(int x, int y, int r, int g, int b, int a)
|
TPT_INLINE void AddPixel(int x, int y, int r, int g, int b, int a)
|
||||||
@ -92,14 +70,6 @@ class Graphics
|
|||||||
public:
|
public:
|
||||||
pixel *vid;
|
pixel *vid;
|
||||||
int sdl_scale;
|
int sdl_scale;
|
||||||
#ifdef OGLI
|
|
||||||
//OpenGL specific instance variables
|
|
||||||
GLuint vidBuf, textTexture;
|
|
||||||
void Reset();
|
|
||||||
void LoadDefaults();
|
|
||||||
void InitialiseTextures();
|
|
||||||
void DestroyTextures();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Common graphics methods in Graphics.cpp
|
//Common graphics methods in Graphics.cpp
|
||||||
static char * GenerateGradient(pixel * colours, float * points, int pointcount, int size);
|
static char * GenerateGradient(pixel * colours, float * points, int pointcount, int size);
|
||||||
|
@ -24,16 +24,6 @@
|
|||||||
#define PIXR(x) (((x)>>8)&0xFF)
|
#define PIXR(x) (((x)>>8)&0xFF)
|
||||||
#define PIXG(x) (((x)>>16)&0xFF)
|
#define PIXG(x) (((x)>>16)&0xFF)
|
||||||
#define PIXB(x) (((x)>>24)&0xFF)
|
#define PIXB(x) (((x)>>24)&0xFF)
|
||||||
#elif defined(PIX32OGL)
|
|
||||||
#undef PIXELCHANNELS
|
|
||||||
#define PIXELCHANNELS 4
|
|
||||||
#define PIXPACK(x) (0xFF000000|((x)&0xFFFFFF)) //32bit ARGB in 32bit int: AARRGGBB
|
|
||||||
#define PIXRGB(r,g,b) (0xFF000000|((r)<<16)|((g)<<8)|((b)))
|
|
||||||
#define PIXRGBA(r,g,b,a) (((a)<<24)|((r)<<16)|((g)<<8)|((b)))
|
|
||||||
#define PIXA(x) (((x)>>24)&0xFF)
|
|
||||||
#define PIXR(x) (((x)>>16)&0xFF)
|
|
||||||
#define PIXG(x) (((x)>>8)&0xFF)
|
|
||||||
#define PIXB(x) ((x)&0xFF)
|
|
||||||
#else
|
#else
|
||||||
#define PIXPACK(x) (x) //24bit RGB in 32bit int: 00RRGGBB.
|
#define PIXPACK(x) (x) //24bit RGB in 32bit int: 00RRGGBB.
|
||||||
#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b))
|
#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b))
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#ifndef OGLI
|
|
||||||
|
|
||||||
Graphics::Graphics():
|
Graphics::Graphics():
|
||||||
sdl_scale(1)
|
sdl_scale(1)
|
||||||
{
|
{
|
||||||
@ -34,5 +32,3 @@ void Graphics::Finalise()
|
|||||||
#undef VIDYRES
|
#undef VIDYRES
|
||||||
#undef VIDXRES
|
#undef VIDXRES
|
||||||
#undef PIXELMETHODS_CLASS
|
#undef PIXELMETHODS_CLASS
|
||||||
|
|
||||||
#endif
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,9 +2,6 @@
|
|||||||
#define RENDERER_H
|
#define RENDERER_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#ifdef OGLR
|
|
||||||
#include "OpenGLHeaders.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
@ -97,13 +94,6 @@ public:
|
|||||||
void clearScreen(float alpha);
|
void clearScreen(float alpha);
|
||||||
void SetSample(int x, int y);
|
void SetSample(int x, int y);
|
||||||
|
|
||||||
#ifdef OGLR
|
|
||||||
void checkShader(GLuint shader, const char * shname);
|
|
||||||
void checkProgram(GLuint program, const char * progname);
|
|
||||||
void loadShaders();
|
|
||||||
GLuint vidBuf,textTexture;
|
|
||||||
GLint prevFbo;
|
|
||||||
#endif
|
|
||||||
pixel * vid;
|
pixel * vid;
|
||||||
pixel * persistentVid;
|
pixel * persistentVid;
|
||||||
pixel * warpVid;
|
pixel * warpVid;
|
||||||
@ -166,26 +156,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int gridSize;
|
int gridSize;
|
||||||
#ifdef OGLR
|
|
||||||
GLuint zoomTex, airBuf, fireAlpha, glowAlpha, blurAlpha, partsFboTex, partsFbo, partsTFX, partsTFY, airPV, airVY, airVX;
|
|
||||||
GLuint fireProg, airProg_Pressure, airProg_Velocity, airProg_Cracker, lensProg;
|
|
||||||
GLuint fireV[(YRES*XRES)*2];
|
|
||||||
GLfloat fireC[(YRES*XRES)*4];
|
|
||||||
GLuint smokeV[(YRES*XRES)*2];
|
|
||||||
GLfloat smokeC[(YRES*XRES)*4];
|
|
||||||
GLuint blobV[(YRES*XRES)*2];
|
|
||||||
GLfloat blobC[(YRES*XRES)*4];
|
|
||||||
GLuint blurV[(YRES*XRES)*2];
|
|
||||||
GLfloat blurC[(YRES*XRES)*4];
|
|
||||||
GLuint glowV[(YRES*XRES)*2];
|
|
||||||
GLfloat glowC[(YRES*XRES)*4];
|
|
||||||
GLuint flatV[(YRES*XRES)*2];
|
|
||||||
GLfloat flatC[(YRES*XRES)*4];
|
|
||||||
GLuint addV[(YRES*XRES)*2];
|
|
||||||
GLfloat addC[(YRES*XRES)*4];
|
|
||||||
GLfloat lineV[(((YRES*XRES)*2)*6)];
|
|
||||||
GLfloat lineC[(((YRES*XRES)*2)*6)];
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2416,7 +2416,6 @@ void GameView::OnDraw()
|
|||||||
g->fillrect(XRES-20-textWidth, 12, textWidth+8, 15, 0, 0, 0, alpha*0.5f);
|
g->fillrect(XRES-20-textWidth, 12, textWidth+8, 15, 0, 0, 0, alpha*0.5f);
|
||||||
g->drawtext(XRES-16-textWidth, 16, sampleInfo.Build(), 255, 255, 255, alpha*0.75f);
|
g->drawtext(XRES-16-textWidth, 16, sampleInfo.Build(), 255, 255, 255, alpha*0.75f);
|
||||||
|
|
||||||
#ifndef OGLI
|
|
||||||
if (wavelengthGfx)
|
if (wavelengthGfx)
|
||||||
{
|
{
|
||||||
int i, cr, cg, cb, j, h = 3, x = XRES-19-textWidth, y = 10;
|
int i, cr, cg, cb, j, h = 3, x = XRES-19-textWidth, y = 10;
|
||||||
@ -2451,7 +2450,6 @@ void GameView::OnDraw()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (showDebug)
|
if (showDebug)
|
||||||
{
|
{
|
||||||
|
@ -212,20 +212,13 @@ void SignWindow::DoDraw()
|
|||||||
y = currentSign.y;
|
y = currentSign.y;
|
||||||
dx = 1 - currentSign.ju;
|
dx = 1 - currentSign.ju;
|
||||||
dy = (currentSign.y > 18) ? -1 : 1;
|
dy = (currentSign.y > 18) ? -1 : 1;
|
||||||
#ifdef OGLR
|
|
||||||
glBegin(GL_LINES);
|
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
glVertex2i(x, y);
|
|
||||||
glVertex2i(x+(dx*4), y+(dy*4));
|
|
||||||
glEnd();
|
|
||||||
#else
|
|
||||||
for (int j=0; j<4; j++)
|
for (int j=0; j<4; j++)
|
||||||
{
|
{
|
||||||
g->blendpixel(x, y, 192, 192, 192, 255);
|
g->blendpixel(x, y, 192, 192, 192, 255);
|
||||||
x+=dx;
|
x+=dx;
|
||||||
y+=dy;
|
y+=dy;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!signMoving)
|
if(!signMoving)
|
||||||
|
@ -117,9 +117,7 @@ void Engine::ShowWindow(Window * window)
|
|||||||
}
|
}
|
||||||
lastBuffer = (pixel*)malloc((width_ * height_) * PIXELSIZE);
|
lastBuffer = (pixel*)malloc((width_ * height_) * PIXELSIZE);
|
||||||
|
|
||||||
#ifndef OGLI
|
|
||||||
memcpy(lastBuffer, g->vid, (width_ * height_) * PIXELSIZE);
|
memcpy(lastBuffer, g->vid, (width_ * height_) * PIXELSIZE);
|
||||||
#endif
|
|
||||||
|
|
||||||
windows.push(state_);
|
windows.push(state_);
|
||||||
mousePositions.push(ui::Point(mousex_, mousey_));
|
mousePositions.push(ui::Point(mousex_, mousey_));
|
||||||
@ -225,12 +223,10 @@ void Engine::Draw()
|
|||||||
if(lastBuffer && !(state_ && state_->Position.X == 0 && state_->Position.Y == 0 && state_->Size.X == width_ && state_->Size.Y == height_))
|
if(lastBuffer && !(state_ && state_->Position.X == 0 && state_->Position.Y == 0 && state_->Size.X == width_ && state_->Size.Y == height_))
|
||||||
{
|
{
|
||||||
g->Clear();
|
g->Clear();
|
||||||
#ifndef OGLI
|
|
||||||
memcpy(g->vid, lastBuffer, (width_ * height_) * PIXELSIZE);
|
memcpy(g->vid, lastBuffer, (width_ * height_) * PIXELSIZE);
|
||||||
if(windowOpenState < 20)
|
if(windowOpenState < 20)
|
||||||
windowOpenState++;
|
windowOpenState++;
|
||||||
g->fillrect(0, 0, width_, height_, 0, 0, 0, 255-std::pow(.98, windowOpenState)*255);
|
g->fillrect(0, 0, width_, height_, 0, 0, 0, 255-std::pow(.98, windowOpenState)*255);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -13,30 +13,7 @@ Panel::Panel(Point position, Point size):
|
|||||||
ViewportPosition(0, 0),
|
ViewportPosition(0, 0),
|
||||||
mouseInside(false)
|
mouseInside(false)
|
||||||
{
|
{
|
||||||
#ifdef OGLI
|
|
||||||
GLint lastVid;
|
|
||||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &lastVid);
|
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
|
||||||
glGenTextures(1, &myVidTex);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, myVidTex);
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, WINDOWW, WINDOWH, 0, GL_RGBA, GL_FLOAT, NULL);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
|
||||||
|
|
||||||
//FBO
|
|
||||||
glGenFramebuffers(1, &myVid);
|
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, myVid);
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, myVidTex, 0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); // Reset framebuffer binding
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
|
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, lastVid);
|
|
||||||
#else
|
|
||||||
myVid = new pixel[WINDOWW*WINDOWH];
|
myVid = new pixel[WINDOWW*WINDOWH];
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Panel::~Panel()
|
Panel::~Panel()
|
||||||
@ -45,12 +22,8 @@ Panel::~Panel()
|
|||||||
{
|
{
|
||||||
delete children[i];
|
delete children[i];
|
||||||
}
|
}
|
||||||
#ifdef OGLI
|
|
||||||
glDeleteTextures(1, &myVidTex);
|
|
||||||
glDeleteFramebuffers(1, &myVid);
|
|
||||||
#else
|
|
||||||
delete[] myVid;
|
delete[] myVid;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::AddChild(Component* c)
|
void Panel::AddChild(Component* c)
|
||||||
@ -97,17 +70,10 @@ void Panel::Draw(const Point& screenPos)
|
|||||||
|
|
||||||
// draw ourself first
|
// draw ourself first
|
||||||
XDraw(screenPos);
|
XDraw(screenPos);
|
||||||
#ifdef OGLI
|
|
||||||
GLint lastVid;
|
|
||||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &lastVid);
|
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, myVid);
|
|
||||||
glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
#else
|
|
||||||
pixel * lastVid = ui::Engine::Ref().g->vid;
|
pixel * lastVid = ui::Engine::Ref().g->vid;
|
||||||
ui::Engine::Ref().g->vid = myVid;
|
ui::Engine::Ref().g->vid = myVid;
|
||||||
std::fill(myVid, myVid+(WINDOWW*WINDOWH), 0);
|
std::fill(myVid, myVid+(WINDOWW*WINDOWH), 0);
|
||||||
#endif
|
|
||||||
|
|
||||||
// attempt to draw all children
|
// attempt to draw all children
|
||||||
for (size_t i = 0; i < children.size(); ++i)
|
for (size_t i = 0; i < children.size(); ++i)
|
||||||
@ -127,32 +93,6 @@ void Panel::Draw(const Point& screenPos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OGLI
|
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, lastVid);
|
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, myVidTex);
|
|
||||||
|
|
||||||
int x = screenPos.X, y = screenPos.Y;
|
|
||||||
int h = Size.Y, w = Size.X;
|
|
||||||
|
|
||||||
double texX = double(Size.X)/WINDOWW, texY = 1, texYB = 1-(double(Size.Y)/WINDOWH);
|
|
||||||
|
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
glBegin(GL_QUADS);
|
|
||||||
glTexCoord2d(0, texYB);
|
|
||||||
glVertex2f(x, y+h);
|
|
||||||
glTexCoord2d(texX, texYB);
|
|
||||||
glVertex2f(x+w, y+h);
|
|
||||||
glTexCoord2d(texX, texY);
|
|
||||||
glVertex2f(x+w, y);
|
|
||||||
glTexCoord2d(0, texY);
|
|
||||||
glVertex2f(x, y);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
#else
|
|
||||||
ui::Engine::Ref().g->vid = lastVid;
|
ui::Engine::Ref().g->vid = lastVid;
|
||||||
|
|
||||||
//dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x;
|
//dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x;
|
||||||
@ -160,7 +100,6 @@ void Panel::Draw(const Point& screenPos)
|
|||||||
{
|
{
|
||||||
std::copy(myVid+(row*WINDOWW), myVid+(row*WINDOWW)+Size.X, lastVid+((screenPos.Y+row)*WINDOWW)+screenPos.X);
|
std::copy(myVid+(row*WINDOWW), myVid+(row*WINDOWW)+Size.X, lastVid+((screenPos.Y+row)*WINDOWW)+screenPos.X);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::Tick(float dt)
|
void Panel::Tick(float dt)
|
||||||
|
@ -5,11 +5,6 @@
|
|||||||
#include "gui/interface/Point.h"
|
#include "gui/interface/Point.h"
|
||||||
#include "gui/interface/Component.h"
|
#include "gui/interface/Component.h"
|
||||||
|
|
||||||
#ifdef OGLI
|
|
||||||
#include "graphics/OpenGLHeaders.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
class Graphics;
|
class Graphics;
|
||||||
namespace ui
|
namespace ui
|
||||||
{
|
{
|
||||||
@ -27,11 +22,8 @@ class Component;
|
|||||||
public:
|
public:
|
||||||
friend class Component;
|
friend class Component;
|
||||||
|
|
||||||
#ifdef OGLI
|
|
||||||
GLuint myVid, myVidTex;
|
|
||||||
#else
|
|
||||||
pixel * myVid;
|
pixel * myVid;
|
||||||
#endif
|
|
||||||
ui::Point InnerSize;
|
ui::Point InnerSize;
|
||||||
ui::Point ViewportPosition;
|
ui::Point ViewportPosition;
|
||||||
|
|
||||||
|
@ -109,13 +109,9 @@ void Slider::Draw(const Point& screenPos)
|
|||||||
|
|
||||||
if(bgGradient)
|
if(bgGradient)
|
||||||
{
|
{
|
||||||
#ifndef OGLI
|
|
||||||
for (int j = 3; j < Size.Y-7; j++)
|
for (int j = 3; j < Size.Y-7; j++)
|
||||||
for (int i = 3; i < Size.X-7; i++)
|
for (int i = 3; i < Size.X-7; i++)
|
||||||
g->blendpixel(screenPos.X+i+2, screenPos.Y+j+2, bgGradient[(i-3)*3], bgGradient[(i-3)*3+1], bgGradient[(i-3)*3+2], 255);
|
g->blendpixel(screenPos.X+i+2, screenPos.Y+j+2, bgGradient[(i-3)*3], bgGradient[(i-3)*3+1], bgGradient[(i-3)*3+2], 255);
|
||||||
#else
|
|
||||||
g->gradientrect(screenPos.X+5, screenPos.Y+5, Size.X-10, Size.Y-10, col1.Red, col1.Green, col1.Blue, col1.Alpha, col2.Red, col2.Green, col2.Blue, col2.Alpha);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g->drawrect(screenPos.X+3, screenPos.Y+3, Size.X-6, Size.Y-6, 255, 255, 255, 255);
|
g->drawrect(screenPos.X+3, screenPos.Y+3, Size.X-6, Size.Y-6, 255, 255, 255, 255);
|
||||||
|
@ -246,11 +246,7 @@ RenderView::RenderView():
|
|||||||
tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_WARP));
|
tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_WARP));
|
||||||
AddComponent(tCheckbox);
|
AddComponent(tCheckbox);
|
||||||
|
|
||||||
#ifdef OGLR
|
|
||||||
tCheckbox = new ui::Checkbox(ui::Point(checkboxOffset, YRES+4), ui::Point(30, 16), "Effect", "Some type of OpenGL effect ... maybe"); //I would remove the whole checkbox, but then there's a large empty space
|
|
||||||
#else
|
|
||||||
tCheckbox = new ui::Checkbox(ui::Point(checkboxOffset, YRES+4), ui::Point(30, 16), "Effect", "Enables moving solids, stickmen guns, and premium(tm) graphics");
|
tCheckbox = new ui::Checkbox(ui::Point(checkboxOffset, YRES+4), ui::Point(30, 16), "Effect", "Enables moving solids, stickmen guns, and premium(tm) graphics");
|
||||||
#endif
|
|
||||||
displayModes.push_back(tCheckbox);
|
displayModes.push_back(tCheckbox);
|
||||||
tCheckbox->SetIcon(IconEffect);
|
tCheckbox->SetIcon(IconEffect);
|
||||||
tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_EFFE));
|
tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_EFFE));
|
||||||
|
@ -13,24 +13,6 @@ SaveRenderer::SaveRenderer(){
|
|||||||
ren = new Renderer(g, sim);
|
ren = new Renderer(g, sim);
|
||||||
ren->decorations_enable = true;
|
ren->decorations_enable = true;
|
||||||
ren->blackDecorations = true;
|
ren->blackDecorations = true;
|
||||||
|
|
||||||
#if defined(OGLR) || defined(OGLI)
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
|
||||||
glGenTextures(1, &fboTex);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, fboTex);
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, XRES, YRES, 0, GL_RGBA, GL_FLOAT, NULL);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
|
||||||
|
|
||||||
//FBO
|
|
||||||
glGenFramebuffers(1, &fbo);
|
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fboTex, 0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); // Reset framebuffer binding
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoBuffer * SaveRenderer::Render(GameSave * save, bool decorations, bool fire)
|
VideoBuffer * SaveRenderer::Render(GameSave * save, bool decorations, bool fire)
|
||||||
@ -50,67 +32,7 @@ VideoBuffer * SaveRenderer::Render(GameSave * save, bool decorations, bool fire)
|
|||||||
{
|
{
|
||||||
ren->decorations_enable = true;
|
ren->decorations_enable = true;
|
||||||
ren->blackDecorations = !decorations;
|
ren->blackDecorations = !decorations;
|
||||||
#if defined(OGLR) || defined(OGLI)
|
|
||||||
pixel * pData = NULL;
|
|
||||||
unsigned char * texData = NULL;
|
|
||||||
|
|
||||||
glTranslated(0, MENUSIZE, 0);
|
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
|
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
|
|
||||||
ren->clearScreen(1.0f);
|
|
||||||
ren->ClearAccumulation();
|
|
||||||
|
|
||||||
#ifdef OGLR
|
|
||||||
ren->RenderBegin();
|
|
||||||
ren->RenderEnd();
|
|
||||||
#else
|
|
||||||
if (fire)
|
|
||||||
{
|
|
||||||
int frame = 15;
|
|
||||||
while(frame)
|
|
||||||
{
|
|
||||||
frame--;
|
|
||||||
ren->render_parts();
|
|
||||||
ren->render_fire();
|
|
||||||
ren->clearScreen(1.0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ren->RenderBegin();
|
|
||||||
ren->RenderEnd();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
|
||||||
glTranslated(0, -MENUSIZE, 0);
|
|
||||||
|
|
||||||
glEnable( GL_TEXTURE_2D );
|
|
||||||
glBindTexture(GL_TEXTURE_2D, fboTex);
|
|
||||||
|
|
||||||
pData = new pixel[XRES*YRES];
|
|
||||||
texData = new unsigned char[(XRES*YRES)*PIXELSIZE];
|
|
||||||
std::fill(texData, texData+(XRES*YRES)*PIXELSIZE, 0xDD);
|
|
||||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, texData);
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
|
|
||||||
for(int x = 0; x < width*CELL; x++)
|
|
||||||
{
|
|
||||||
for(int y = 0; y < height*CELL; y++)
|
|
||||||
{
|
|
||||||
unsigned char red = texData[((((YRES-1-y)*XRES)+x)*4)];
|
|
||||||
unsigned char green = texData[((((YRES-1-y)*XRES)+x)*4)+1];
|
|
||||||
unsigned char blue = texData[((((YRES-1-y)*XRES)+x)*4)+2];
|
|
||||||
|
|
||||||
pData[(y*(width*CELL))+x] = PIXRGBA(red, green, blue, 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tempThumb = new VideoBuffer(pData, width*CELL, height*CELL);
|
|
||||||
delete[] pData;
|
|
||||||
delete[] texData;
|
|
||||||
pData = NULL;
|
|
||||||
#else
|
|
||||||
pixel * pData = NULL;
|
pixel * pData = NULL;
|
||||||
pixel * dst;
|
pixel * dst;
|
||||||
pixel * src = g->vid;
|
pixel * src = g->vid;
|
||||||
@ -143,7 +65,6 @@ VideoBuffer * SaveRenderer::Render(GameSave * save, bool decorations, bool fire)
|
|||||||
}
|
}
|
||||||
tempThumb = new VideoBuffer(pData, width*CELL, height*CELL);
|
tempThumb = new VideoBuffer(pData, width*CELL, height*CELL);
|
||||||
free(pData);
|
free(pData);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if(doCollapse)
|
if(doCollapse)
|
||||||
save->Collapse();
|
save->Collapse();
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#ifndef SAVERENDERER_H_
|
#ifndef SAVERENDERER_H_
|
||||||
#define SAVERENDERER_H_
|
#define SAVERENDERER_H_
|
||||||
#ifdef OGLI
|
|
||||||
#include "graphics/OpenGLHeaders.h"
|
|
||||||
#endif
|
|
||||||
#include "common/Singleton.h"
|
#include "common/Singleton.h"
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
@ -24,11 +21,6 @@ public:
|
|||||||
void CopyModes(Renderer *source);
|
void CopyModes(Renderer *source);
|
||||||
void ResetModes();
|
void ResetModes();
|
||||||
virtual ~SaveRenderer();
|
virtual ~SaveRenderer();
|
||||||
|
|
||||||
private:
|
|
||||||
#if defined(OGLR) || defined(OGLI)
|
|
||||||
GLuint fboTex, fbo;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SAVERENDERER_H_ */
|
#endif /* SAVERENDERER_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user