Results 1 to 9 of 9

Thread: loading fragment program

  1. #1
    Member Newbie
    Join Date
    Mar 2003
    Posts
    38

    loading fragment program

    For the moment, my fragment program is in a separate file, and I load it with a fread... But doing this, my program doesn't work if I don't have the FP file in the good directory, and I want to have only one executable file ! So how can I load my FP ?
    If I write it directly to a string, it isn't very nice to edit it...

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jun 2002
    Posts
    365

    Re: loading fragment program

    Originally posted by Acheum:
    my program doesn't work if I don't have the FP file in the good directory
    Well, keep the file in the good directory then...
    http://www.faqs.org/faqs/usenet/posting-rules/part1/

  3. #3
    Member Newbie
    Join Date
    Mar 2003
    Posts
    38

    Re: loading fragment program

    Originally posted by roffe:
    Well, keep the file in the good directory then...
    http://www.faqs.org/faqs/usenet/posting-rules/part1/
    No, I don't want to have multiple files for my program, I would like to have only one file : the executable !
    I don't wand text files in addition !

  4. #4
    Senior Member Regular Contributor
    Join Date
    Apr 2003
    Location
    Toulouse, France
    Posts
    133

    Re: loading fragment program

    if you are developping a windows application, you can use resources. I don't kwow how it work but I kwow it's possible to store in the exe some data like bitmap, icons, text, bugs (duh !!!), ...
    the MSDN should help you.

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: loading fragment program

    If you want your text file to be a resource of the executable, where's the benefit of putting your fragment program into a text file? Just use a constant.
    Deiussum
    Software Engineer and OpenGL enthusiast

  6. #6
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Posts
    211

    Re: loading fragment program

    @deiussum:
    >>just use a constant.
    i'm sure that he don't know how to write a char-pointer constant over more than one line, like this:
    Code :
     
    ---more cpp code here---
     
    char *simpleVShader = "!!ARBvp1.0"              
     
    "PARAM mvp[4]    = { state.matrix.mvp };"   
     
    "MOV   result.color, vertex.color;"
    "DP4   result.position.x, mvp[0], vertex.position;"
    "DP4   result.position.y, mvp[1], vertex.position;"
    "DP4   result.position.z, mvp[2], vertex.position;"
    "DP4   result.position.w, mvp[3], vertex.position;"
     
    "END";
     
    ---more cpp code here---


    [This message has been edited by DJSnow (edited 08-06-2003).]
    DJSnow

  7. #7
    Member Newbie
    Join Date
    Mar 2003
    Posts
    38

    Re: loading fragment program

    Thanks for your answers !

  8. #8
    Member Newbie
    Join Date
    Mar 2003
    Posts
    38

    Re: loading fragment program

    Originally posted by DJSnow:
    @deiussum:
    >>just use a constant.
    i'm sure that he don't know how to write a char-pointer constant over more than one line, like this:
    Code :
     
    ---more cpp code here---
     
    char *simpleVShader = "!!ARBvp1.0"              
     
    "PARAM mvp[4]    = { state.matrix.mvp };"   
     
    "MOV   result.color, vertex.color;"
    "DP4   result.position.x, mvp[0], vertex.position;"
    "DP4   result.position.y, mvp[1], vertex.position;"
    "DP4   result.position.z, mvp[2], vertex.position;"
    "DP4   result.position.w, mvp[3], vertex.position;"
     
    "END";
     
    ---more cpp code here---
    This doesn't work on the compilation...

  9. #9
    Senior Member Frequent Contributor
    Join Date
    May 2001
    Location
    France
    Posts
    765

    Re: loading fragment program

    Or try :

    Code :
    ---more cpp code here---
     
    char *simpleVShader =
    "!!ARBvp1.0\
    PARAM mvp[4]    = { state.matrix.mvp };\
    MOV   result.color, vertex.color;\
    DP4   result.position.x, mvp[0], vertex.position;\
    DP4   result.position.y, mvp[1], vertex.position;\
    DP4   result.position.z, mvp[2], vertex.position;\
    DP4   result.position.w, mvp[3], vertex.position;\
    END";
     
    ---more cpp code here---
    Note : if you want to insert comments, finish the commented line with '\n\' instead of '\', for instance :
    Code :
    "!!ARBvp1.0\
    # My comment\n\
    END"

Similar Threads

  1. Loading and Using Fragment Shader
    By Jorj Pimm in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 12-10-2008, 10:19 AM
  2. Multitexturing/Fragment program and fragment operations
    By davidino79 in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 10-07-2004, 02:22 PM
  3. ARB Fragment Program
    By maximian in forum OpenGL: Advanced Coding
    Replies: 12
    Last Post: 09-13-2004, 08:42 AM
  4. Modifying fragment's depth in a fragment program
    By A027298 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-06-2004, 03:35 PM
  5. Vertex and fragment shader loading
    By in forum OpenGL: Linux
    Replies: 1
    Last Post: 07-17-2002, 02:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean