Imgui: Making a transparent ImGui window

Created on 8 Jun 2020  路  2Comments  路  Source: ocornut/imgui

Version: 1.76
Branch:master

Back-ends: imgui_impl_glut.cpp + imgui_impl_opengl2.cpp _
Compiler: g++
Operating System: Ubuntu 20

My Issue/Question:

Hi, I'm working on a semester project where I have to create a game similar to bejeweled. We had been provided with a skeleton code based on freeglut. Goals of the project were to create a match-3 game with 2 modes and several levels. Also I had to 3 menus; Main menu, Pause menu, Level selection menu. Now I have a background image for each of my menus, and i created a texture binding class to bind and render my backgrounds and my gems, however; I want to create a seamless window using ImGui that is partially or fully transparent so that i can create buttons on that window that might look as they are rendered on top of the background.

Additionally, I couldnt find any tutorial/instructions regarding how to create a drop down menu bar usually found at the top of a window.

Most helpful comment

seamless window using ImGui that is partially or fully transparent

Try setting window flags when you call ImGui::Begin()

ImGuiWindowFlags window_flags = 0;
window_flags |= ImGuiWindowFlags_NoBackground;
window_flags |= ImGuiWindowFlags_NoTitleBar;
// etc.
bool * open_ptr = true;
ImGui::Begin("I'm a Window!", open_ptr, window_flags);

Here's a before/after
Capture

--- A great place to look for examples on almost all ImGui features is the demo window ---

Additionally, I couldn't find any tutorial/instructions regarding how to create a drop-down menu bar usually found at the top of a window.

Try looking at ImGui::BeginMenuBar()
If you do a find/replace for 'BeginMenuBar(),' in the imgui_demo.cpp file. You will find a nice example of the menu bar in action.

All 2 comments

seamless window using ImGui that is partially or fully transparent

Try setting window flags when you call ImGui::Begin()

ImGuiWindowFlags window_flags = 0;
window_flags |= ImGuiWindowFlags_NoBackground;
window_flags |= ImGuiWindowFlags_NoTitleBar;
// etc.
bool * open_ptr = true;
ImGui::Begin("I'm a Window!", open_ptr, window_flags);

Here's a before/after
Capture

--- A great place to look for examples on almost all ImGui features is the demo window ---

Additionally, I couldn't find any tutorial/instructions regarding how to create a drop-down menu bar usually found at the top of a window.

Try looking at ImGui::BeginMenuBar()
If you do a find/replace for 'BeginMenuBar(),' in the imgui_demo.cpp file. You will find a nice example of the menu bar in action.

Closing as answered thank you @PossiblyAShrub

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Folling picture Folling  路  3Comments

mkanakis picture mkanakis  路  3Comments

the-lay picture the-lay  路  3Comments

NPatch picture NPatch  路  3Comments

BlackWatersInc picture BlackWatersInc  路  3Comments