mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-28 00:39:02 +08:00
Added comments
This commit is contained in:
parent
5f6b261c9b
commit
80dd1e1065
@ -20,7 +20,10 @@ struct CUSTOMVERTEX
|
||||
};
|
||||
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1)
|
||||
|
||||
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structuer)
|
||||
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
|
||||
// If text or lines are blurry when integrating ImGui in your engine:
|
||||
// - try adjusting ImGui::GetIO().PixelCenterOffset to 0.0f or 0.5f
|
||||
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
||||
static void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count)
|
||||
{
|
||||
size_t total_vtx_count = 0;
|
||||
|
@ -11,14 +11,17 @@
|
||||
static GLFWwindow* window;
|
||||
static GLuint fontTex;
|
||||
|
||||
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structuer)
|
||||
// We are using the fixed pipeline.
|
||||
// A faster way would be to collate all vertices from all cmd_lists into a single vertex buffer
|
||||
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
|
||||
// If text or lines are blurry when integrating ImGui in your engine:
|
||||
// - try adjusting ImGui::GetIO().PixelCenterOffset to 0.0f or 0.5f
|
||||
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
||||
static void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count)
|
||||
{
|
||||
if (cmd_lists_count == 0)
|
||||
return;
|
||||
|
||||
// We are using the OpenGL fixed pipeline to make the example code simpler to read!
|
||||
// A probable faster way to render would be to collate all vertices from all cmd_lists into a single vertex buffer.
|
||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers.
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -53,7 +53,7 @@
|
||||
- every frame:
|
||||
1/ in your mainloop or right after you got your keyboard/mouse info, call ImGui::GetIO() and fill the 'Input' data, then call ImGui::NewFrame().
|
||||
2/ use any ImGui function you want between NewFrame() and Render()
|
||||
3/ ImGui::Render() to render all the accumulated command-lists. it will cack your RenderDrawListFn handler set in the IO structure.
|
||||
3/ ImGui::Render() to render all the accumulated command-lists. it will call your RenderDrawListFn handler that you set in the IO structure.
|
||||
- all rendering information are stored into command-lists until ImGui::Render() is called.
|
||||
- effectively it means you can create widgets at any time in your code, regardless of "update" vs "render" considerations.
|
||||
- a typical application skeleton may be:
|
||||
@ -87,6 +87,10 @@
|
||||
// swap video buffer, etc.
|
||||
}
|
||||
|
||||
- if text or lines are blurry when integrating ImGui in your engine:
|
||||
- try adjusting ImGui::GetIO().PixelCenterOffset to 0.0f or 0.5f
|
||||
- in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
||||
|
||||
- some widgets carry state and requires an unique ID to do so.
|
||||
- unique ID are typically derived from a string label, an indice or a pointer.
|
||||
- use PushID/PopID to easily create scopes and avoid ID conflicts. A Window is also an implicit scope.
|
||||
|
Loading…
Reference in New Issue
Block a user