From 50ada7ff11b0460570325bdb49656995c209ef7c Mon Sep 17 00:00:00 2001 From: viperscape Date: Wed, 14 Nov 2018 10:15:58 -0500 Subject: [PATCH] rework to include VS 2017 project, fully configured and tested --- examples/glview/.gitignore | 7 + examples/glview/glview.cc | 34 +++- examples/glview/glview.sln | 31 ++++ examples/glview/glview/glview.vcxproj | 152 ++++++++++++++++++ examples/glview/glview/glview.vcxproj.filters | 28 ++++ examples/glview/glview/glview.vcxproj.user | 4 + examples/glview/glview/packages.config | 5 + 7 files changed, 254 insertions(+), 7 deletions(-) create mode 100644 examples/glview/.gitignore create mode 100644 examples/glview/glview.sln create mode 100644 examples/glview/glview/glview.vcxproj create mode 100644 examples/glview/glview/glview.vcxproj.filters create mode 100644 examples/glview/glview/glview.vcxproj.user create mode 100644 examples/glview/glview/packages.config diff --git a/examples/glview/.gitignore b/examples/glview/.gitignore new file mode 100644 index 0000000..0d208f4 --- /dev/null +++ b/examples/glview/.gitignore @@ -0,0 +1,7 @@ +.vs +Debug +x64 +packages + +!*.sln +!*.vcxproj* \ No newline at end of file diff --git a/examples/glview/glview.cc b/examples/glview/glview.cc index 5791d48..f555c13 100644 --- a/examples/glview/glview.cc +++ b/examples/glview/glview.cc @@ -12,12 +12,12 @@ #define GLFW_INCLUDE_GLU #include -#include "trackball.h" +#include "../common/trackball.h" #define TINYGLTF_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_WRITE_IMPLEMENTATION -#include "tiny_gltf.h" +#include "../../tiny_gltf.h" #define BUFFER_OFFSET(i) ((char *)NULL + (i)) @@ -721,8 +721,8 @@ static void PrintNodes(const tinygltf::Scene &scene) { int main(int argc, char **argv) { if (argc < 2) { - std::cout << "glview input.gltf \n" << std::endl; - return 0; + std::cout << "glview input.gltf " << std::endl; + std::cout << "defaulting to example cube model" << std::endl; } float scale = 1.0f; @@ -734,7 +734,15 @@ int main(int argc, char **argv) { tinygltf::TinyGLTF loader; std::string err; std::string warn; - std::string input_filename(argv[1]); + +#ifdef _WIN32 + #ifdef _DEBUG + std::string input_filename(argv[1] ? argv[1] : "../../../models/Cube/Cube.gltf"); + #endif +#else + std::string input_filename(argv[1] ? argv[1] : "../../models/Cube/Cube.gltf"); +#endif + std::string ext = GetFilePathExtension(input_filename); bool ret = false; @@ -797,12 +805,24 @@ int main(int argc, char **argv) { reshapeFunc(window, width, height); GLuint vertId = 0, fragId = 0, progId = 0; - if (false == LoadShader(GL_VERTEX_SHADER, vertId, "shader.vert")) { + +#ifdef _WIN32 + #ifdef _DEBUG + const char *shader_frag_filename = "../shader.frag"; + const char *shader_vert_filename = "../shader.vert"; + #endif +#else + const char *shader_frag_filename = "shader.frag"; + const char *shader_vert_filename = "shader.vert"; +#endif + + + if (false == LoadShader(GL_VERTEX_SHADER, vertId, shader_vert_filename)) { return -1; } CheckErrors("load vert shader"); - if (false == LoadShader(GL_FRAGMENT_SHADER, fragId, "shader.frag")) { + if (false == LoadShader(GL_FRAGMENT_SHADER, fragId, shader_frag_filename)) { return -1; } CheckErrors("load frag shader"); diff --git a/examples/glview/glview.sln b/examples/glview/glview.sln new file mode 100644 index 0000000..c0f25b2 --- /dev/null +++ b/examples/glview/glview.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2050 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glview", "glview\glview.vcxproj", "{D078BB24-377E-497B-8045-03AF2A0547ED}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D078BB24-377E-497B-8045-03AF2A0547ED}.Debug|x64.ActiveCfg = Debug|x64 + {D078BB24-377E-497B-8045-03AF2A0547ED}.Debug|x64.Build.0 = Debug|x64 + {D078BB24-377E-497B-8045-03AF2A0547ED}.Debug|x86.ActiveCfg = Debug|Win32 + {D078BB24-377E-497B-8045-03AF2A0547ED}.Debug|x86.Build.0 = Debug|Win32 + {D078BB24-377E-497B-8045-03AF2A0547ED}.Release|x64.ActiveCfg = Release|x64 + {D078BB24-377E-497B-8045-03AF2A0547ED}.Release|x64.Build.0 = Release|x64 + {D078BB24-377E-497B-8045-03AF2A0547ED}.Release|x86.ActiveCfg = Release|Win32 + {D078BB24-377E-497B-8045-03AF2A0547ED}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DB7C2F91-06C9-4BD8-95BF-04814E0C62DA} + EndGlobalSection +EndGlobal diff --git a/examples/glview/glview/glview.vcxproj b/examples/glview/glview/glview.vcxproj new file mode 100644 index 0000000..d6a6ebd --- /dev/null +++ b/examples/glview/glview/glview.vcxproj @@ -0,0 +1,152 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {D078BB24-377E-497B-8045-03AF2A0547ED} + glview + 10.0.17134.0 + + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + true + true + _MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + + + 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);opengl32.lib;glu32.lib + Console + + + + + Level3 + Disabled + true + true + _MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + + + 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);opengl32.lib;glu32.lib + Console + + + + + Level3 + MaxSpeed + true + true + true + true + _MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + + + true + true + 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);opengl32.lib;glu32.lib + Console + + + + + Level3 + MaxSpeed + true + true + true + true + _MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + + + true + true + 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);opengl32.lib;glu32.lib + Console + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/examples/glview/glview/glview.vcxproj.filters b/examples/glview/glview/glview.vcxproj.filters new file mode 100644 index 0000000..bfa6f46 --- /dev/null +++ b/examples/glview/glview/glview.vcxproj.filters @@ -0,0 +1,28 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + + + + \ No newline at end of file diff --git a/examples/glview/glview/glview.vcxproj.user b/examples/glview/glview/glview.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/examples/glview/glview/glview.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/examples/glview/glview/packages.config b/examples/glview/glview/packages.config new file mode 100644 index 0000000..5b03888 --- /dev/null +++ b/examples/glview/glview/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file