Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyscope OpenGL Error #1

Closed
amiltonwong opened this issue Feb 13, 2021 · 10 comments
Closed

Polyscope OpenGL Error #1

amiltonwong opened this issue Feb 13, 2021 · 10 comments

Comments

@amiltonwong
Copy link

amiltonwong commented Feb 13, 2021

Hi, all,

I've built the project simplicial-complex-operators without error. However, when I run the main executable to display the mesh file. Error message such as Polyscope OpenGL Error! Type: Invalid enum appears. Any hints to solve this issue? THX!

root@milton-PC:/data/code14/ddg-exercises/projects/simplicial-complex-operators/build# ./bin/main ../../../input/disk.obj 
[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 3.3 (Core Profile) Mesa 18.0.5
[polyscope] Polyscope OpenGL Error!  Type: Invalid enum
GLError() after shader compilation! Program text:

      
// tag ${ GLSL_VERSION }$
// from rule: GLSL_VERSION
#version 330 core

      in vec3 a_position;
      out vec2 tCoord;

      void main()
      {
          tCoord = (a_position.xy+vec2(1.0,1.0))/2.0;
          gl_Position = vec4(a_position,1.);
      }

terminate called after throwing an instance of 'std::runtime_error'
  what():  OpenGl error occurred. Text: Invalid enum
Aborted (core dumped)

P.S. My system is ubuntu 16.04.7. gcc/g++ already upgraded to 7.5 version.

@mwmuni
Copy link

mwmuni commented Mar 15, 2022

@amiltonwong how did you end up resolving this issue?

EDIT: seems like this issue was resolved here

@Bathsheba
Copy link

I had the same issue and resolved it in the same way.

@amiltonwong
Copy link
Author

@mwmuni , you're right, I resolved it by rebuilding it using cmake -DCMAKE_BUILD_TYPE=Debug ..

@Bathsheba
Copy link

Actually, after I updated to the latest mesa (through kisak) I didn't need the debug build anymore.
(Now there's a new issue in which the project compiles clean and launches, but Polyscope doesn't get any mouse events so it's unusable, except it can zoom using the mousewheel...I really don't want to use JS because I'll need this code later, but dang it's frustrating that this doesn't quite work.)

@mwmuni
Copy link

mwmuni commented Mar 16, 2022

Actually, after I updated to the latest mesa (through kisak) I didn't need the debug build anymore. (Now there's a new issue in which the project compiles clean and launches, but Polyscope doesn't get any mouse events so it's unusable, except it can zoom using the mousewheel...I really don't want to use JS because I'll need this code later, but dang it's frustrating that this doesn't quite work.)

It seems like some C++ optimisations are optimising out critical OpenGL code. Does anyone familiar with compilation optimisation know how to fix this without compiling in debug mode?

I had the exact same issue and fix with a separate project, so this issue is not isolated to this repo.

@Bathsheba
Copy link

Bathsheba commented Mar 16, 2022

Well thank God I'm not crazy. NB I still see the no-mouse problem after compiling in debug mode.
Do we need a new issue?

@mwmuni
Copy link

mwmuni commented Mar 16, 2022

Well thank God I'm not crazy. Do we need a new issue?

Probably not. I would say that opening this issue again would be sufficient, since the solution of compiling in debug mode is inadequte.

@mwmuni
Copy link

mwmuni commented Mar 18, 2022

After several hours, I isolated the issue to a default optimisation in the compiler at O1 and above.

Adding -fno-defer-pop to the compilation flags resolves the issue for me.

@Bathsheba
Copy link

Gj! not me though. Are you in Windows 11?

@mwmuni
Copy link

mwmuni commented Mar 20, 2022

After several hours, I isolated the issue to a default optimisation in the compiler at O1 and above.

Adding -fno-defer-pop to the compilation flags resolves the issue for me.

Gj! not me though. Are you in Windows 11?

WSL2 under Windows 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants