Results 1 to 4 of 4

Thread: Geometry shader with QT4.7

  1. #1
    Join Date
    Dec 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Geometry shader with QT4.7

    QT4.7 on linux, video - nvidia 8600GT with latest driver and OpenGL 3.3 support.
    Problem:
    gl_DrawArray executes perfectly when I use vertex and fragment shader, but if I add a simple pass-thru(as I think) geometry shader - nothing is drawn on the screen. Geom shader source :
    "#version 150\n"
    "layout(points) in;\n"
    "layout(points) out;\n"
    "void main(void)\n"
    "{\n"
    "}\n"

    shaders compiles without errors, shader program also links and run without errors.
    In glsldevil debugger I'm getting INVALID_OPERATION detected after gl_DrawArray command when geom sh is enabled.

    Thank U,

    S

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Geometry shader with QT4.7

    If I remember correctly, you have to emit some vertices from the geometry shaders,
    so a pass-through geometry shader would be rather something like:

    Qt Code:
    1. void main(){
    2. for(int i = 0; i < gl_VerticesIn; ++i){
    3. gl_Position = gl_PositionIn[i];
    4. EmitVertex();
    5. }
    6. }
    To copy to clipboard, switch view to plain text mode 

    Probably you'll have to set gl_FrontColor somehow as well, but I've coded shaders some time ago and cant remember all the details.

    And about that:
    "layout(points) in;\n"
    "layout(points) out;\n"
    Are you sure this syntax is correct ? What does it mean ?

    Try to use my shader and see what happens (or just google for geometry shader tutorial, maybe look here also : http://nehe.gamedev.net/).
    Last edited by stampede; 14th December 2010 at 07:21.

  3. #3
    Join Date
    Dec 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Geometry shader with QT4.7

    Quote Originally Posted by stampede View Post
    Qt Code:
    1. "layout(points) in;\n"
    2. "layout(points) out;\n"
    To copy to clipboard, switch view to plain text mode 
    Are you sure this syntax is correct ? What does it mean ?
    stampede, thank you for reply.
    That's layout qualifier as per glsl ver 3.3.
    Your suggestion didn't help.
    I begin to suspect hw or sw bug: as per QFlags report: QFlags(0x1|0x2|0x4|0x8|0x10|0x20|0x40|0x1000|0x200 0|0x4000|0x8000)
    I do have OpenGL 3.3 support(=0x8000), but after applying the very base format/context, query to majorVersion() minorVersion() (functions introduced in QT4.7) returns supported OpenGL version 1.0. So, continue googling.
    Regards,

    S

  4. #4
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Geometry shader with QT4.7

    Hi!

    Answer is very simple!

    Geometry shader MUST emit vertexes that need to be passed to fragment shaders. If geom sh wont emit any vertexes, there will be nothing to pass to fragment shaders.

    So basically your geometry shader is discarding all vertexes. OpenGL do not get any of them to assemble primitives and to divide them into fragments. So fragment shaders have no work to do. And now pixels on screen get updated. Use geometry shader that pass through all vertexes it get!

    And pleas post your vertex and fragment shaders as well.

Similar Threads

  1. Geometry relative to desktop
    By thrall in forum Qt Programming
    Replies: 8
    Last Post: 26th October 2010, 02:43
  2. Can't change QHBoxLayout geometry
    By gutiory in forum Newbie
    Replies: 6
    Last Post: 17th June 2010, 08:37
  3. QGroupBox elements geometry
    By qt_gotcha in forum Newbie
    Replies: 1
    Last Post: 29th May 2010, 07:16
  4. Node Shader Editor
    By AMDx64BT in forum Newbie
    Replies: 1
    Last Post: 6th December 2009, 22:30
  5. QGraphicsLayout::geometry()
    By isutruk in forum Qt Programming
    Replies: 1
    Last Post: 19th October 2009, 15:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.