View Full Version : gl_Position in OpenGL 3.0+
08-26-2010, 03:46 AM
Why do we still have to use gl_Position in vertex shaders instead of a user-defined output variable? In a fragment shader, gl_FragColor can be (has to be?) replaced by a custom variable as well..
08-26-2010, 05:14 AM
maybe it's because there can be several outputs from a vertex shader to a geometry/fragment one and the underlying source needs to know which one is the vertex position?
08-26-2010, 07:13 AM
gl_Position is not just one of the gl variables with perspective interpolation. It is a special variable that points GL rasterizer to the area it needs to process.
I see only one case which doesn't require gl_Position - the transform feedback with GL_RASTERIZER_DISCARD.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.