PDA

View Full Version : Input Variables Question



McLeary
03-05-2011, 08:28 PM
why should one make something like this in a vertex shader?



layout (location = 0) in vec4 position;
layout (location = 1) in vec4 color;

smooth out vec4 theColor;

void main()
{
gl_Position = position;
theColor = color;
}


Does gl_vertex and gl_color are now deprecated?

I'm confusing about the new GLSL spec.

if, for example, gl_color is now deprecated, how can I read vertex colors inside a vertex shader using glColorPointer function?

Should I always use glVertexPointer to set per-vertex attributes?

Alfonse Reinheart
03-05-2011, 08:40 PM
if, for example, gl_color is now deprecated, how can I read vertex colors inside a vertex shader using glColorPointer function?

You don't. You use glVertexAttribPointer.

Or you just create a compatibility context and keep doing things the way you've been doing them.

McLeary
03-05-2011, 08:52 PM
I'll use glVertexAttribPointer. Thank you very much

McLeary
03-05-2011, 09:21 PM
Another thing.

The function ftransform() is now deprecated too?

Alfonse Reinheart
03-05-2011, 11:49 PM
The function ftransform() is now deprecated too?

Yes, but so are the effective inputs to it (gl_Vertex and the MODELVIEW and PROJECTION) matrices, so it's not like it would be particularly useful ;)