I am working on a personal project using pyqt5 with a bunch of custom widgets. One of the items i am working on is a QWidget class call PyGLView which has a layout and inside that layout i instantiate a GLViewWidget(). I then send my MeshData into a GLMeshItem. This works real well per the screen shot below.
The issue is that I also want to add faces in all black so that you cannot see through the item (makes the item easier to perceive to the eye) but when i add in the faces the item now has an issue with clipping. Or so i assume that is the issue.
If you look closely you can see that the edges now look broken up and are no longer solid lines. The end product Mesh is pretty large and detailed and if i dont add the faces or somehow block out the backside edges it causes the entire model to just be 1 solid color.
---PyGlView class---
from PyQt5.QtMultimediaWidgets import *
from PyQt5.QtMultimedia import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from pyqtgraph.opengl import *
import numpy as np
from stl import mesh
from enum import Enum
class PyGlView(QWidget):
def __init__(self, *args, **kwargs):
QWidget.__init__(self, *args, **kwargs)
self.layout = QHBoxLayout(self)
self.layout.setContentsMargins(0,0,0,0)
self.layout.setSpacing(0)
self.viewport = GLViewWidget()
self.layout.addWidget(self.viewport)
def addMesh(self, file_location):
stl_mesh = mesh.Mesh.from_file(file_location)
points = stl_mesh.points.reshape(-1, 3)
faces = np.arange(points.shape[0]).reshape(-1, 3)
mesh_data = MeshData(vertexes=points, faces=faces)
meshItem = GLMeshItem(meshdata=mesh_data, smooth=False, drawFaces=True, drawEdges=True, computeNormals = True, edgeColor=(0, 189, 190, 1), color=(0,0,0,1),) # shader='viewNormalColor'
meshItem.setGLOptions('opaque')
self.viewport.addItem(meshItem)
self.viewport.setCameraPosition(QVector3D(-5.015859651283621e-16, 3.5121427064511513e-16, 10.0), distance=150)
self.viewport.orbit(0,90)
def getViewport(self):
return self.viewport.getViewport()
You should be able to just instantiate the class and use it as a normal QWidget from pyqt5 and use the addMesh function with a relative path to the .STL file.
If i cannot use faces to block the background out, is there another way to prevent backround edges to show through the models front side triangles?

