Results 1 to 6 of 6

Thread: Geometry Shaders in ClanLib 2.2

  1. #1
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default Geometry Shaders in ClanLib 2.2

    I am trying to introduce geometry shaders in ClanLib 2.2 SVN

    I have added the extra clFunction’s to opengl.h , for example:

    Code:
    functions->ProgramParameteri = (CL_GLFunctions::ptr_glProgramParameteri) CL_OpenGL::get_proc_address("glProgramParameteriEXT");
    And I have added cl_shadertype_geometry to CL_ShaderObject

    I created "Examples/GeometryShader" to test it.

    See "Sources/shader_color_geometry.cpp". This does all the geometry shader work.

    If the line: "program_object.attach(geometry_shader);" is commented out, then the teapot is shown in solid white.

    If that line is included, then nothing is shown. I expected the teapot to be shown (the geometry shader just emits a single triangle in the same position).

    I would be very grateful if someone is up to the challenge in finding out what is wrong. It should be something very simple!

    Note: I had to update my NVidia driver to enable the geometry extension (although it’s core in OpenGL 3.2)

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    i tried this on my ati, and the teapot was white with the shader enabled...

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Heh, thanks

    So it was either my NVidia driver or my graphics card that's at fault

    Which is good I'll try again on the next driver update

  4. #4
    Master Sorcerer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    I tried your geometry shader on my nv-275 card and it doesn't display any teapot on my computer.

    I looked quickly at the extension you are using, and it uses these output variables as well: gl_PointSize, gl_ClipVertex, gl_Layer and gl_PrimitiveID.

    The extension mentions that if you do not set these variables to specific values, the results are undefined. In particular I could imagine the gl_ClipVertex variable could have an impact on whether the GPU clips your new triangles or not. Supposedly its the position of the vertex in eye coordinates.

    I tried adding the following code to your example "gl_PointSize = 1.0; gl_ClipVertex = vec4(0.5,0.5,0.5,1.0); gl_Layer = 0; gl_PrimitiveID = 0;", but it did not cause it to display any teapot.

    I noticed that the shader compiler mentioned a 150 version of GLSL, but the shader extension you are using is seemingly only supported by version 120. If I change it to use version 150 it complains about gl_ClipVertex being deprecated, so I'm not really sure you are using the extension that OpenGL 3.2 officially supports?

    Another thing worth mentioning is that ClanLib attempts to create an OpenGL 3.0 context and not 3.2 (see "helper.create_opengl3_context(share_context, 3, 0);" in opengl_window_provider_wgl.cpp). I don't know if that could have any impact on whether the extensions you are using work properly or not.

  5. #5
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    I didn't read the spec in detail, so yes it is possible that ClanLib sets incorrectly or does not set something the extension requires.

    I should try coding a geometry shader without clanlib to see if that works first

    I used the following links as reference:

    http://www.opengl.org/wiki/Geometry_Shaders

    http://www.opengl.org/registry/specs...ry_shader4.txt

    There are various examples online, but haven't tried compiling these (I just looked at the code)

    For example:
    http://cirl.missouri.edu/gpu/glsl_le...der/index.html

  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Fixed, I made a silly mistake but incorrectly entering the opengl geometry shader defines.

Bookmarks

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
  •