mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-10 11:58:30 +01:00
backend_test: dont use glw3 loader on main, add USE_DOCKING define
This commit is contained in:
@@ -75,6 +75,6 @@ target_link_libraries(cimgui_sdl ${IMGUI_LIBRARIES} ${IMGUI_SDL_LIBRARY})
|
|||||||
|
|
||||||
#using library
|
#using library
|
||||||
include_directories(../generator/output/)
|
include_directories(../generator/output/)
|
||||||
add_executable(test_sdl main.c ../imgui/examples/libs/gl3w/GL/gl3w.c)
|
add_executable(test_sdl main.c)
|
||||||
target_link_libraries(test_sdl ${IMGUI_SDL_LIBRARY} cimgui_sdl)
|
target_link_libraries(test_sdl ${IMGUI_SDL_LIBRARY} cimgui_sdl)
|
||||||
|
|
||||||
|
@@ -1,9 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
// GL3W/GLFW
|
//making it accesible for main
|
||||||
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions (because it is small). You may use glew/glad/glLoadGen/etc. whatever already works for you.
|
|
||||||
|
|
||||||
//making it accesible for luajit
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
__declspec( dllexport ) int Do_gl3wInit(void);
|
__declspec( dllexport ) int Do_gl3wInit(void);
|
||||||
#else
|
#else
|
||||||
|
@@ -5,7 +5,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define SDL_MAIN_HANDLED
|
#define SDL_MAIN_HANDLED
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#include <GL/glu.h>
|
||||||
|
|
||||||
|
#define USE_DOCKING
|
||||||
|
|
||||||
SDL_Window *window = NULL;
|
SDL_Window *window = NULL;
|
||||||
|
|
||||||
@@ -60,15 +63,7 @@ int main(int argc, char* argv[])
|
|||||||
SDL_Log("Failed to initialize OpenGL loader for cimgui_sdl!");
|
SDL_Log("Failed to initialize OpenGL loader for cimgui_sdl!");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize OpenGL loader for main
|
|
||||||
bool err2 = gl3wInit() != 0;
|
|
||||||
if (err2)
|
|
||||||
{
|
|
||||||
SDL_Log("Failed to initialize OpenGL loader for main!");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check opengl version sdl uses
|
// check opengl version sdl uses
|
||||||
//SDL_Log("opengl version: %s", (char*)glGetString(GL_VERSION));
|
//SDL_Log("opengl version: %s", (char*)glGetString(GL_VERSION));
|
||||||
|
|
||||||
@@ -79,7 +74,7 @@ int main(int argc, char* argv[])
|
|||||||
ImGuiIO* ioptr = igGetIO();
|
ImGuiIO* ioptr = igGetIO();
|
||||||
ioptr->ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
ioptr->ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
//ioptr->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
//ioptr->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||||
#ifdef ImGuiConfigFlags_DockingEnable
|
#ifdef USE_DOCKING
|
||||||
ioptr->ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
|
ioptr->ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
|
||||||
ioptr->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
|
ioptr->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
|
||||||
#endif
|
#endif
|
||||||
@@ -168,7 +163,7 @@ int main(int argc, char* argv[])
|
|||||||
glClearColor(clearColor.x, clearColor.y, clearColor.z, clearColor.w);
|
glClearColor(clearColor.x, clearColor.y, clearColor.z, clearColor.w);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
|
ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
|
||||||
#ifdef ImGuiConfigFlags_DockingEnable
|
#ifdef USE_DOCKING
|
||||||
if (ioptr->ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
if (ioptr->ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||||
{
|
{
|
||||||
SDL_Window* backup_current_window = SDL_GL_GetCurrentWindow();
|
SDL_Window* backup_current_window = SDL_GL_GetCurrentWindow();
|
||||||
|
Reference in New Issue
Block a user