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

All solid edges shown as occluded #378

Open
ghost opened this issue Feb 9, 2019 · 8 comments
Open

All solid edges shown as occluded #378

ghost opened this issue Feb 9, 2019 · 8 comments

Comments

@ghost
Copy link

ghost commented Feb 9, 2019

System information

SolveSpace version: 3.0~10123738

Operating system: Debian 9.x Stretch

Expected behavior

Only really occluded edges should be shown as hidden

Actual behavior

All solid edges shown as occluded

Additional information

pic.1

pic.2

pic.3

@Evil-Spirit
Copy link
Collaborator

@whitequark probably here is the problem caused by e383b7f

@whitequark
Copy link
Contributor

@Evil-Spirit No, it was a problem as far as I can remember, I just never paid attention to it. It renders the same way if I revert e383b7f.

@whitequark whitequark added the bug label Feb 10, 2019
@whitequark whitequark added this to the 3.0 milestone Jun 23, 2020
@phkahler
Copy link
Member

phkahler commented Sep 14, 2020

On my system it looks like the occluded lines are drawn by drawing all lines (in whichever style) without Z-buffer, and then drawing all of them again in normal style with the Z-buffer enabled. It looks like some kind of fighting between the two line styles rather than only using the right one for each edge. Is that what's happening? @Evil-Spirit ?

EDIT: This look a lot like it's not applying the depth test correctly for occluded lines. Meaning this:

strokeHidden.layer  = Canvas::Layer::OCCLUDED;

Probably isn't correctly affecting this:

        case Canvas::Layer::OCCLUDED:
            glDepthFunc(GL_GREATER);
            glDepthMask(GL_FALSE);
            glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
            break;

It's actually saying to draw the one line style only for things hidden by the Z-buffer, but that's not working.

@Evil-Spirit
Copy link
Collaborator

Evil-Spirit commented Sep 16, 2020

Probably, I can blame glDepthRangef following after this. I suppose for hidden lines it should be performed in a different way.

@Evil-Spirit
Copy link
Collaborator

Also, depth write probably should be switched off (glDepthMask(GL_FALSE)) for non-occluded edges.

@phkahler
Copy link
Member

phkahler commented Sep 16, 2020

@Evil-Spirit its behaving like depth testing is turned off for occluded edges. And yes, depth write should probably be off for all edges.

@phkahler
Copy link
Member

The problem has to be that there are multiple areas in the code affecting this. I can go in Group::Draw(Canvas *canvas) and comment out the entire section enclosed by if(SS.GW.showEdges) { .... } and I'm still able to use the toggle buttons to produce most of the options including showing the occluded lines. The bug is because a lot of this section of code is redundant in some way - I just haven't figured out what's stepping on it.

@phkahler
Copy link
Member

phkahler commented Sep 17, 2020

OK, commenting out everyting but:

    GenerateDisplayItems();
    DrawMesh(DrawMeshAs::DEFAULT, canvas);

It's still drawing almost all edges (no silhouettes) and allowing 3 options for them with zero calls to DrawOutlines. This is also enabled/disabled via the "show all / hide all" links in the text window. I thought those were only supposed to toggle entities and the toolbar buttons determined which edges are visible and what style.

EDIT: no, It's just drawing the entities in 3 styles. It correctly draws the hidden ones when that option is enabled. So fixing this I should probably test with all entities turned off until the actual edges behave better.

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

No branches or pull requests

3 participants