This commit is contained in:
milek7
2018-07-11 14:38:34 +02:00
parent 59cea820b0
commit 7299fc866e
6 changed files with 24 additions and 10 deletions

View File

@@ -163,7 +163,7 @@ set_target_properties( ${PROJECT_NAME}
DEBUG_POSTFIX "_d"
)
cmake_policy(SET CMP0072 NEW)
#cmake_policy(SET CMP0072 NEW)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})

View File

@@ -248,10 +248,10 @@ int main(int argc, char *argv[])
// memory leaks
_CrtSetDbgFlag( _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF );
// floating point operation errors
auto state = _clearfp();
state = _control87( 0, 0 );
//auto state = _clearfp();
//state = _control87( 0, 0 );
// this will turn on FPE for #IND and zerodiv
state = _control87( state & ~( _EM_ZERODIVIDE | _EM_INVALID ), _MCW_EM );
//state = _control87( state & ~( _EM_ZERODIVIDE | _EM_INVALID ), _MCW_EM );
#endif
#ifdef _WIN32
::SetUnhandledExceptionFilter( unhandled_handler );

View File

@@ -1281,12 +1281,16 @@ public:
// Helper: IM_NEW(), IM_PLACEMENT_NEW(), IM_DELETE() macros to call MemAlloc + Placement New, Placement Delete + MemFree
// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax.
// Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.
struct ImNewDummy {};
inline void* operator new(size_t, ImNewDummy, void* ptr) { return ptr; }
inline void operator delete(void*, ImNewDummy, void*) {} // This is only required so we can use the symetrical new()
#define IM_PLACEMENT_NEW(_PTR) new(ImNewDummy(), _PTR)
#define IM_NEW(_TYPE) new(ImNewDummy(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE
template<typename T> void IM_DELETE(T* p) { if (p) { p->~T(); ImGui::MemFree(p); } }
//struct ImNewDummy {};
//inline void* operator new(size_t, ImNewDummy, void* ptr) { return ptr; }
//inline void operator delete(void*, ImNewDummy, void*) {} // This is only required so we can use the symetrical new()
//#define IM_PLACEMENT_NEW(_PTR) new(ImNewDummy(), _PTR)
//#define IM_NEW(_TYPE) new(ImNewDummy(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE
//template<typename T> void IM_DELETE(T* p) { if (p) { p->~T(); ImGui::MemFree(p); } }
#define IM_PLACEMENT_NEW(_PTR) new (_PTR)
#define IM_NEW(_TYPE) new _TYPE
#define IM_DELETE(_X) delete _X
// Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
// Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame");

View File

@@ -13,6 +13,7 @@
#define _CRT_SECURE_NO_WARNINGS
#endif
#undef new
#include "imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui_internal.h"

View File

@@ -284,6 +284,7 @@ opengl_renderer::Render_pass( rendermode const Mode ) {
glDebug("rendermode::color");
{
/*
glDebug("render shadowmap start");
Timer::subsystem.gfx_shadows.start();
@@ -301,6 +302,7 @@ glm::vec3{ m_renderpass.camera.position() - m_shadowpass.camera.position() } );
Timer::subsystem.gfx_shadows.stop();
glDebug("render shadowmap end");
*/
}
m_main_fb->bind();

View File

@@ -107,4 +107,11 @@
#define glDebug(x) if (GLEW_GREMEDY_string_marker) glStringMarkerGREMEDY(0, __FILE__ ":" STRINGIZE(__LINE__) ": " x);
#endif
#ifdef DBG_NEW
#pragma push_macro("new")
#undef new
#include "imgui/imgui.h"
#pragma pop_macro("new")
#else
#include "imgui/imgui.h"
#endif