Custom material doesn’t work
Unsolved
Qt for Python
-
Hello! :)
I'm trying to create a custom material (QMaterial) that has a fragment shader code. Like so (code not complete):
class MyMaterial(Qt3DRender.QMaterial): def __init__(self, parent = None): program = Qt3DRender.QShaderProgram(self) program.setVertexShaderCode(Qt3DRender.QShaderProgram.loadSource(QUrl("qrc:/shader.vert"))) program.setFragmentShaderCode(Qt3DRender.QShaderProgram.loadSource(QUrl("qrc:/shader.frag"))) ... self.setEffect(effect)
But if I add this component to an entity nothing is rendered:
myMaterial = MyMaterial() sphereEntity.addComponent(sphereMesh) sphereEntity.addComponent(sphereTransform) sphereEntity.addComponent(myMaterial)
It should work.
I’m afraid there are no bindings for this yet. Does anyone have a working example or work around?