View Full Version : What is "gl_TexCoord.st" ?
02-13-2007, 02:35 PM
It sounds like a stupid question.
I saw this variable is used in an online tutorial and in the book "OpenGL Shading language," but I can not find what it means, no matter from google, the book, or even glsl specification. I know it's the texture coordinates which would be interpolated in fragment shader, but how about the "st" part? And what else variables are there in its structure.
I am new to glsl. Do I miss something?
02-13-2007, 03:04 PM
As you saif, gl_TexCoord is the variable of texture coordinate sets. The "st" part you wonder about, is part of swizzle mask. The swizzle mask let you recombine your vector. The texture coordinates are four-component vectors, but st mask selects the first two (you can use "xy", it would be the same). Look into GLSL specification, it is explained well there.
02-13-2007, 03:47 PM
Specifically, look at section 5.5, "Vector Components".
Another noob question.
Is it preferable to use gl_TexCoord or just make your own varying variable and pass a texture coordinate from the vertex shader to the fragment shader? :) Or is it the case, if you only have a vertex shader that gl_TexCoord will interact with the fixed pipeline?
02-14-2007, 02:34 AM
It doesn't matter, gl_texcoord is just an array of predefined varying variables, but it is nice to have, and FYI there is no fixed pipeline anymore.
02-14-2007, 02:38 AM
But there is still fixed-function pipeline from the APi point of view... I would like to see it removed as soon as possible, all that Light, material, Vertex* calls etc. I hope the new releases will bring this changes...
02-14-2007, 05:30 AM
Like OpenGL "Longs Peak" "Lean and Mean" profile you mean.
02-14-2007, 08:24 AM
Thanks guys, it is in section 5.5 of GLSL spec. I couldn't find it because I always search for the keyword "gl_TexCoord."
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.