OpenGL Shader Basics

Started by
14 comments, last by MARS_999 17 years ago
I'm not proficient with C++, but I think the line file.open(fileName, std::ios::binary); is the problem. Try opening the file in ascii mode.
Advertisement
nope makes no difference, and I dont think it should anyway.

Is the fileLength assignment correct, thats what could be giving the crap because its looking further than what the file could give

yeah in a basic vertex shader the char count is 48, but the value returned to fileLength is 53...hmmm
-Alex
Another idea, I just noticed that you are not specifying the string length when calling glShaderSourceARB(). Are you sure that's okay? Your string is not null-terminated after all, is it?
lightbringer you were so right.

It was that it didnt know the length and the file wasnt null terminated.

Replacing the NULL in glShaderSourceARB() with the value (pointer to) worked!!!


Thankyou so very much lightbringer!

Cheers
Alex
No problem, glad we found it :)
Quote:Original post by appleGuy
After looking at what was returned its got crap at the end of it:

‡readFile returned 0x00565b78
"void main(void)
{
gl_FragColor = vec4( 0.4, 0.0, 0.9, 1.0 );
}
ýýýý««««««««îþîþîþ"


what the heck is going on?

cheers
Alex



:) Listen grasshopper!

This topic is closed to new replies.

Advertisement