diff --git a/OpenGTA-win/OpenGTA-win.vcxproj b/OpenGTA-win/OpenGTA-win.vcxproj index 5eb775b..c025886 100755 --- a/OpenGTA-win/OpenGTA-win.vcxproj +++ b/OpenGTA-win/OpenGTA-win.vcxproj @@ -92,15 +92,15 @@ Disabled true true - ..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include;..\..\loki-0.1.7\include\loki;..\opensteer\include - _CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) + ../../libs/boost-gil-extension;../../tes-engine;../../eigen;../../boost_1_67_0/;../../libs/jpeg-9;../../libs/jpeg-9/vc10;../../libs/lpng1510;..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include;..\..\loki-0.1.7\include\loki;..\opensteer\include + WIN32;_WINDOWS;TARGET_WIN32;_WIN32_WINNT=0x0501;WIN32_LEAN_AND_MEAN;EIGEN_DONT_ALIGN_STATICALLY;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) false MultiThreadedDebugDLL Console - ..\..\SDL2-2.0.8\lib\x64;..\..\loki-0.1.7\lib;..\..\physfs-3.0.1\build\install\lib - physfs.lib;loki_D.lib;SDL2.lib;SDL2main.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + ../../tes-engine/windows/Engine/x64/Debug;../../boost_1_67_0/stage/lib;..\..\SDL2-2.0.8\lib\x64;..\..\loki-0.1.7\lib;..\..\physfs-3.0.1\build\install\lib + libjpeg.lib;libpng.lib;Engine.lib;physfs.lib;loki_D.lib;SDL2.lib;SDL2main.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) @@ -128,16 +128,16 @@ true true true - ..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include;..\..\loki-0.1.7\include\loki;..\opensteer\include - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) + ../../libs/boost-gil-extension;../../tes-engine;../../eigen;../../boost_1_67_0/;../../libs/jpeg-9;../../libs/jpeg-9/vc10;../../libs/lpng1510;..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include;..\..\loki-0.1.7\include\loki;..\opensteer\include + WIN32;NDEBUG;_WINDOWS;TARGET_WIN32;_WIN32_WINNT=0x0501;WIN32_LEAN_AND_MEAN;EIGEN_DONT_ALIGN_STATICALLY;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) false true true Console - ..\..\SDL2-2.0.8\lib\x64;..\..\loki-0.1.7\lib;..\..\physfs-3.0.1\build\install\lib - physfs.lib;loki_D.lib;SDL2.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + ../../tes-engine/windows/Engine/x64/Release;../../boost_1_67_0/stage/lib;..\..\SDL2-2.0.8\lib\x64;..\..\loki-0.1.7\lib;..\..\physfs-3.0.1\build\install\lib + libjpeg.lib;libpng.lib;Engine.lib;physfs.lib;loki_D.lib;SDL2.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) @@ -201,6 +201,7 @@ + @@ -267,6 +268,7 @@ + diff --git a/OpenGTA-win/OpenGTA-win.vcxproj.filters b/OpenGTA-win/OpenGTA-win.vcxproj.filters index 99273c6..1e9e2b2 100755 --- a/OpenGTA-win/OpenGTA-win.vcxproj.filters +++ b/OpenGTA-win/OpenGTA-win.vcxproj.filters @@ -204,6 +204,9 @@ Source Files\ogta + + Source Files + @@ -398,6 +401,9 @@ Source Files\coldet + + Source Files + diff --git a/OpenGTA-win/assets/gl1SimpleFragmentShader.txt b/OpenGTA-win/assets/gl1SimpleFragmentShader.txt new file mode 100755 index 0000000..f9a6d18 --- /dev/null +++ b/OpenGTA-win/assets/gl1SimpleFragmentShader.txt @@ -0,0 +1,13 @@ +precision mediump float; +varying vec2 TexCoord; + +uniform sampler2D Texture; + +void main() +{ + + vec4 texColor = texture2D(Texture, TexCoord).rgba; + //gl_FragColor = texColor; +gl_FragColor = vec4(texColor.rgb*2.0 + vec3(0.2, 0.2, 0.2), texColor.a); +//gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/OpenGTA-win/assets/gl1SimpleVertexShader.txt b/OpenGTA-win/assets/gl1SimpleVertexShader.txt new file mode 100755 index 0000000..a03bf50 --- /dev/null +++ b/OpenGTA-win/assets/gl1SimpleVertexShader.txt @@ -0,0 +1,9 @@ +varying vec2 TexCoord; + +void main() +{ +gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz,1.0); + + TexCoord = gl_MultiTexCoord0.st; + +} diff --git a/OpenGTA-win/frgbridge.cpp b/OpenGTA-win/frgbridge.cpp new file mode 100755 index 0000000..0ecaf8b --- /dev/null +++ b/OpenGTA-win/frgbridge.cpp @@ -0,0 +1,22 @@ +#include "frgbridge.h" + +#include "include/Engine.h" +#include +#include + + +std::unique_ptr shaderManager; + + +SE::TShaderManager& GetShaderManager() +{ + static std::once_flag onceFlag; + + std::call_once(onceFlag, + [] { + shaderManager = std::make_unique(); + }); + + return *shaderManager.get(); +} + diff --git a/OpenGTA-win/frgbridge.h b/OpenGTA-win/frgbridge.h new file mode 100755 index 0000000..1c93998 --- /dev/null +++ b/OpenGTA-win/frgbridge.h @@ -0,0 +1,13 @@ +#ifndef FRGBRIDGE_H_INCLUDED +#define FRGBRIDGE_H_INCLUDED + + +#include "include/Engine.h" + + + +SE::TShaderManager& GetShaderManager(); + + + +#endif //FRGBRIDGE_H_INCLUDED diff --git a/OpenGTA-win/log.txt b/OpenGTA-win/log.txt new file mode 100755 index 0000000..fef7846 --- /dev/null +++ b/OpenGTA-win/log.txt @@ -0,0 +1,16 @@ +2018-Sep-23 02:22:34: Render::OpenGL glVersion = 4.5.0 - Build 23.20.16.4973 +2018-Sep-23 02:22:34: Render::OpenGL glVersion above 2.0 ok +2018-Sep-23 02:22:34: Render::OpenGL GL_ARB_framebuffer_object supported ok +2018-Sep-23 02:22:34: Render::OpenGL GL_ARB_uniform_buffer_object supported ok +2018-Sep-23 02:22:34: Prepare to add shader simple +2018-Sep-23 02:22:34: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing + + +2018-Sep-23 02:22:34: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +WARNING: 0:1: 'precision' : symbol not available in current GLSL version +WARNING: 0:1: 'mediump' : symbol not available in current GLSL version + + +2018-Sep-23 02:22:34: Shader program is - 3 +2018-Sep-23 02:22:34: ResourceManager::ShaderManager::Shader +2018-Sep-23 02:22:34: ResourceManager::ShaderManager shader loaded: simple diff --git a/gl_screen.cpp b/gl_screen.cpp index 1a93e7b..487fa78 100755 --- a/gl_screen.cpp +++ b/gl_screen.cpp @@ -27,6 +27,7 @@ #include "m_exceptions.h" #include "image_loader.h" +#include "OpenGTA-win/frgbridge.h" namespace OpenGL { #ifndef DEFAULT_SCREEN_WIDTH @@ -305,6 +306,13 @@ namespace OpenGL { } GL_CHECKERROR; + + //auto vertexShaderText = SE::LoadTextFile("D:\\Work\\TorchProjects\\OpenGTA\\OpenGTA-win\\assets\\gl1SimpleVertexShader.txt"); + //auto fragmentShaderText = SE::LoadTextFile("D:\\Work\\TorchProjects\\OpenGTA\\OpenGTA-win\\assets\\gl1SimpleFragmentShader.txt"); + + GetShaderManager().AddShader("simple", "D:\\Work\\TorchProjects\\OpenGTA\\OpenGTA-win\\assets\\gl1SimpleVertexShader.txt", "D:\\Work\\TorchProjects\\OpenGTA\\OpenGTA-win\\assets\\gl1SimpleFragmentShader.txt"); + + GetShaderManager().PushShader("simple"); } void Screen::resize(Uint32 w, Uint32 h) {