From 747bfaba7c629a9ff4c0851ac5bf486af8aecafa Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Thu, 12 Apr 2018 18:19:08 +0300 Subject: [PATCH] Update code to engine fixed --- game/main_code.cpp | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/game/main_code.cpp b/game/main_code.cpp index c0f307f..e9fc574 100644 --- a/game/main_code.cpp +++ b/game/main_code.cpp @@ -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>& } pair.second.RefreshBuffer(); - + pair.first = TRenderParams().withShader("AntialiasingShader"); + return pair; } @@ -102,26 +102,11 @@ void TMyApplication::InnerInit() } srand (static_cast(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> 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("");