Skip to main content
replaced http://gamedev.stackexchange.com/ with https://gamedev.stackexchange.com/
Source Link

ochi12 you asked this question

http://gamedev.stackexchange.com/questions/97624/opengl-my-triangle-is-always-the-same-colorhttps://gamedev.stackexchange.com/questions/97624/opengl-my-triangle-is-always-the-same-color

they closed your thread, but I understand the question. You asked why the color does not change, you need to send the vertex and color to the vertex shader then from there to the fragment shader, you try to send the vertex to one shader and the color to the other, the color must also go through the vertex shader.

in vec4 Color; in the frag shader is not enough.

add

in vec4 Color; to the vertex shader out vec4 frag_Color;

and then use in vec4 frag_Color; in the frag shader.

Or that worked for me.

Or that worked for me to get shader working for first time, I didn't see a way to PM you, so posting this in this other thread of yours.

ochi12 you asked this question

http://gamedev.stackexchange.com/questions/97624/opengl-my-triangle-is-always-the-same-color

they closed your thread, but I understand the question. You asked why the color does not change, you need to send the vertex and color to the vertex shader then from there to the fragment shader, you try to send the vertex to one shader and the color to the other, the color must also go through the vertex shader.

in vec4 Color; in the frag shader is not enough.

add

in vec4 Color; to the vertex shader out vec4 frag_Color;

and then use in vec4 frag_Color; in the frag shader.

Or that worked for me.

Or that worked for me to get shader working for first time, I didn't see a way to PM you, so posting this in this other thread of yours.

ochi12 you asked this question

https://gamedev.stackexchange.com/questions/97624/opengl-my-triangle-is-always-the-same-color

they closed your thread, but I understand the question. You asked why the color does not change, you need to send the vertex and color to the vertex shader then from there to the fragment shader, you try to send the vertex to one shader and the color to the other, the color must also go through the vertex shader.

in vec4 Color; in the frag shader is not enough.

add

in vec4 Color; to the vertex shader out vec4 frag_Color;

and then use in vec4 frag_Color; in the frag shader.

Or that worked for me.

Or that worked for me to get shader working for first time, I didn't see a way to PM you, so posting this in this other thread of yours.

deleted 121 characters in body
Source Link

ochi12 you asked this question

http://gamedev.stackexchange.com/questions/97624/opengl-my-triangle-is-always-the-same-color

they closed your thread, but I understand the question. You asked why the color does not change, you need to send the vertex and color to the vertex shader then from there to the fragment shader, you try to send the vertex to one shader and the color to the other, the color must also go through the vertex shader.

in vec4 Color; in the frag shader is not enough.

add

in vec4 Color; to the vertex shader out vec4 frag_Color;

and then use in vec4 frag_Color; in the frag shader.

Or that worked for me.

Or that worked for me to get shader working for first time, I didn't see a way to PM you, so posting this in this other thread of yours, hopefully you will read it before someone feels it is not the best way to communicate. And hope it is correct and helps.

ochi12 you asked this question

http://gamedev.stackexchange.com/questions/97624/opengl-my-triangle-is-always-the-same-color

they closed your thread, but I understand the question. You asked why the color does not change, you need to send the vertex and color to the vertex shader then from there to the fragment shader, you try to send the vertex to one shader and the color to the other, the color must also go through the vertex shader.

in vec4 Color; in the frag shader is not enough.

add

in vec4 Color; to the vertex shader out vec4 frag_Color;

and then use in vec4 frag_Color; in the frag shader.

Or that worked for me.

Or that worked for me to get shader working for first time, I didn't see a way to PM you, so posting this in this other thread of yours, hopefully you will read it before someone feels it is not the best way to communicate. And hope it is correct and helps.

ochi12 you asked this question

http://gamedev.stackexchange.com/questions/97624/opengl-my-triangle-is-always-the-same-color

they closed your thread, but I understand the question. You asked why the color does not change, you need to send the vertex and color to the vertex shader then from there to the fragment shader, you try to send the vertex to one shader and the color to the other, the color must also go through the vertex shader.

in vec4 Color; in the frag shader is not enough.

add

in vec4 Color; to the vertex shader out vec4 frag_Color;

and then use in vec4 frag_Color; in the frag shader.

Or that worked for me.

Or that worked for me to get shader working for first time, I didn't see a way to PM you, so posting this in this other thread of yours.

Source Link

ochi12 you asked this question

http://gamedev.stackexchange.com/questions/97624/opengl-my-triangle-is-always-the-same-color

they closed your thread, but I understand the question. You asked why the color does not change, you need to send the vertex and color to the vertex shader then from there to the fragment shader, you try to send the vertex to one shader and the color to the other, the color must also go through the vertex shader.

in vec4 Color; in the frag shader is not enough.

add

in vec4 Color; to the vertex shader out vec4 frag_Color;

and then use in vec4 frag_Color; in the frag shader.

Or that worked for me.

Or that worked for me to get shader working for first time, I didn't see a way to PM you, so posting this in this other thread of yours, hopefully you will read it before someone feels it is not the best way to communicate. And hope it is correct and helps.