Warp display with newer shader, Render options works in OpenGL

This commit is contained in:
Simon Robertshaw 2012-05-17 22:34:16 +01:00
parent 8efd07a849
commit 2c5400a732
4 changed files with 31 additions and 8 deletions

View File

@ -2001,18 +2001,18 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &partsTFX);
glBindTexture(GL_TEXTURE_2D, partsTFX);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES, YRES, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES/CELL, YRES/CELL, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
glGenTextures(1, &partsTFY);
glBindTexture(GL_TEXTURE_2D, partsTFY);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES, YRES, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, XRES/CELL, YRES/CELL, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);

View File

@ -865,6 +865,8 @@ void GameView::OnDraw()
ren->render_fire();
ren->draw_grav();
ren->DrawWalls();
ren->DrawSigns();
ren->FinaliseParts();
if(activeBrush && currentMouse.X > 0 && currentMouse.X < XRES && currentMouse.Y > 0 && currentMouse.Y < YRES)
{
if(drawMode==DrawRect && isMouseDown)
@ -880,8 +882,6 @@ void GameView::OnDraw()
activeBrush->RenderPoint(g, c->PointTranslate(currentMouse));
}
}
ren->DrawSigns();
ren->FinaliseParts();
ren->RenderZoom();
if(selectMode!=SelectNone)

View File

@ -239,9 +239,14 @@ void RenderView::OnDraw()
g->clearrect(0, 0, XRES, YRES+MENUSIZE);
if(ren)
{
ren->clearScreen(1.0f);
ren->draw_air();
ren->render_parts();
ren->render_fire();
ren->draw_grav();
ren->DrawWalls();
ren->DrawSigns();
ren->FinaliseParts();
}
g->draw_line(0, YRES, XRES-1, YRES, 255, 255, 255, XRES+BARSIZE);
g->draw_line(180, YRES, 180, YRES+MENUSIZE, 200, 200, 200, XRES+BARSIZE);

View File

@ -0,0 +1,18 @@
#include "simulation/Tools.h"
#include "simulation/Simulation.h"
//#TPT-Directive ToolClass Tool_Grav TOOL_GRAV 4
Tool_Grav::Tool_Grav()
{
Identifier = "DEFAULT_TOOL_GRAV";
Name = "GRAV";
Colour = PIXPACK(0xCCCCFF);
Description = "Creates a short-lasting gravity well";
}
int Tool_Grav::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)
{
sim->gravmap[((y/CELL)*(XRES/CELL))+(x/CELL)] += 0.03f*strength;
return 1;
}
Tool_Grav::~Tool_Grav() {}