Update code to engine fixed

This commit is contained in:
Vladislav Khorev 2018-04-12 18:19:08 +03:00
parent f70741f6e6
commit 747bfaba7c

View File

@ -11,7 +11,6 @@
TMyApplication* Application;
//static const float BUFFER_DISTANCE = 30.f;
static const float BUFFER_DISTANCE = 50.f;
@ -73,7 +72,8 @@ TRenderPair linesToRenderBoxes(const std::vector<std::pair<Vector2f, Vector2f>>&
}
pair.second.RefreshBuffer();
pair.first = TRenderParams().withShader("AntialiasingShader");
return pair;
}
@ -102,26 +102,11 @@ void TMyApplication::InnerInit()
}
srand (static_cast<size_t>(time(NULL)));
//ResourceManager->ShaderManager.AddShader("DefaultShader", "shader1vertex.txt", "shader1fragment.txt");
//ResourceManager->ShaderManager.AddShader("ColorShader", "color_vertex.txt", "color_fragment.txt");
#ifdef USE_SHADER_X16
ResourceManager->ShaderManager.AddShader("AntialiasingShader", "ms_vertex.txt", "ms_fragment_x16.txt");
#else
ResourceManager->ShaderManager.AddShader("AntialiasingShader", "ms_vertex.txt", "ms_fragment.txt");
#endif
//Renderer->PushShader("DefaultShader");
ResourceManager->TexList.AddTexture("console_bkg.bmp");
Renderer->PushShader("AntialiasingShader");
std::vector<std::pair<Vector2f, Vector2f>> lineArr;
for (int i = 0; i < 10; i++)
@ -135,6 +120,8 @@ void TMyApplication::InnerInit()
lineRenderPair = linesToRenderBoxes(lineArr);
Renderer->PushShader("AntialiasingShader");
Renderer->SetOrthoProjection();
Renderer->SetFullScreenViewport();
@ -186,26 +173,15 @@ void TMyApplication::InnerDraw()
{
//Render the frame
Renderer->PushShader("AntialiasingShader");
Renderer->SetProjectionMatrix(512.f, 512.f);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
CheckGlError("");
EnableVertexAttribArray("vLineParams");
EnableVertexAttribArray("vStartPointEndPoint");
TRenderParamsSetter params(lineRenderPair.first);
Renderer->DrawTriangleList(lineRenderPair.second);
DisableVertexAttribArray("vStartPointEndPoint");
DisableVertexAttribArray("vLineParams");
Renderer->PopShader();
CheckGlError("");