PDA

View Full Version : GLSL and nvidia 91.31 driver



brtnrdr
07-05-2006, 08:59 AM
Hi,

I just updated my driver from 84.21 to 91.31 and when my application tries to compile a vertex shader (code below) I receive the errors:
<7> C0000 syntax error: unexpected $undefined at token "<undefined>"
<7> C0501 error: ....

the vertex shader is simply:


void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}line 7 is the last line with the curly brace on it, this code works fine with driver 84.21. Did the compiler change between these two drivers or something. Any help would be appreciated. Until then though I can just use the older driver.

ZbuffeR
07-05-2006, 09:04 AM
Just a wild guess, try to add or remove spaces/CR/LF chars at the end.

Overmind
07-05-2006, 12:53 PM
How do you read the file? Make sure you have no empty string at the end of the file.

I once had the same problem. My loading code uses fgets, and this reads until the next \n or EOF. This means with a properly formatted text file, it reads the last line, and on the next call it immediately reads the EOF. I didn't catch this at first, and this resulted in exactly this error message.

Swiftless
07-05-2006, 08:59 PM
I have not had this problem with my graphics card since I updated the drivers. I am using a Geforce 6800gts.

What graphics card do you have?

sqrt[-1]
07-06-2006, 02:47 AM
I agree with the above people, it is probably your loading code.

Can you post the code you use to read in the file and send it to OpenGL?

brtnrdr
07-06-2006, 09:43 AM
Hi,

thanks for the help. here is the code that i use to load the shaders.


char *read_text_file(const char* file)
{
if(!file) return NULL;

FILE *f = fopen(file ,"r");
if(!f) return NULL;

fseek(f, 0, SEEK_END);
int sz = ftell(f);
fseek(f, 0, SEEK_SET);

char *retv = (char*)malloc(sz+1);
fread(retv, sz, 1, f);
retv[sz] = 0;
fclose(f);

return retv;
}

i'm going to try doing this differently and seeing what happens.

knackered
07-06-2006, 02:04 PM
retv[sz>0 ? sz-1:sz] = 0;

brtnrdr
07-07-2006, 10:15 AM
Hi,

I tried a completely different method for loading the text and now the program works with the new drivers.

I also tried your fix and that did not work unfortunately.

Thank you for the help.