PDA

View Full Version : Probs loading fp



Ozzy
11-30-2003, 03:00 AM
my first attempt with fp. ;)
after glProgramStringARB(...) , glGetString(..) always returns "unexpected token".
as it is a quite basic fp, i can't see where's the problem..
any idea?

code:
//ARB_fragment_program
//.....................................
static char testFpPrg[]={"!!ARBfp1.0\
TEMP temp;\
ATTRIB tex0 = fragment.texcoord[0];\
ATTRIB col0 = fragment.color;\
OUTPUT out = result.color;\
TEX temp, tex0, texture[0], 2D;\
MUL out, col0, temp; "};

VR_VOID initFragmentPrograms()
{
GLenum error;
const unsigned char *myError;

if(glfwExtensionSupported("GL_ARB_fragment_program")){
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glGenProgramsARB(1,&fragmentName);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB,fragmentN ame);

glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB,GL_PROG RAM_FORMAT_ASCII_ARB,strlen(testFpPrg)-1,testFpPrg);
error = glGetError();
myError = glGetString(GL_PROGRAM_ERROR_STRING_ARB);
if (error == GL_INVALID_OPERATION){
myError = glGetString(GL_PROGRAM_ERROR_STRING_ARB);
}
}
}

when i need to use the fp ->
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB,fragmentN ame);


for the moment it does nothing. not loaded?

Zengar
11-30-2003, 03:49 AM
You forgot END
But I can't see any other mistakes...
Try also moving TEMP after OUTPUT

[This message has been edited by Zengar (edited 11-30-2003).]

Ozzy
11-30-2003, 05:24 AM
Thx Zengar that was it! :)
Btw, did u know about a collection of FP prgs somewhere? lot's of Cg but difficult to find pure ARBfp around..

Ostsol
11-30-2003, 06:35 AM
Many of Humus' OpenGL demos used ARB_fp. . .
http://esprit.campus.luth.se/~humus/

Ozzy
11-30-2003, 06:41 AM
Yep, he's got a very good site indeed. :)
Anyone has already got the good idea to code fixed functions into ARBfp? ;))