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

OpenGL 2 renderer #102

Closed
4 tasks done
whitequark opened this issue Nov 16, 2016 · 17 comments
Closed
4 tasks done

OpenGL 2 renderer #102

whitequark opened this issue Nov 16, 2016 · 17 comments
Milestone

Comments

@whitequark
Copy link
Contributor

whitequark commented Nov 16, 2016

This is the tracking issue for the OpenGL 2 renderer, being prepared in the opengl2 branch.

There are currently the following problems with the renderer:

  • face selection is broken
  • display of triangle mesh of solid model is broken
  • normals are inverted (?) on Linux/Intel/Mesa graphics stack
  • back faces aren't drawn, even when enabled

The Windows builds will use ANGLE; you can check whether they perform well on your configuration by downloading a build from https://ci.appveyor.com/project/whitequark/solvespace/build/3.0.196/artifacts.

@whitequark whitequark added this to the 3.0 milestone Nov 16, 2016
@Evil-Spirit
Copy link
Collaborator

@whitequark
Copy link
Contributor Author

@Evil-Spirit I figured out why I had to do glFrontFace. This is because when we do UpdateProjection(/*flip=*/true), our projection matrix inverts the handedness of the coordinate system. And this worked in OpenGL 1 because it does culling with modelview matrix, and in our case it does culling with modelview*projection matrix.

@whitequark
Copy link
Contributor Author

@Evil-Spirit I've updated the opengl2 branch. There's one last bug, back faces aren't actually drawn for some reason...

@Evil-Spirit
Copy link
Collaborator

@whitequark,
Great. I will look into back faces.

@whitequark
Copy link
Contributor Author

@Evil-Spirit I've already fixed that actually

@Evil-Spirit
Copy link
Collaborator

@whitequark, I mean "back faces aren't drawn, even when enabled"

@whitequark
Copy link
Contributor Author

@Evil-Spirit Ah yeah, please look into it

@whitequark
Copy link
Contributor Author

@Evil-Spirit Another problem: on OS X with 3.2 core profile enabled, GL returns 0x502 at the following line in MeshRenderer::Draw:

glEnableVertexAttribArray(ATTRIB_POS);

(and I think all other glEnableVertexAttribArray calls). Do you forget to create the names or something?

@whitequark
Copy link
Contributor Author

@Evil-Spirit OK I figured it out, GL 3.2+ Core Profile requires VAOs to be used (https://stackoverflow.com/questions/24643027/opengl-invalid-operation-following-glenablevertexattribarray, https://stackoverflow.com/questions/5970087/understanding-vertex-array-objects-glgenvertexarrays). On the other hand, OS X in Compatibility Profile allows only #version 120 shaders to be used.

Wow, what a trash fire...

@Evil-Spirit
Copy link
Collaborator

@whitequark,
We are targeting GLES 2.0 - compatible or I miss something?

@whitequark
Copy link
Contributor Author

@Evil-Spirit We are, but OS X cannot render GLES 2.0, so workarounds are needed. But I have thought up how to do it in only a mildly horrible way.

@Evil-Spirit
Copy link
Collaborator

What about Angle for OsX?

@whitequark
Copy link
Contributor Author

It's possible but I would like to avoid doing all this more complicated than it already is...

@whitequark
Copy link
Contributor Author

@Evil-Spirit
Copy link
Collaborator

Evil-Spirit commented Nov 18, 2016

@whitequark,
I think this is not so bad solution.

@whitequark
Copy link
Contributor Author

@Evil-Spirit I fixed the back face problem. It was because SSurface::TriangulateInto first filled the mesh with triangles with empty color, and then filled the color in separately.

@whitequark
Copy link
Contributor Author

this is finally MERGED

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

2 participants