dandistine / olcPGEDearImGui

A small header file to assist in integrating Dear ImGUI with the PixelGameEngine in a platform agnostic way.
19 stars 2 forks source link

OpenGL 3.3 include order #6

Open oodgaard opened 9 months ago

oodgaard commented 9 months ago

Hi @dandistine . I was successful in getting your extension to work and render some imgui menus etc using the defualt opengl 2.x. However when enabling opengl 3.3 I get the following error:

include/GL/glew.h:85:2: error: #error gl.h included before glew.h

PGE includes gl.h so I'm not sure how you tested this one ?

dandistine commented 9 months ago

One of my test projects has a olcPixelGameEngine.cpp file with the following content:

#define OLC_GFX_OPENGL33
#define OLC_PGEX_DEAR_IMGUI_IMPLEMENTATION
#include "imgui_impl_pge.h"
#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"

This works fine as PGE does not include the gl header unless OLC_PGE_APPLICATION is defined. Define that after the imgui_impl_pge.h include and it should work fine.

oodgaard commented 9 months ago

Are you using PGE v2.24 ?

Line 1352 `

if defined(OLC_GFX_OPENGL33)

...

include <GL/glx.h>

`

dandistine commented 9 months ago

2.16 is the version in my project. At a glance it looks like it is not compatible with 2.21+ due to the change in where the gl header is included. 2.17 also introduces a change where OnBeforeUserUpdate returns bool now instead of void. Downgrading the 2.20 should work if you change the return types on the OnBeforeUserUpdate function.