Okay, I’ve just started learning GLSL now but still I did not find very good resources to learn it. I was reading an article about GLSL on NeHe productions site and in have done this copy-pasta job from there:
There are four main types: float, int, bool and sampler. For the first three types, vector types are available:
vec2, vec3, vec4 2D, 3D and 4D floating point vector
ivec2, ivec3, ivec4 2D, 3D and 4D integer vector
bvec2, bvec3, bvec4 2D, 3D and 4D boolean vectors
For floats here are also matrix types:
mat2, mat3, mat4 2x2, 3x3, 4x4 floating point matrix
Samplers are types representing textures. They are used for texture sampling. Sampler types have to be uniform. They are not allowed to be declared as a non-uniform type. Here are the different sampler types:
sampler1D, sampler2D, sampler3D 1D, 2D and 3D texture
samplerCube Cube Map texture
sampler1Dshadow, sampler2Dshadow 1D and 2D depth-component texture
Now to be honest I did not understand anything except a few lines of explianation.
I’ve learnt about float, int, Boolean data type in my little study of C++ as well as in Action script but what is Sampler?
What is vector and what are these 2d, 3d and 4d floating vector points are they something like multidimensional arrays. Integer and Boolean vectors???
1D, 2d and 3d texture ? aren’t textures only 2d?
Is cube map texture something like the way in which cube gets unwrapped in UV editor?
What are matrixes? Are they matrix of math if yes then still me what they are because matrix is in 11th class syllabus and I’m still in 10th. So the conclusion is Matrix was a good movie.
1d and and 2d shadow? I’ve never seen a width less shadow.
what else I can do with GLSL except bump mapping.
I still have 100s of question to ask but I’m tired now. Good Night.
There are 6 official versions of GLSL, which gradually add and remove grammar and features/objects.
samplers are handles to texture-units. There are 16-32 slots, which you specify by glActiveTexture(GL_TEXTURE0+UnitID) and glBindTexture(GL_TEXTURE_2D,texHandle).
Textures are 1D,2D and 3D. 1D is simply a texture type with height=1. 3D is a volume WidthHeightDepth.
A cubemap is a special sampler, that contains 6 2D textures. Fetching a texel from it is done via a 3D normal-vector, instead of a 2D vector. The gpu contains silicon that calculates which of the 6 textures you want to fetch from, and at what 2D coordinates. It’s a very optimized way to do environment-reflections.
Matrices are extremely useful maths-objects: they can concatenate a complex series of transformations. Instead of repeating all transformations individually for every vertex, you concatenate the transforms and multiply all vertices with that matrix.
2D shadow-textures simply contain depth-info. That depth-info is compared with another calculated value, to determine if there’s a shadow or not. The hardware supports 1D textures, so the object is made available even if only a few developers may need it.
almost everything. It’s software, with some limitations in comparison to general-purpose cpus. The major limitation is that you can’t output result-data at random locations, and you can’t have read+write arrays. But you can compute skeletal-animation, make your own code to compute shading, calculate physics, process+draw strings, do AI, … . Some types of algorithms don’t run well on a gpu, others run extremely well.
I cant buy a book as i dont have credit card as well as 1$ is around 45 Rs so it really proves to be too costly for me. even 20$ would be around 900 Rs.
no no not that. i already have that thing with me. i wanted something that should cover the whole language from beginning and in detail so that i dont feel everything becoming an OVER HEAD TRANSMISSION…
Freak 120% : in french we have a saying that applies to you
Here is the fully extended version :
“You can’t have the butter, and the money for the butter, and a smile from the milkmaid, and a reputation of being an honnest man”.
Anyway, reading the lighthouse 3D tutorials had helped me a lot, before I bought the orange book : http://www.lighthouse3d.com/opengl/glsl/
The link was already posted above, so I repost just in case you missed it.
Try these tutorials. Now they are a vit outdated, because they relies on first GLS version, but they are usable and you can understand the whole thing using them.