Changeset d9b6a1c in opengl-game
- Timestamp:
- May 24, 2019, 5:37:05 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 98f06d9
- Parents:
- caa2359
- Files:
-
- 7 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
rcaa2359 rd9b6a1c 5 5 6 6 gl.log 7 crash.log 7 8 8 9 imgui.ini -
NewOpenGLGame.vcxproj
rcaa2359 rd9b6a1c 135 135 </ItemDefinitionGroup> 136 136 <ItemGroup> 137 <ClCompile Include="CrashLogger.cpp" /> 137 138 <ClCompile Include="IMGUI\imgui.cpp" /> 138 139 <ClCompile Include="IMGUI\imgui_demo.cpp" /> … … 141 142 <ClCompile Include="logger.cpp" /> 142 143 <ClCompile Include="new-game.cpp" /> 144 <ClCompile Include="StackWalker.cpp" /> 143 145 <ClCompile Include="stb_image_write.h" /> 144 146 <ClCompile Include="stb_image.cpp" /> 145 147 </ItemGroup> 146 148 <ItemGroup> 149 <ClInclude Include="CrashLogger.h" /> 147 150 <ClInclude Include="IMGUI\imgui.h" /> 148 151 <ClInclude Include="IMGUI\imgui_internal.h" /> … … 152 155 <ClInclude Include="imgui_impl_glfw_gl3.h" /> 153 156 <ClInclude Include="logger.h" /> 157 <ClInclude Include="StackWalker.h" /> 154 158 <ClInclude Include="stb_image.h" /> 155 159 <ClInclude Include="utils.h" /> -
makefile
rcaa2359 rd9b6a1c 1 1 OS = $(shell uname) 2 2 CC = g++ 3 CFLAGS = -std=c++0x -Wall -pedantic#-Wextra 3 CFLAGS = -std=c++0x -Wall -pedantic#-Wextra -fno-inline 4 4 5 5 ifeq ($(OS),Darwin) … … 15 15 # as this well prevent regenerating .o files for unchanged .cpp files 16 16 17 newgame: new-game.cpp logger.cpp stb_image.cpp imgui_impl_glfw_gl3.cpp $(IMGUI_FILES)17 newgame: new-game.cpp logger.cpp stb_image.cpp imgui_impl_glfw_gl3.cpp CrashLogger.cpp $(IMGUI_FILES) 18 18 $(CC) $^ $(DEP) $(CFLAGS) -o $@ 19 19 -
new-game.cpp
rcaa2359 rd9b6a1c 32 32 #include "logger.h" 33 33 #include "utils.h" 34 35 #include "Compiler.h" 36 37 #ifdef WINDOWS 38 #include <windows.h> 39 #include <excpt.h> 40 #include <io.h> 41 42 #include "FileStackWalker.h" 43 #else 44 // TODO: Move as much Windows crash-logging stuff into CrashLogger as well 45 #include "CrashLogger.h" 46 #endif 34 47 35 48 using namespace std; … … 212 225 void calculateObjectBoundingBox(SceneObject* obj); 213 226 214 void initializeParticleEffectBuffers(map<GLuint, BufferInfo>& shaderBufferInfo,215 map<ObjectType, ShaderModelGroup>& modelGroups,216 GLuint ubo);217 218 227 void populateBuffers(vector<SceneObject*>& objects, 219 228 map<GLuint, BufferInfo>& shaderBufferInfo, … … 297 306 */ 298 307 308 CrashLogger logger; 309 310 // Helps to test logging during crashes 311 /* 312 void badFunc() { 313 int* test = NULL; 314 *test = 1; 315 } 316 */ 317 318 #ifdef WINDOWS 319 320 // Give it a file handle to crash.log instead (using the code in CrashLogger.cpp) 321 FileStackWalker sw(2); 322 323 bool handleException(unsigned int expCode, EXCEPTION_POINTERS* pExp, HANDLE thread); 324 #endif 325 299 326 int main(int argc, char* argv[]) { 327 #ifdef WINDOWS 328 __try { 329 __main(argc, argv); 330 // maybe do this and call a function inside CrashLogger 331 // In that case, also pass GetCurrentThread() as a parameter to then pass to handleException 332 // I could also move almost all of this into CrashLogger by creating a function in CrashLogger that takes a reference 333 // to the effective main function and, for Windows, wraps it in all this error-handling stuff 334 } __except( handleException(GetExceptionCode(), GetExceptionInformation(), GetCurrentThread()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_EXECUTE_HANDLER) { 335 _write(2, "CAUGHT\n", 7); 336 } 337 338 exit(0); 339 } 340 341 int __main(int argc, char* argv[]) { 342 #endif 300 343 cout << "New OpenGL Game" << endl; 301 344 … … 309 352 } 310 353 311 #ifdef __APPLE__354 #ifdef MAC 312 355 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 313 356 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); … … 973 1016 delete *it; 974 1017 } 975 976 return 0; 977 } 1018 } 1019 1020 #ifdef WINDOWS 1021 bool handleException(unsigned int expCode, EXCEPTION_POINTERS* pExp, HANDLE thread) { 1022 if (pExp != NULL) { 1023 sw.ShowCallstack(thread, pExp->ContextRecord); 1024 } 1025 1026 if (expCode == EXCEPTION_ACCESS_VIOLATION) { 1027 _write(2, "ACCESS VIOLATION\n", 17); 1028 } 1029 1030 return true; 1031 } 1032 #endif 978 1033 979 1034 void glfw_error_callback(int error, const char* description) {
Note:
See TracChangeset
for help on using the changeset viewer.