Tuesday, November 5, 2024
spot_img

How am i able to take away the background GLFW window of a ImGui software?


I am creating an software that makes use of GLFW, GLAD, OpenGL, and ImGui for rendering the UI. I wish to make the GLFW window background absolutely clear or take away it completely, in order that solely the ImGui components are seen. Nevertheless, I am having hassle attaining this.

Right here is my code:

GLFWwindow* glfw::glfw_init_window(const std::string& wt , GLFWwindow* glwin){

  window WINDOW = win_config(wt);

  glfwInit();

  glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR , 3);
  glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR , 3);

  glfwWindowHint(GLFW_OPENGL_PROFILE , GLFW_OPENGL_CORE_PROFILE);


  int top = WINDOW.top;
  int width = WINDOW.width;

  int xpos = WINDOW.xposition;
  int ypos = WINDOW.yposition;

  glwin = glfwCreateWindow(width,top,"First Window",NULL,NULL);

  if (!glwin)
  {
      std::cerr 

and the primary operate :

int predominant()
{
    const char* glsl_version = "#model 130";

    /*GLFW window initioation*/
    GLFWwindow* glfwWin;
    glfwWin = glfw::glfw_init_window("G",glfwWin);                        // initiating glfw window
    

    //imgui code right here
    gui gui_interface;
    gui_interface.init(glfwWin,glsl_version);
    whereas (!glfwWindowShouldClose(glfwWin))
    {

    
       glClearColor(0.5f,0.2f,0.1f,1.0f);
       glClear(GL_COLOR_BUFFER_BIT);

    
       glfwPollEvents();
       gui_interface.NewFrame();
       gui_interface.replace();
       gui_interface.render();
       glfwSwapBuffers(glfwWin);  
    }

    gui_interface.shutdown();
    glfwDestroyWindow(glfwWin);
    glfwTerminate();
    return 0;
 }

I’ve tried utilizing

  glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); 
  glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // For eradicating window borders  and likewise 
  glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Full transparency within the framebuffer 
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

however ultimately nothing labored.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles