1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-24 07:40:22 +01:00
imgui/examples
Gregg Tavares 01286f6636 Fix blend func state save/restore
AFAIK there's no such enum as `GL_BLEND_SRC` or `GL_BLEND_DST` in OpenGL3 and OpenGL4.

Maybe they're left over from previous versions? They don't even seem to exist in OpenGL 2.1. In fact checking they were deprecated in OpenGL 1.5 (they exist in 1.3)
2017-05-01 16:05:45 +09:00
..
allegro5_example Added a void* user_data parameter to Clipboard function handlers. (#875) 2016-10-15 11:36:43 +02:00
apple_example Examples: GLFW+GL3, SDL+GL3: Fixed modifying bound Texture0 (#1087, #1088, #1116) 2017-04-26 18:16:59 +02:00
directx9_example Examples: DirectX9: Explicitely setting viewport to match that other examples are doing (#937) 2016-12-19 23:15:38 +01:00
directx10_example Examples: DirectX9-10-11: Only call Windows' SetCursor(NULL) when io.MouseDrawCursor is set (#585, #909) 2016-11-12 19:46:52 +01:00
directx11_example Examples: DirectX9-10-11: Only call Windows' SetCursor(NULL) when io.MouseDrawCursor is set (#585, #909) 2016-11-12 19:46:52 +01:00
libs Examples: Libs: Update glfw binaries to glfw master. 2016-04-03 17:41:59 +02:00
marmalade_example Added a void* user_data parameter to Clipboard function handlers. (#875) 2016-10-15 11:36:43 +02:00
opengl2_example Comments to redirect people to OpenGL3 examples (#1116) 2017-04-26 18:27:10 +02:00
opengl3_example Fix blend func state save/restore 2017-05-01 16:05:45 +09:00
sdl_opengl2_example Comments to redirect people to OpenGL3 examples (#1116) 2017-04-26 18:27:10 +02:00
sdl_opengl3_example Examples: GLFW+GL3, SDL+GL3: Fixed modifying bound Texture0 (#1087, #1088, #1116) 2017-04-26 18:16:59 +02:00
vulkan_example Examples: Vulkan: Coding style fixes (#910) 2016-11-13 17:57:43 +01:00
.gitignore Examples: Renaming opengl_example/ to opengl2_example/ for clarity (1/2 because git) 2016-08-25 10:25:51 +02:00
imgui_examples_msvc2010.sln Examples: Renaming opengl_example/ to opengl2_example/ for clarity (1/2 because git) 2016-08-25 10:25:51 +02:00
README.txt Comments to redirect people to OpenGL3 examples (#1116) 2017-04-26 18:27:10 +02:00

Those are standalone ready-to-build applications to demonstrate ImGui.
Binaries of some of those demos: http://www.miracleworld.net/imgui/binaries

Third party languages and frameworks bindings: https://github.com/ocornut/imgui/wiki/Links
(languages: C, .net, rust, D, Python, Lua..)
(frameworks: DX12, Vulkan, Cinder, OpenGLES, openFrameworks, Cocos2d-x, SFML, Flexium, NanoRT, Irrlicht..)
(extras: RemoteImGui, ImWindow, imgui_wm..)

TL;DR; 
 - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
 - To LEARN how the library is setup, you may refer to 'opengl2_example' because is the simplest one.
   The other examples requires more boilerplate and are harder to read.
   However, USE 'opengl3_example' in your application if you are using any modern OpenGL3+ calls.
   Mixing old fixed pipeline OpenGL2 and programmable pipeline OpenGL3+ isn't well supported by some drivers.
   If you are not sure, in doubt, use 'opengl3_example'.
 - If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
   to your project and use them unmodified.
 - If you have your own engine, you probably want to start from one of the OpenGL example and adapt it to 
   your engine, but you can read the other examples as well.

ImGui is highly portable and only requires a few things to run:
 - Providing mouse/keyboard inputs
 - Load the font atlas texture into graphics memory
 - Providing a render function to render indexed textured triangles
 - Optional: clipboard support, mouse cursor supports, Windows IME support, etc.
So this is essentially what those examples are doing + the obligatory cruft for portability.

Unfortunately in 2016 it is still tedious to create and maintain portable build files using external 
libraries (the kind we're using here to create a window and render 3D triangles) without relying on 
third party software. For most examples here I choose to provide:
 - Makefiles for Linux/OSX
 - Batch files for Visual Studio 2008+
 - A .sln project file for Visual Studio 2010+ 
Please let me know if they don't work with your setup!
You can probably just import the imgui_impl_xxx.cpp/.h files into your own codebase or compile those
directly with a command-line compiler.

ImGui has zero frame of lag for most behaviors and one frame of lag for some behaviors. 
At 60 FPS your experience should be pleasant. Consider that OS mouse cursors are typically drawn through 
a specific hardware accelerated route and may feel smoother than other GPU rendered contents. You may 
experiment with the io.MouseDrawCursor flag to request ImGui to draw a mouse cursor itself, to visualize 
the lag between a hardware cursor and a software cursor. It might be beneficial to the user experience
to switch to a software rendered cursor when an interactive drag is in progress. 
Also note that some setup or GPU drivers may be causing extra lag (possibly by enforcing triple buffering), 
leaving you with no option but sadness/anger (Intel GPU drivers were reported as such).

opengl2_example/
    GLFW + OpenGL example (old, fixed graphic pipeline).
    This is only provided as a reference to learn how ImGui integration works, because it is easier to read.
    However, if your code is using GL3+ context, using this may confuse your driver. Please use the GL3 example below.
	(You might be able to use this code in a GL3/GL4 context but make sure you disable the programmable 
	pipeline by calling "glUseProgram(0)" before ImGui::Render. It appears that many librairies and drivers
	are having issues mixing GL2 calls and newer GL3/GL4 calls. So it isn't recommended that you use that.)

opengl3_example/
    GLFW + OpenGL example (programmable pipeline, binding modern functions with GL3W).
    This uses more modern OpenGL calls and custom shaders. 
    Prefer using that if you are using modern OpenGL3/4 in your application.

directx9_example/
    DirectX9 example, Windows only.
	
directx10_example/
    DirectX10 example, Windows only.
    This is quite long and tedious, because: DirectX10.

directx11_example/
    DirectX11 example, Windows only.
    This is quite long and tedious, because: DirectX11.
	
apple_example/
    OSX & iOS example.
    On iOS, Using Synergy to access keyboard/mouse data from server computer.
    Synergy keyboard integration is rather hacky.

sdl_opengl2_example/
    SDL2 + OpenGL example (old fixed pipeline).

sdl_opengl3_example/
    SDL2 + OpenGL3 example.

allegro5_example/
    Allegro 5 example.
	 
marmalade_example/
    Marmalade example using IwGx
    
vulkan_example/
	Vulkan example.
	This is quite long and tedious, because: Vulkan.