Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Vertex / pixel shader development: frustrating

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2002
    Location
    Eindhoven
    Posts
    19

    Vertex / pixel shader development: frustrating

    Hello there people,

    I'm currently trying - accompanied by a LOT of frustration - to get a pixel shader (fragment program) and / or vertex shader (vertex program) to run with OpenGL. I have bought nVidia's "The Cg Tutorial" book with all kinds of examples that should work, but not a single person seems interested in telling you how you can actually COMPILE such a program by means of a practical example; I have tried compiling a simple, example pixel shader from the book using nVidia's CGC command line compiler (CGC FragmentProgram.Txt). Nothing. The thing doesn't seem to have a command line help switch and / or documentation, so I'm stuck.

    I have also tried nVidia's development IDE (FX Composer or whatever it is called) but it is WAY to cluttered with options to get up and running as far as the compilation of a simple pixel shader is concerned. I simply want to COMPILE a SINGLE PIXEL SHADER (a plain text file, nothing more) into an arbfp1 profile (or higher) compatible pixel shader program and I want to load this shader from within my application, is this really too much to ask (loading a precompiled (example) shader and using it in my application is no problem) ? I'm not interested in complete CgFX-projects with a plethora of vertex / pixel shaders and all kinds of additional assets that nVidia's development environment wants to put me through.

    I have also downloaded ATI's RenderMonkey IDE (I'm currently using a Radeon 9800) but the current version isn't able to compile shaders to an OpenGL profile: only DirectX profiles are supported, OpenGL support is planned ("...Support for DX8, DX9 (today) and OpenGL shader models (future)..."; way to go, ATI).

    After that, I tried some third party tools like ShaderWorks: cluttered IDE, complete projects, no simple, single pixel / vertex shader compilation possible ( WHY?).

    I'm starting to think about giving up. As a Computer Science student majoring in computer graphics I have enjoyed programming in OpenGL for quite some years now, but annoying and frustrating things like this just take the fun out of graphics programming. If someone out there can tell me what I am supposed to do to get a simple pixel shader (programmed in Cg / HLSL / GLSL; I am told the languages are compatible (although it seems that Cg-types like "float4" are not recognized by (at least) HLSL)) like the one below compiled using the arbfp1 profile, please let me know. Any Help would be greatly appreciated. Thanks in advance.

    The program:

    struct C2E2f_Output {
    float4 color : COLOR;
    };

    C2E2f_Output C2E2f_Passthrough(float4 color : COLOR)
    {
    C2E2f_Output OUT;
    OUT.color = color;
    return OUT;
    }

    GRTZ,

    (Sn)Ik.

    P.S.

    Im currently trying - as a last desperate attempt - to get my Visual Studio .Net environment to source highlight Cg / HLSL / GLSL shaders and / or compile them to an OpenGL / DirectX profile...

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jan 2001
    Location
    NVIDIA, Austin, TX
    Posts
    555

    Re: Vertex / pixel shader development: frustrating

    cgc -profile arbfp1 input.cg -o output.txt

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2002
    Location
    Eindhoven
    Posts
    19

    Re: Vertex / pixel shader development: frustrating

    Thanks a lot, I'll try it right away.

    GRTZ,

    (Sn)Ik.

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2002
    Location
    Eindhoven
    Posts
    19

    Re: Vertex / pixel shader development: frustrating

    Too bad, it doesn't seem to work :

    "(0) : error C3001: no program defined
    10 lines, 1 errors."

    The content of my input.cg file is exactly as follows:

    struct C2E2f_Output {
    float4 color : COLOR;
    };

    C2E2f_Output C2E2f_Passthrough(float4 color : COLOR)
    {
    C2E2f_Output OUT;
    OUT.color = color;
    return OUT;
    }

    No idea what I'm doing wrong...

    GRTZ,

    (Sn)Ik.

  5. #5
    Intern Contributor
    Join Date
    Sep 2001
    Location
    Lewisville, TX
    Posts
    93

    Re: Vertex / pixel shader development: frustrating

    I dont really work with cg but it was my understanding that every program requires a main function.

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Jan 2001
    Location
    NVIDIA, Austin, TX
    Posts
    555

    Re: Vertex / pixel shader development: frustrating

    You'll need to add "-entry C2E2f_Passthrough" to tell the compiler the name of your entry function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •