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

Select nodes and elements #35

Closed
461353349 opened this issue Oct 23, 2019 · 28 comments
Closed

Select nodes and elements #35

461353349 opened this issue Oct 23, 2019 · 28 comments
Labels
enhancement New feature or request

Comments

@461353349
Copy link

Is it possible to implement the following functions with modern OpenGL pipeline?

  1. Interactive rectangle selection of nodes or elements;
  2. Hiding the selected nodes and elements.
@LiangliangNan LiangliangNan added the enhancement New feature or request label Oct 23, 2019
@LiangliangNan
Copy link
Owner

Thanks for the suggestion!
This is easy to implement: pass the rectangle to the vertex shader and test if each point lies inside/outside the rectangle in the shader. You probably need the Shader Storage Buffer to retrieve the result.
I may include this in a future release.

@461353349
Copy link
Author

It is nice of you!
I hadnot thought that glsl shader could do these.

@461353349
Copy link
Author

I uncheck the WITH_UNWIND and WITH_GFLAGS, Because cmake couldnot find the responding files. When I run the example, I couldnot pick the model or the face.
image

@LiangliangNan
Copy link
Owner

LiangliangNan commented Feb 7, 2020 via email

@461353349
Copy link
Author

I have loaded the lastest code and recompiled, But the results are same.

@LiangliangNan
Copy link
Owner

LiangliangNan commented Feb 8, 2020

Did you have similar issues with other examples? e.g., Ambient Occlusion, Shadow

@461353349
Copy link
Author

461353349 commented Feb 8, 2020

I think the following examples are OK. But Tutorial_504_SoftShadow couldnot show the model and crash.
image
image

@461353349
Copy link
Author

461353349 commented Feb 8, 2020

Tutorial_309_PointSelection is OK.
Tutorial_307_ModelPicker and Tutorial_308_FacePicker could show the model, But couldnot rotate the model, Whenever the left mouse clicked, There would show the following the information.
image

@LiangliangNan
Copy link
Owner

I could not reproduce the issue. Tests succeeded on 3 different laptops (even on a 12-year old one; both NVidia and AMD graphics cards).

You provided information is not sufficient to figure out the issues. I would suggest you do the following tests one by one and let me know how they are different (for each of the tests). Then I may understand the cause of the issue.

  • Test 1: request a higher version of OpenGL context when creating the viewer.
    On line 37 of picker_viewer.cpp of FacePicker, ask for 4 samples, OpenGL version 3.3, i.e.,Viewer(title, 4, 3, 3) , or without smaples Viewer(title, 0, 3, 3)

  • Test 2: on line 253 of picker_surface_mesh.cpp, change the samples to 4 (so it is the same as you have requested for the viewer), i.e., fbo_ = new FramebufferObject(width, height, 4);

@461353349
Copy link
Author

I grab the latest code, update opengl to the latest, and reset vs2017.
Test 1: no difference.
Test 2: information as the following.
image

@LiangliangNan
Copy link
Owner

LiangliangNan commented Feb 9, 2020 via email

@461353349
Copy link
Author

image

@LiangliangNan
Copy link
Owner

LiangliangNan commented Feb 9, 2020

NVidia and AMD(ATI) GPUs are all OK. Intel Graphics cards are buggy!!!
Tricky because I don't have an intel graphics card.

I added code to print more debug information. Please grab the new code, and on line 57 of "picker.cpp", change #if 0 to #if 1. Run in Debug mode.

#if 0
            fbo_->print_attachments();
            fbo_->print_draw_buffers();
            fbo_->print_read_buffer();
#endif

@461353349
Copy link
Author

First I switch Graphics from Intel to NVidia, It is OK!

Then I grab the new code, switch Graphics to Intel, and run in debug mode. At last the program crashes, and I notice the amount of memory the process used has exceeded the physical memory.

image

@LiangliangNan
Copy link
Owner

That has no actual information.
I need to look at the console window, to see the debug information.

@461353349
Copy link
Author

I0209 18:01:43.709262 640 logging.cpp:83] logger initialized
I0209 18:01:43.721263 640 logging.cpp:84] Executable path: D:\Project\Post\Ope
nGL\Easy3D\Easy3D\Build\bin\Debug
I0209 18:01:43.722263 640 logging.cpp:85] Current working dir: D:\Project\Post
\OpenGL\Easy3D\Easy3D\Build\tutorials\Tutorial_308_FacePicker
I0209 18:01:44.153287 640 viewer.cpp:244] OpenGL vendor: Intel
I0209 18:01:44.155288 640 viewer.cpp:245] OpenGL renderer: Intel(R) H
D Graphics 4600
I0209 18:01:44.157289 640 viewer.cpp:246] OpenGL version requested: 3.3
I0209 18:01:44.159288 640 viewer.cpp:247] OpenGL version received: 3.3.0 - Bu
ild 10.18.14.4294
I0209 18:01:44.161288 640 viewer.cpp:248] GLSL version received: 3.30 - Bui
ld 10.18.14.4294
I0209 18:01:44.163288 640 viewer.cpp:262] Samples received: 4 (4 reque
sted, max support is 8)
I0209 18:01:44.165288 640 viewer.cpp:267] DPI scaling: 1
surface mesh loaded (#face: 25, #vertex: 26, #edge: 51). Time: 96.1ms
I0209 18:01:44.343298 640 renderer.cpp:228] num of vertices in model/sent to G
PU: 26/26
current model: 0, D:\Project\Post\OpenGL\Easy3D\Easy3D\Build\bin/resources/data/
quad_mesh/P.off
------------ Picker Viewer usage ----------
Press the mouse to pick a face

debug : Medium - API - Performance : API_ID_RECOMPILE_FRAGMENT_SHADER performanc
e warning has been generated. Fragment shader recompiled due to state change.
Framebuffer incomplete, attachments must have same number of samples per pixel.
Current framebuffer is bind to framebuffer object 1
color attachment 0:
this attachment is a render buffer
this attachment is a render buffer with name: 1
render buffer width = 960
render buffer height = 800
render buffer samples = 1
render buffer internal format = 0x8058
render buffer actual resolution for the red component = 8
render buffer actual resolution for the green component = 8
render buffer actual resolution for the blue component = 8
render buffer actual resolution for the alpha component = 8
render buffer actual resolution for the depth component = 0
render buffer actual resolution for the stencil component = 0
color attachment 1:
this attachment is empty
color attachment 2:
this attachment is empty
color attachment 3:
this attachment is empty
color attachment 4:
this attachment is empty
color attachment 5:
this attachment is empty
color attachment 6:
this attachment is empty
color attachment 7:
this attachment is empty
depth attachment:
this attachment is a render buffer
this attachment is a render buffer with name: 2
debug : High - API - ERROR : Error has been generated. GL error GL_INVALID_OPERA
TION
render buffer width = 960
render buffer height = 800
render buffer samples = 1
render buffer internal format = 0x8058
render buffer actual resolution for the red component = 8
render buffer actual resolution for the green component = 8
render buffer actual resolution for the blue component = 8
render buffer actual resolution for the alpha component = 8
render buffer actual resolution for the depth component = 0
render buffer actual resolution for the stencil component = 0
GL error:
file: framebuffer_object.cpp
line: 1239
function: easy3d::FramebufferObject::_print_attachment
info: Invalid operation (The specified operation is not allowed in the c
urrent state)
stencil attachment:
this attachment is a render buffer
this attachment is a render buffer with name: 2
debug : High - API - ERROR : Error has been generated. GL error GL_INVALID_OPERA
TION
render buffer width = 960
render buffer height = 800
render buffer samples = 1
render buffer internal format = 0x8058
render buffer actual resolution for the red component = 8
render buffer actual resolution for the green component = 8
render buffer actual resolution for the blue component = 8
render buffer actual resolution for the alpha component = 8
render buffer actual resolution for the depth component = 0
render buffer actual resolution for the stencil component = 0
GL error:
file: framebuffer_object.cpp
line: 1239
function: easy3d::FramebufferObject::_print_attachment
info: Invalid operation (The specified operation is not allowed in the c
urrent state)
there are 8 draw buffers.
draw buffer[0] = GL_COLOR_ATTACHMENT0
draw buffer[1] = GL_NONE
draw buffer[2] = GL_NONE
draw buffer[3] = GL_NONE
draw buffer[4] = GL_NONE
draw buffer[5] = GL_NONE
draw buffer[6] = GL_NONE
draw buffer[7] = GL_NONE
read buffer = GL_BACK
framebuffer not valid
debug : Medium - API - Performance : API_ID_RECOMPILE_FRAGMENT_SHADER performanc
e warning has been generated. Fragment shader recompiled due to state change.
source framebuffer not valid

@LiangliangNan
Copy link
Owner

How many samples did you request for the frame buffer?
The log says 1.

@461353349
Copy link
Author

I change Viewer(title, 4, 3, 3) and fbo = new FramebufferObject(width, height, 4);_ as you said, then run in debug mode.

------------ Picker Viewer usage ----------
Press the mouse to pick a face

debug : Medium - API - Performance : API_ID_RECOMPILE_FRAGMENT_SHADER performanc
e warning has been generated. Fragment shader recompiled due to state change.
Current framebuffer is bind to framebuffer object 1
color attachment 0:
this attachment is a render buffer
this attachment is a render buffer with name: 1
render buffer width = 960
render buffer height = 800
render buffer samples = 4
render buffer internal format = 0x8058
render buffer actual resolution for the red component = 8
render buffer actual resolution for the green component = 8
render buffer actual resolution for the blue component = 8
render buffer actual resolution for the alpha component = 8
render buffer actual resolution for the depth component = 0
render buffer actual resolution for the stencil component = 0
color attachment 1:
this attachment is empty
color attachment 2:
this attachment is empty
color attachment 3:
this attachment is empty
color attachment 4:
this attachment is empty
color attachment 5:
this attachment is empty
color attachment 6:
this attachment is empty
color attachment 7:
this attachment is empty
depth attachment:
this attachment is a render buffer
this attachment is a render buffer with name: 2
render buffer width = 960
render buffer height = 800
render buffer samples = 4
render buffer internal format = 0x88f0
render buffer actual resolution for the red component = 0
render buffer actual resolution for the green component = 0
render buffer actual resolution for the blue component = 0
render buffer actual resolution for the alpha component = 0
render buffer actual resolution for the depth component = 24
render buffer actual resolution for the stencil component = 8
stencil attachment:
this attachment is a render buffer
this attachment is a render buffer with name: 2
render buffer width = 960
render buffer height = 800
render buffer samples = 4
render buffer internal format = 0x88f0
render buffer actual resolution for the red component = 0
render buffer actual resolution for the green component = 0
render buffer actual resolution for the blue component = 0
render buffer actual resolution for the alpha component = 0
render buffer actual resolution for the depth component = 24
render buffer actual resolution for the stencil component = 8
there are 8 draw buffers.
draw buffer[0] = GL_COLOR_ATTACHMENT0
draw buffer[1] = GL_NONE
draw buffer[2] = GL_NONE
draw buffer[3] = GL_NONE
draw buffer[4] = GL_NONE
draw buffer[5] = GL_NONE
draw buffer[6] = GL_NONE
draw buffer[7] = GL_NONE
read buffer = GL_BACK
debug : Medium - API - Performance : API_ID_RECOMPILE_FRAGMENT_SHADER performanc
e warning has been generated. Fragment shader recompiled due to state change.
Framebuffer incomplete, attachments must have same number of samples per pixel.
Framebuffer incomplete, attachments must have same number of samples per pixel.
target framebuffer not valid
source framebuffer not valid

@LiangliangNan
Copy link
Owner

LiangliangNan commented Feb 9, 2020

You see the "GL error" is gone. Your GPU requires a new FBO must have the same number of samples as the original FBO. This is now satisfied as required by your GPU (the OpenGL specification/standard doesn't require this).

Now from the log, all attachments have samples 4, but it still says "attachments must have same number of samples per pixel".
Can you request 0 samples for both the viewer and the FBO and post the log here?

@461353349
Copy link
Author

I change Viewer(title, 0, 3, 3) and fbo = new FramebufferObject(width, height, 0);_ as you said, then run in debug mode.

------------ Picker Viewer usage ----------
Press the mouse to pick a face

debug : Medium - API - Performance : API_ID_RECOMPILE_FRAGMENT_SHADER performanc
e warning has been generated. Fragment shader recompiled due to state change.
Framebuffer incomplete, attachments must have same number of samples per pixel.
Current framebuffer is bind to framebuffer object 1
color attachment 0:
this attachment is a render buffer
this attachment is a render buffer with name: 1
render buffer width = 960
render buffer height = 800
render buffer samples = 1
render buffer internal format = 0x8058
render buffer actual resolution for the red component = 8
render buffer actual resolution for the green component = 8
render buffer actual resolution for the blue component = 8
render buffer actual resolution for the alpha component = 8
render buffer actual resolution for the depth component = 0
render buffer actual resolution for the stencil component = 0
color attachment 1:
this attachment is empty
color attachment 2:
this attachment is empty
color attachment 3:
this attachment is empty
color attachment 4:
this attachment is empty
color attachment 5:
this attachment is empty
color attachment 6:
this attachment is empty
color attachment 7:
this attachment is empty
depth attachment:
this attachment is a render buffer
this attachment is a render buffer with name: 2
debug : High - API - ERROR : Error has been generated. GL error GL_INVALID_OPERA
TION
render buffer width = 960
render buffer height = 800
render buffer samples = 1
render buffer internal format = 0x8058
render buffer actual resolution for the red component = 8
render buffer actual resolution for the green component = 8
render buffer actual resolution for the blue component = 8
render buffer actual resolution for the alpha component = 8
render buffer actual resolution for the depth component = 0
render buffer actual resolution for the stencil component = 0
GL error:
file: framebuffer_object.cpp
line: 1239
function: easy3d::FramebufferObject::_print_attachment
info: Invalid operation (The specified operation is not allowed in the c
urrent state)
stencil attachment:
this attachment is a render buffer
this attachment is a render buffer with name: 2
debug : High - API - ERROR : Error has been generated. GL error GL_INVALID_OPERA
TION
render buffer width = 960
render buffer height = 800
render buffer samples = 1
render buffer internal format = 0x8058
render buffer actual resolution for the red component = 8
render buffer actual resolution for the green component = 8
render buffer actual resolution for the blue component = 8
render buffer actual resolution for the alpha component = 8
render buffer actual resolution for the depth component = 0
render buffer actual resolution for the stencil component = 0
GL error:
file: framebuffer_object.cpp
line: 1239
function: easy3d::FramebufferObject::_print_attachment
info: Invalid operation (The specified operation is not allowed in the c
urrent state)
there are 8 draw buffers.
draw buffer[0] = GL_COLOR_ATTACHMENT0
draw buffer[1] = GL_NONE
draw buffer[2] = GL_NONE
draw buffer[3] = GL_NONE
draw buffer[4] = GL_NONE
draw buffer[5] = GL_NONE
draw buffer[6] = GL_NONE
draw buffer[7] = GL_NONE
read buffer = GL_BACK
framebuffer not valid
debug : Medium - API - Performance : API_ID_RECOMPILE_FRAGMENT_SHADER performanc
e warning has been generated. Fragment shader recompiled due to state change.
source framebuffer not valid

@461353349
Copy link
Author

I am not sure that what I had modified.

@LiangliangNan
Copy link
Owner

Weird that you received 1 sample for the FBO. But what are the actual sample of the viewer ?

@LiangliangNan
Copy link
Owner

https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware/intel-hd-graphics-4600-incompatibility-issue-in/608bb6da-a88f-48d6-af45-ea490b1e2cbd

From here, it seems it is a known compatibility issue with the HD Graphics 4600 and Windows 10.

I also googled "HD Graphics 4600 bug", too many complaints.
So I believe it is a bug in the display driver. This can also be concluded from the fact that your HD Graphics 4600 GPU requires a new FBO must have the same number of samples as the original FBO.

@461353349
Copy link
Author

OK!
I would run opengl in NVidia or AMD(ATI). I think NVidia or AMD(ATI) is basic setup for most computers.
Thanks very much!!!

@LiangliangNan
Copy link
Owner

LiangliangNan commented Feb 9, 2020 via email

@461353349
Copy link
Author

So I just change Viewer(title, 0, 3, 3). conresponding to original code. My OS is win7 SP1.

I0209 18:57:49.095752 4456 logging.cpp:83] logger initialized
I0209 18:57:49.099751 4456 logging.cpp:84] Executable path: D:\Project\Post\Ope
nGL\Easy3D\Easy3D\Build\bin\Debug
I0209 18:57:49.100751 4456 logging.cpp:85] Current working dir: D:\Project\Post
\OpenGL\Easy3D\Easy3D\Build\tutorials\Tutorial_308_FacePicker
I0209 18:58:51.536324 4456 viewer.cpp:244] OpenGL vendor: Intel
I0209 18:58:51.539324 4456 viewer.cpp:245] OpenGL renderer: Intel(R) H
D Graphics 4600
I0209 18:58:51.541323 4456 viewer.cpp:246] OpenGL version requested: 3.3
I0209 18:58:51.543323 4456 viewer.cpp:247] OpenGL version received: 3.3.0 - Bu
ild 10.18.14.4294
I0209 18:58:51.545323 4456 viewer.cpp:248] GLSL version received: 3.30 - Bui
ld 10.18.14.4294
I0209 18:58:51.546324 4456 viewer.cpp:262] Samples received: 0 (0 reque
sted, max support is 8)
I0209 18:58:51.548323 4456 viewer.cpp:267] DPI scaling: 1
surface mesh loaded (#face: 25, #vertex: 26, #edge: 51). Time: 84.6ms
I0209 18:58:51.691331 4456 renderer.cpp:228] num of vertices in model/sent to G
PU: 26/26
current model: 0, D:\Project\Post\OpenGL\Easy3D\Easy3D\Build\bin/resources/data/
quad_mesh/P.off
------------ Picker Viewer usage ----------
Press the mouse to pick a face

debug : Medium - API - Performance : API_ID_RECOMPILE_FRAGMENT_SHADER performanc
e warning has been generated. Fragment shader recompiled due to state change.
Framebuffer incomplete, attachments must have same number of samples per pixel.
Current framebuffer is bind to framebuffer object 1
color attachment 0:
this attachment is a render buffer
this attachment is a render buffer with name: 1
render buffer width = 960
render buffer height = 800
render buffer samples = 1
render buffer internal format = 0x8058
render buffer actual resolution for the red component = 8
render buffer actual resolution for the green component = 8
render buffer actual resolution for the blue component = 8
render buffer actual resolution for the alpha component = 8
render buffer actual resolution for the depth component = 0
render buffer actual resolution for the stencil component = 0
color attachment 1:
this attachment is empty
color attachment 2:
this attachment is empty
color attachment 3:
this attachment is empty
color attachment 4:
this attachment is empty
color attachment 5:
this attachment is empty
color attachment 6:
this attachment is empty
color attachment 7:
this attachment is empty
depth attachment:
this attachment is a render buffer
this attachment is a render buffer with name: 2
debug : High - API - ERROR : Error has been generated. GL error GL_INVALID_OPERA
TION
render buffer width = 960
render buffer height = 800
render buffer samples = 1
render buffer internal format = 0x8058
render buffer actual resolution for the red component = 8
render buffer actual resolution for the green component = 8
render buffer actual resolution for the blue component = 8
render buffer actual resolution for the alpha component = 8
render buffer actual resolution for the depth component = 0
render buffer actual resolution for the stencil component = 0
GL error:
file: framebuffer_object.cpp
line: 1239
function: easy3d::FramebufferObject::_print_attachment
info: Invalid operation (The specified operation is not allowed in the c
urrent state)
stencil attachment:
this attachment is a render buffer
this attachment is a render buffer with name: 2
debug : High - API - ERROR : Error has been generated. GL error GL_INVALID_OPERA
TION
render buffer width = 960
render buffer height = 800
render buffer samples = 1
render buffer internal format = 0x8058
render buffer actual resolution for the red component = 8
render buffer actual resolution for the green component = 8
render buffer actual resolution for the blue component = 8
render buffer actual resolution for the alpha component = 8
render buffer actual resolution for the depth component = 0
render buffer actual resolution for the stencil component = 0
GL error:
file: framebuffer_object.cpp
line: 1239
function: easy3d::FramebufferObject::_print_attachment
info: Invalid operation (The specified operation is not allowed in the c
urrent state)
there are 8 draw buffers.
draw buffer[0] = GL_COLOR_ATTACHMENT0
draw buffer[1] = GL_NONE
draw buffer[2] = GL_NONE
draw buffer[3] = GL_NONE
draw buffer[4] = GL_NONE
draw buffer[5] = GL_NONE
draw buffer[6] = GL_NONE
draw buffer[7] = GL_NONE
read buffer = GL_BACK
framebuffer not valid
debug : Medium - API - Performance : API_ID_RECOMPILE_FRAGMENT_SHADER performanc
e warning has been generated. Fragment shader recompiled due to state change.
source framebuffer not valid

@LiangliangNan
Copy link
Owner

LiangliangNan commented Feb 9, 2020

OK, Thanks.
You requested 0 samples for the viewer, and you did receive 0.
You requested 0 samples for the FBO, but you received 1. That must be a bug in the display driver of the HD Graphics 4600.

@461353349
Copy link
Author

OK, I see!
Thanks a lot. I donnot know these before.

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

No branches or pull requests

2 participants