0

I am trying to create make a purple window using glfw window library and with bgfx C++ on arch linux like below:

enter image description here

but it gives out the error:

X Error of failed request:  GLXBadDrawable
Major opcode of failed request:  152 (GLX)
Minor opcode of failed request:  11 (X_GLXSwapBuffers)
Serial number of failed request:  33
Current serial number in output stream:  33

my main.cpp:

#include "main.h"

int main(int, char**) {
    glfwInit();
    GLFWwindow* window = glfwCreateWindow(WNDW_WIDTH, WNDW_HEIGHT, "Hello, bgfx!", NULL, NULL);
    bgfx::Init bgfxInit;
    bgfxInit.type = bgfx::RendererType::Count; // Automatically choose a renderer.
    bgfxInit.resolution.width = WNDW_WIDTH;
    bgfxInit.resolution.height = WNDW_HEIGHT;
    bgfxInit.resolution.reset = BGFX_RESET_VSYNC;
    bgfx::init(bgfxInit);

    bgfx::setViewClear(0, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x443355FF, 1.0f, 0);
    bgfx::setViewRect(0, 0, 0, WNDW_WIDTH, WNDW_HEIGHT);

    unsigned int counter = 0;
    while(true) {   
        bgfx::frame();
        counter++;
    }
    return 0;
}

main.h:

#include <iostream>
#define BX_CONFIG_DEBUG
#define BGFX_P_H_HEADER_GUARD
#include "libs/bgfx/include/bgfx/bgfx.h"
#include "libs/bgfx/include/bgfx/platform.h"
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_X11
#include <GLFW/glfw3native.h>

int WNDW_WIDTH=1600;
int WNDW_HEIGHT =900;

here i included my glfw and bgfx header files

my CMakefile.txt:

cmake_minimum_required(VERSION 3.0.0)
project(bgfx_engine VERSION 0.1.0)

add_executable(bgfx_engine main.cpp)

target_link_libraries(${PROJECT_NAME} GL X11 glfw)

target_link_directories(${PROJECT_NAME} PRIVATE ./libs/bgfx/.build/linux64_gcc/bin/)

target_link_libraries(${PROJECT_NAME} bgfxRelease bimgRelease bxRelease)

I dont know what that error means so i am unable to solve it.

anuj
  • 71
  • 5
  • This is a duplicate of [Error of failed request: GLXBadDrawable (C++ bgfx)](https://stackoverflow.com/q/70893930/7478597), isn't it? – Scheff's Cat Feb 24 '22 at 09:50
  • Are you sure that you installed the correct graphics driver which is OpenGL capable? What GPU / graphics H/W do you use? I found numerous hits for similar issues when googling your issue (out of curiosity). In some of them, issues with Intel graphics boards were mentioned. – Scheff's Cat Feb 24 '22 at 09:56

0 Answers0