Input Variables Question

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?

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.

I’ll use glVertexAttribPointer. Thank you very much

Another thing.

The function ftransform() is now deprecated too?

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 :wink:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.