mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Merge remote-tracking branch 'origin' into 2016-07-navigation
This commit is contained in:
@ -484,7 +484,7 @@ void ImGui_ImplDX10_InvalidateDeviceObjects()
|
||||
return;
|
||||
|
||||
if (g_pFontSampler) { g_pFontSampler->Release(); g_pFontSampler = NULL; }
|
||||
if (g_pFontTextureView) { g_pFontTextureView->Release(); g_pFontTextureView = NULL; ImGui::GetIO().Fonts->TexID = 0; }
|
||||
if (g_pFontTextureView) { g_pFontTextureView->Release(); g_pFontTextureView = NULL; ImGui::GetIO().Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
|
||||
if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
|
||||
|
||||
|
@ -183,7 +183,9 @@ int main(int, char**)
|
||||
// Rendering
|
||||
g_pd3dDevice->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_col);
|
||||
ImGui::Render();
|
||||
g_pSwapChain->Present(0, 0);
|
||||
|
||||
g_pSwapChain->Present(1, 0); // Present with vsync
|
||||
//g_pSwapChain->Present(0, 0); // Present without vsync
|
||||
}
|
||||
|
||||
ImGui_ImplDX10_Shutdown();
|
||||
|
@ -485,7 +485,7 @@ void ImGui_ImplDX11_InvalidateDeviceObjects()
|
||||
return;
|
||||
|
||||
if (g_pFontSampler) { g_pFontSampler->Release(); g_pFontSampler = NULL; }
|
||||
if (g_pFontTextureView) { g_pFontTextureView->Release(); g_pFontTextureView = NULL; ImGui::GetIO().Fonts->TexID = 0; }
|
||||
if (g_pFontTextureView) { g_pFontTextureView->Release(); g_pFontTextureView = NULL; ImGui::GetIO().Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
|
||||
if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
|
||||
|
||||
|
@ -186,7 +186,9 @@ int main(int, char**)
|
||||
// Rendering
|
||||
g_pd3dDeviceContext->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_col);
|
||||
ImGui::Render();
|
||||
g_pSwapChain->Present(0, 0);
|
||||
|
||||
g_pSwapChain->Present(1, 0); // Present with vsync
|
||||
//g_pSwapChain->Present(0, 0); // Present without vsync
|
||||
}
|
||||
|
||||
ImGui_ImplDX11_Shutdown();
|
||||
|
@ -311,12 +311,14 @@ void ImGui_ImplDX9_InvalidateDeviceObjects()
|
||||
g_pIB->Release();
|
||||
g_pIB = NULL;
|
||||
}
|
||||
if (LPDIRECT3DTEXTURE9 tex = (LPDIRECT3DTEXTURE9)ImGui::GetIO().Fonts->TexID)
|
||||
{
|
||||
tex->Release();
|
||||
ImGui::GetIO().Fonts->TexID = 0;
|
||||
}
|
||||
|
||||
// At this point note that we set ImGui::GetIO().Fonts->TexID to be == g_FontTexture, so clear both.
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
IM_ASSERT(g_FontTexture == io.Fonts->TexID);
|
||||
if (g_FontTexture)
|
||||
g_FontTexture->Release();
|
||||
g_FontTexture = NULL;
|
||||
io.Fonts->TexID = NULL;
|
||||
}
|
||||
|
||||
void ImGui_ImplDX9_NewFrame()
|
||||
|
@ -63,7 +63,8 @@ int main(int, char**)
|
||||
g_d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
|
||||
g_d3dpp.EnableAutoDepthStencil = TRUE;
|
||||
g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
|
||||
g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // Present with vsync
|
||||
//g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Present without vsync, maximum unthrottled framerate
|
||||
|
||||
// Create the D3DDevice
|
||||
if (pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#
|
||||
# Cross Platform Makefile
|
||||
# Compatible with Ubuntu 14.04.1 and Mac OS X
|
||||
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
|
||||
#
|
||||
#
|
||||
# if you using Mac OS X:
|
||||
@ -37,7 +37,7 @@ ifeq ($(UNAME_S), Darwin) #APPLE
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S), MINGW64_NT-6.3)
|
||||
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
|
||||
ECHO_MESSAGE = "Windows"
|
||||
LIBS = -lglfw3 -lgdi32 -lopengl32 -limm32
|
||||
|
||||
|
@ -58,7 +58,7 @@ void ImGui_ImplGlfw_RenderDrawLists(ImDrawData* draw_data)
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context
|
||||
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound
|
||||
|
||||
// Setup viewport, orthographic projection matrix
|
||||
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
|
||||
|
@ -19,6 +19,7 @@ int main(int, char**)
|
||||
return 1;
|
||||
GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui OpenGL2 example", NULL, NULL);
|
||||
glfwMakeContextCurrent(window);
|
||||
glfwSwapInterval(1); // Enable vsync
|
||||
|
||||
// Setup ImGui binding
|
||||
ImGui_ImplGlfw_Init(window, true);
|
||||
@ -77,6 +78,7 @@ int main(int, char**)
|
||||
glViewport(0, 0, display_w, display_h);
|
||||
glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound
|
||||
ImGui::Render();
|
||||
glfwSwapBuffers(window);
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
#
|
||||
# Cross Platform Makefile
|
||||
# Compatible with Ubuntu 14.04.1 and Mac OS X
|
||||
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
|
||||
#
|
||||
#
|
||||
# You will need GLFW (http://www.glfw.org)
|
||||
#
|
||||
# apt-get install libglfw-dev # Linux
|
||||
# brew install glfw # Mac OS X
|
||||
# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw # MSYS2
|
||||
#
|
||||
|
||||
#CXX = g++
|
||||
@ -39,7 +40,7 @@ ifeq ($(UNAME_S), Darwin) #APPLE
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S), MINGW64_NT-6.3)
|
||||
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
|
||||
ECHO_MESSAGE = "Windows"
|
||||
LIBS = -lglfw3 -lgdi32 -lopengl32 -limm32
|
||||
|
||||
|
@ -26,6 +26,7 @@ int main(int, char**)
|
||||
#endif
|
||||
GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui OpenGL3 example", NULL, NULL);
|
||||
glfwMakeContextCurrent(window);
|
||||
glfwSwapInterval(1); // Enable vsync
|
||||
gl3wInit();
|
||||
|
||||
// Setup ImGui binding
|
||||
|
@ -49,7 +49,7 @@ void ImGui_ImplSdl_RenderDrawLists(ImDrawData* draw_data)
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context
|
||||
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound
|
||||
|
||||
// Setup viewport, orthographic projection matrix
|
||||
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
|
||||
|
@ -89,6 +89,7 @@ int main(int, char**)
|
||||
glViewport(0, 0, (int)ImGui::GetIO().DisplaySize.x, (int)ImGui::GetIO().DisplaySize.y);
|
||||
glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound
|
||||
ImGui::Render();
|
||||
SDL_GL_SwapWindow(window);
|
||||
}
|
||||
|
61
examples/sdl_opengl3_example/Makefile
Normal file
61
examples/sdl_opengl3_example/Makefile
Normal file
@ -0,0 +1,61 @@
|
||||
#
|
||||
# Cross Platform Makefile
|
||||
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
|
||||
#
|
||||
#
|
||||
# You will need SDL2 (http://www.libsdl.org)
|
||||
#
|
||||
# apt-get install libsdl2-dev # Linux
|
||||
# brew install sdl2 # Mac OS X
|
||||
# pacman -S mingw-w64-i686-SDL # MSYS2
|
||||
#
|
||||
|
||||
#CXX = g++
|
||||
|
||||
EXE = sdl_opengl3_example
|
||||
OBJS = main.o imgui_impl_sdl_gl3.o
|
||||
OBJS += ../../imgui.o ../../imgui_demo.o ../../imgui_draw.o
|
||||
OBJS += ../libs/gl3w/GL/gl3w.o
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
|
||||
ifeq ($(UNAME_S), Linux) #LINUX
|
||||
ECHO_MESSAGE = "Linux"
|
||||
LIBS = -lGL -ldl `sdl2-config --libs`
|
||||
|
||||
CXXFLAGS = -I../../ -I../libs/gl3w `sdl2-config --cflags`
|
||||
CXXFLAGS += -Wall -Wformat
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S), Darwin) #APPLE
|
||||
ECHO_MESSAGE = "Mac OS X"
|
||||
LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs`
|
||||
|
||||
CXXFLAGS = -I../../ -I../libs/gl3w -I/usr/local/include `sdl2-config --cflags`
|
||||
CXXFLAGS += -Wall -Wformat
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
|
||||
ECHO_MESSAGE = "Windows"
|
||||
LIBS = -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2`
|
||||
|
||||
CXXFLAGS = -I../../ -I../libs/gl3w `pkg-config --cflags sdl2`
|
||||
CXXFLAGS += -Wall -Wformat
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
all: $(EXE)
|
||||
@echo Build complete for $(ECHO_MESSAGE)
|
||||
|
||||
$(EXE): $(OBJS)
|
||||
$(CXX) -o $(EXE) $(OBJS) $(CXXFLAGS) $(LIBS)
|
||||
|
||||
clean:
|
||||
rm $(EXE) $(OBJS)
|
@ -1,4 +1,7 @@
|
||||
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
|
||||
|
||||
mkdir Debug
|
||||
cl /nologo /Zi /MD /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\..\*.cpp /FeDebug/vulkan_example.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib
|
||||
|
||||
mkdir Release
|
||||
cl /nologo /Zi /MD /Ox /Oi /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\..\*.cpp /FeRelease/vulkan_example.exe /FoRelease/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib
|
||||
|
@ -1,4 +1,7 @@
|
||||
@REM Build for Visual Studio compiler. Run your copy of amd64/vcvars32.bat to setup 64-bit command-line compiler.
|
||||
|
||||
mkdir Debug
|
||||
cl /nologo /Zi /MD /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\..\*.cpp /FeDebug/vulkan_example.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib
|
||||
|
||||
mkdir Release
|
||||
cl /nologo /Zi /MD /Ox /Oi /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\..\*.cpp /FeRelease/vulkan_example.exe /FoRelease/ /link /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib
|
||||
|
Reference in New Issue
Block a user