PDA

View Full Version : loading fragment program



Acheum
08-05-2003, 11:24 PM
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...

roffe
08-05-2003, 11:56 PM
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/

Acheum
08-06-2003, 12:37 AM
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 !

errno
08-06-2003, 02:50 AM
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.

Deiussum
08-06-2003, 04:56 AM
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.

DJSnow
08-06-2003, 03:53 PM
@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:




---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).]

Acheum
08-06-2003, 11:08 PM
Thanks for your answers !

Acheum
08-08-2003, 12:59 AM
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:




---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...

vincoof
08-08-2003, 08:43 AM
Or try :




---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 :



"!!ARBvp1.0\
# My comment\n\
END"