Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. OpenGL|Clip planes|Geometry shader
Forum Updated to NodeBB v4.3 + New Features

OpenGL|Clip planes|Geometry shader

Scheduled Pinned Locked Moved Solved Game Development
1 Posts 1 Posters 961 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.
  • P Offline
    P Offline
    Ponikarovskii
    wrote on last edited by Ponikarovskii
    #1

    Hi everyone.
    What am I using: Qt 5.11.1, MinGW 5.3, Windows 10, C++11, last version of OpenGL and GlSL
    My task: I have non-solid (just surface) object, rendering by glDrawArrays, and i need to get cross-section of this object by plane. I have found ancient openGL function glClipPlane, but its not compability with VAOs and VBOs. Also Ive found out that its possible to rewrite glClipPlane via geometry shader.
    My questions/problems:

    1. Do you know other ways to realize this task?
    2. I really dont understand, how to add geometry shader in QtCreator, there is no "icon" of geometry shader, I tried to add vertex shader and rename it to .gsh or just .glsl, tried to use QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::Geometry, QString &source) and write shader code in program, but every time I get "QOpenGLShader: could not create shader" on string with adding geometry shader.0_1531924420076_pic.png
      Geometry shader simpliest code:
    layout (triangles) in;
    layout (triangle_strip, max_vertices = 3) out;
    
    void main()
    {
        int i;
    
        for (i = 0; i < gl_in.length(); i++)
        {
            gl_Position = gl_in[i].gl_Position;
            EmitVertex();
        }
        EndPrimitive();
    }
    

    Im newbier in Qt, so I really need your help. Thanks.

    SOLUTION
    There is few ways to solve this task. You don`t need geometry shader. Just read this post on stackoverflow

    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