Thanks.
I had already compiled the shaders, that wasn't the problem.
I did a little test and found out that it had used the same text in the vertex shader as the fragment shader. I'm not sure why. It looks like they are set to reading different text files. Once I put the vertex shader source in the source code itself, without using the reading function I made, it worked fine.
Appears that the fragment shader wasn't doing anything because of the trouble with the vertex shader.
After I fixed the vertex shader the triangle turned green like I wanted the fragment shader to do.
Basically, I just have to fix the file reading function. It is probably something obvious I am overlooking.
Thanks for all the help anyways.
The first pair of outputs both only show the fragment shader, and the second pair both only show the vertex shader.
It doesn't make any sense.
EDIT: I figured out it was the file reading function. I was using a weird way to convert strings to const char*.
I didn't know I could use the "c_str()" method. All better now.
Well,
I finally got a triangle colored, with diffuse lighting and in perspective.
Feels like such an accomplishment.
Thanks for all the help everybody.
EDIT: I know this is hardly much of an accomplishment, but it is certainly more than I could have done without you.
I'm having trouble with the attribute for my vertex position.
I'm not really sure how I'm suppose to use it in the vertex shader.
I'm doing a translation backwards, so it is moving, (the model view matrix). It was working fine with "gl_Vertex" but now I'm trying to replace "gl_Vertex" with my attribute for the vertex position. It isn't working. No errors with binding uniforms or attributes.
The screen comes up with the clearing color, black, as opposed to white which it often does when a binding error shows up.
varying vec3 normal;
varying vec3 lightVector;
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
attribute vec3 vertexPosition;
void main()
{
gl_Position = modelViewProjectionMatrix*vec4(vertexPosition,1.0f);
normal=gl_NormalMatrix* gl_Normal;
vec4 modelViewVertex=modelViewMatrix*vec4(vertexPosition,1.0f);
lightVector= vec3(gl_LightSource[0].position -modelViewVertex);
//I know I will probably need to replace "gl_LightSource[0]" later, but it was working fine with "gl_Vertex".
}
All right. I replaced the normal matrix and vertex normal.
Now it appears there are errors definitely inside the vertex shader, (errors are coming up with uniforms.)
At least that seems to help narrow it down.
The "transpose" and "inverse" functions are used in the main source code, and that matrix is normalized in the vertex shader and used.
Please tell me if you see anything notably wrong in here. Thanks the assistance;
Would need to see your client code (C/C++) that does the attribute binding. There are a whole slew of generic and non-generic semantic binding functions that aren't always compatible or implemented on specific hardware targets. This is really just an atrociously horrid implementation of high level GPU code on the Khronos's part and their bid to clean it up to compete with the comparatively sparkling clean MS HLSL. So I wouldn't blame you if this is causing frustration...