example_glfw_opengl3 doesn't display imgui content on OpenGL3.0 #1938

Closed
opened 2018-07-10 13:35:10 +00:00 by linaran · 12 comments
linaran commented 2018-07-10 13:35:10 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui:

1.62 release

Back-end file/Renderer/OS:

Trying to use GLFW with OpenGL3 on Linaro Linux release 16.02. Dragonboard 410c came with that OS. Supported OpenGL by the driver is "OpenGL version string: 3.0 Mesa 18.0.3" (output from glxinfo).

My Issue/Question:

In short I don't see any imgui content (no window it's just simple blue color) when I run the example_glfw_opengl3 sample. Note that I modified the main.cpp. I changed the minor version to 0 (since my driver supports OpenGL3.0) and removed the glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE) line since OpenGL3.0 doesn't support profiles.

OpenGL2 examples and it's integration with my own code works fine. I'm just not having any luck with OpenGL3.0 (can't try OpenGL3.2). I read the documentation and searched through the issues and googled this issue but didn't find anything helpful. If this is a duplicate question I'll see to removing it.

Standalone, minimal, complete and verifiable example:
I marked the changes within main.cpp with 3 excalamation marks (!!!). Everything else is vanilla.

int main(int, char**)
{
    // Setup window
    glfwSetErrorCallback(glfw_error_callback);
    if (!glfwInit())
        return 1;
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); // Changed to 0!!!
//    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); Commented out!!!
#if __APPLE__
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif
    GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui GLFW+OpenGL3 example", NULL, NULL);
    glfwMakeContextCurrent(window);
    glfwSwapInterval(1); // Enable vsync
    gl3wInit();
**Version/Branch of Dear ImGui:** 1.62 release **Back-end file/Renderer/OS:** Trying to use GLFW with OpenGL3 on Linaro Linux release 16.02. Dragonboard 410c came with that OS. Supported OpenGL by the driver is "OpenGL version string: 3.0 Mesa 18.0.3" (output from glxinfo). **My Issue/Question:** In short I don't see any imgui content (no window it's just simple blue color) when I run the **example_glfw_opengl3** sample. Note that I modified the main.cpp. I changed the minor version to 0 (since my driver supports OpenGL3.0) and removed the glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE) line since OpenGL3.0 doesn't support profiles. OpenGL2 examples and it's integration with my own code works fine. I'm just not having any luck with OpenGL3.0 (can't try OpenGL3.2). I read the documentation and searched through the issues and googled this issue but didn't find anything helpful. If this is a duplicate question I'll see to removing it. **Standalone, minimal, complete and verifiable example:** I marked the changes within main.cpp with 3 excalamation marks (!!!). Everything else is vanilla. ``` int main(int, char**) { // Setup window glfwSetErrorCallback(glfw_error_callback); if (!glfwInit()) return 1; glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); // Changed to 0!!! // glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); Commented out!!! #if __APPLE__ glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); #endif GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui GLFW+OpenGL3 example", NULL, NULL); glfwMakeContextCurrent(window); glfwSwapInterval(1); // Enable vsync gl3wInit(); ```
ocornut commented 2018-07-10 13:39:01 +00:00 (Migrated from github.com)

Could you try changing the GLSL version to #130 and/or querying the shader compilation steps for errors?
I will/should add more error handling to this example, will try to do so now..

Could you try changing the GLSL version to #130 and/or querying the shader compilation steps for errors? I will/should add more error handling to this example, will try to do so now..
ebachard commented 2018-07-10 14:01:17 +00:00 (Migrated from github.com)

Hello,

@linaran : can you please comment the #if APPLE ... #endif in main.cpp ? Looks like you need the line

 glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

FYI, I got Linux (x86_64, Intel) here too. My new machine is OpenGL 4.5 capable, but I got the same issue when using 3.0. And commenting the lines above (#ifdef / #endif) makes it work as expected.

HTH

Hello, @linaran : can you please comment the #if __APPLE__ ... #endif in main.cpp ? Looks like you need the line ```` glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); ```` FYI, I got Linux (x86_64, Intel) here too. My new machine is OpenGL 4.5 capable, but I got the same issue when using 3.0. And commenting the lines above (#ifdef / #endif) makes it work as expected. HTH
ocornut commented 2018-07-10 14:11:18 +00:00 (Migrated from github.com)

I have pushed a change to report shader compile and link error (I wonder how it is reported in this situation).

We ought to fix those recurring problem, perhaps lock the version GL/GLSL version on Mac and use lower one on other platforms?

Also linking to #1900, #1513, #1466, #1116 etc.

I have pushed a change to report shader compile and link error (I wonder how it is reported in this situation). We ought to fix those recurring problem, perhaps lock the version GL/GLSL version on Mac and use lower one on other platforms? Also linking to #1900, #1513, #1466, #1116 etc.
linaran commented 2018-07-10 14:13:27 +00:00 (Migrated from github.com)

@ocornut
I'm sort of still learning OpenGL but I was under the impression that OpenGL3.0 came with GLSL1.30 by default (didn't know you can change GLSL versions)? I'll build the example with your changes and report errors.

@ebachard
I tried commenting out those lines and nothing changed.

@ocornut I'm sort of still learning OpenGL but I was under the impression that OpenGL3.0 came with GLSL1.30 by default (didn't know you can change GLSL versions)? I'll build the example with your changes and report errors. @ebachard I tried commenting out those lines and nothing changed.
ocornut commented 2018-07-10 14:16:22 +00:00 (Migrated from github.com)

You can call `ImGui_ImplOpenGL3_Init("#version 130") to build with a different version.
Try updating to latest/master so you'll also benefit from the error reporting code I have just pushed.

You can call `ImGui_ImplOpenGL3_Init("#version 130") to build with a different version. Try updating to latest/master so you'll also benefit from the error reporting code I have just pushed.
ebachard commented 2018-07-10 14:18:57 +00:00 (Migrated from github.com)

@linaran

Let's start with at the begining. Can you post the full output of :

glxinfo -B  

-B option gives a summary of the most important information returned by your graphic card driver.

This will tell us what exactly you can expect with your machine.

@linaran Let's start with at the begining. Can you post the full output of : ```` glxinfo -B ```` -B option gives a summary of the most important information returned by your graphic card driver. This will tell us what exactly you can expect with your machine.
linaran commented 2018-07-10 14:37:48 +00:00 (Migrated from github.com)

Okay I just cloned the latest commit from master.

@ebachard
Since I'm working on 2 computers and the linux one has a limited number of usb ports direct copy paste from the terminal is cumbersome (doing it over SD card).

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: freedreno (0x5143)
    Device: FD307 (0xffffffff)
    Version: 18.0.3
    Accelerated: yes
    Video memory: 10MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 3.1
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL vendor string: freedreno
OpenGL renderer string: FD307
OpenGL core profile version string: 3.1 (Core Profile) Mesa 18.0.3
OpenGL core profile shading language version string: 1.40
OpenGL core profile context flags: (none)

OpenGL version string: 3.0 Mesa 18.0.3
OpenGL shading language version string: 1.30
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.0.3
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

@ocornut
I pulled the latest commit from master, implemented the changes to OpenGL3.0 and these are the errros I got.

ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile vertex sahder!
0:1(10): error: GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, 1.30 and 1.00 ES

The same goes for the fragment shader and the linker failed as expected. I will be changing the version to GLSL1.30 per your instructions.

Okay I just cloned the latest commit from master. @ebachard Since I'm working on 2 computers and the linux one has a limited number of usb ports direct copy paste from the terminal is cumbersome (doing it over SD card). ``` name of display: :0 display: :0 screen: 0 direct rendering: Yes Extended renderer info (GLX_MESA_query_renderer): Vendor: freedreno (0x5143) Device: FD307 (0xffffffff) Version: 18.0.3 Accelerated: yes Video memory: 10MB Unified memory: yes Preferred profile: core (0x1) Max core profile version: 3.1 Max compat profile version: 3.0 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.0 OpenGL vendor string: freedreno OpenGL renderer string: FD307 OpenGL core profile version string: 3.1 (Core Profile) Mesa 18.0.3 OpenGL core profile shading language version string: 1.40 OpenGL core profile context flags: (none) OpenGL version string: 3.0 Mesa 18.0.3 OpenGL shading language version string: 1.30 OpenGL context flags: (none) OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.0.3 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00 ``` @ocornut I pulled the latest commit from master, implemented the changes to OpenGL3.0 and these are the errros I got. ``` ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile vertex sahder! 0:1(10): error: GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, 1.30 and 1.00 ES ``` The same goes for the fragment shader and the linker failed as expected. I will be changing the version to GLSL1.30 per your instructions.
linaran commented 2018-07-10 14:43:53 +00:00 (Migrated from github.com)

@ocornut
Changing the GLSL to 1.30 did the trick 👍
Thanks :)

@ocornut Changing the GLSL to 1.30 did the trick 👍 Thanks :)
ocornut commented 2018-07-10 14:49:23 +00:00 (Migrated from github.com)

Thanks for the confirmation @linaran.

I noticed that the shader works with 130 140 150 with the same context here,
If I change the Texture() call to Texture2D() is also work with 100 (with warnings) and 120.
I'll put a few changes soon.

What's unclear to me is how good GL drivers are honoring compatibility with older GLSL versions than the one desired by the context..

Thanks for the confirmation @linaran. I noticed that the shader works with 130 140 150 with the same context here, If I change the `Texture()` call to `Texture2D()` is also work with 100 (with warnings) and 120. I'll put a few changes soon. What's unclear to me is how good GL drivers are honoring compatibility with older GLSL versions than the one desired by the context..
ocornut commented 2018-07-10 16:31:19 +00:00 (Migrated from github.com)

I have pushed changes to the Examples+Bindings now. @linaran if you have a chance could you confirm that the unmodified repository now works with your configuration? Thanks!

I have pushed changes to the Examples+Bindings now. @linaran if you have a chance could you confirm that the unmodified repository now works with your configuration? Thanks!
linaran commented 2018-07-11 08:42:21 +00:00 (Migrated from github.com)

@ocornut I'm confirming that the unmodified repository works. Cheers!

@ocornut I'm confirming that the unmodified repository works. Cheers!
ocornut commented 2018-07-11 08:43:14 +00:00 (Migrated from github.com)

Excellent, closing this issue then!

Excellent, closing this issue then!
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#1938
No description provided.