Welcome, Guest.
Username: Password: Remember me

TOPIC: s, t, p and q are valid swizzle indices?

s, t, p and q are valid swizzle indices? 1 week 6 days ago #1

I made a typo and wrote 'variable.t' instead of 'variable.z' (on a qwertz keyboard that is... i'm not that bad of a writer ;) ) and was baffled that this isn't an error as I'm only aware of the '.rgba' and '.xyzw' indices. That made me curious and it seems like '.stp' is the same as '.rgb' and it is also possible to use '.q'. Is there some meaning to this or is it just some leftover from writing the new compiler?
The administrator has disabled public write access.

s, t, p and q are valid swizzle indices? 1 week 6 days ago #2

OpenGL uses these, having them available here makes porting code from OGL easier.
The administrator has disabled public write access.
The following user(s) said Thank You: Daodan

s, t, p and q are valid swizzle indices? 1 week 6 days ago #3

Correct. There are three types of swizzle sets which can be used in different scenarios to make it cleaner what your swizzle accomplishes:
xyzw = geometry vectors
rgba = colors
stpq = texture coordinates

They are just syntactic sugar of course, so you don't have to use them for rhese purposes (it is common that xyzw is used for almost everything).
Cheers, crosire =)
The administrator has disabled public write access.
The following user(s) said Thank You: Daodan