Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Custom material doesn’t work
Forum Updated to NodeBB v4.3 + New Features

Custom material doesn’t work

Scheduled Pinned Locked Moved Unsolved Qt for Python
1 Posts 1 Posters 208 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CE87
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved