as u may have noticed, i am strugglig to learn ARB programming, but with little effort, right now:
I am stuck with the very base things for now. I wrote a lil application that should draw an untextured, unlit quad in the mid of the screen. Just some stupid color gradient. Instead of it, just black.
I am starting to feel like the problem is that i am not sure of what i am writing. So i’d like someone answer some little questions:
1)what is an ATTRIB? what is a PARAM? what is the difference?
2)how i pass a vertex from opengl to my vertex program? just a glVertex3f() without glbegin and glend? or i have to use Arrays? all the examples i looked at were using arrays…
3)how i pass my processed vertices from vertex program to fragment program? i will have far more fragments than vertices, isn’t it?
4)where do i put outputs? some files have a simil define on top like:
OUTPUT outPosition = result.position
other programs just have the restul stuff at the end. is there any standard format file??
if u got bored reading this message, just point me to a good book and make me shut up until i finished studing it
An ATTRIB is 4 component vector which is passed to the GL with every vertex. e.g. a normal or a texture coordinate is an ATTRIB.
A PARAM is a 4 component vector which is passed to the GL wich every rendering (glBegin, glDrawArrays, glDrawElement, …) e.g. the light position or light color is a PARAM
So ATTRIB do normally change with every vertex you pass to the GL and PARAM normaly change with every rendering command.
There’s no difference passing vertex to the GL if you use vertex program or if you don’t. You can use glVertex* oder Vertex arrays. Should both work!
You have to use Texture Coordinates. In modernt graphic cards you have about 8 texture coordinates available so you can use them to pass data from vertex programs to fragment programs.
ARB_VERTEX_PROGRAM and ARB_FRAGMENT_PROGRAM have a couple of ways to access outputs (and attribs, params, …):
Directly by using to name in code:
MOV result.position, myvec;
Or by defining it before:
OUTPUT outPosition = result.position;
MOV outPosition, myvec;
I hope this might help u!
But why don’t you learn GLslang instead of ARB_*_programs?
thanks fow the help.
I have just some trouble understanding how i use texture coords to pass data from vertex to fragment program. What if i have no texture at all? Puzzling.
Anyway, as for now i am just a wet nose, fresh fresh from graduation, my thesis was on opengl, but on a moooore easy way. Now my boss wants to use latest tech (and i can understand that), and ordered me to learn… the problem is that i am advancig just on my own, so i just follow the trails that i find here and now…
by the way, what is GLslang??? never heard about it.
By the way off topic… what do u do 4 living? I am working as IT engeneering but… bah Games is what i’d like to do
See ya man, gotta go…
bye the gunslinger
There should be no problem using texture coordinates even if the texture units are not active. But I’m not sure. But if it doesn’t work you can try this:
Here the texture coordinate HAVE to work but you are not able to use this texture.
GLslang is a high level shading language. You don’t have to write you vertex and fragment programs in a assambler language. A GLslang fragment shader looks for example like this:
varying vec2 TexCoord;
uniform sampler2D Texture;
gl_FragColor = texture2D(Texture, TexCoord);
It’s just like C and you are able to do much more thing than in assembler. Here some links relating to GLslang:
http://www.delphigl.de/dgl/glSlang.html <- Introduction in GLslang / written inGerman
http://www.clockworkcoders.com/oglsl/ <- Tutorials
What I do for living? I’m a student…
[This message has been edited by Corrail (edited 01-13-2004).]
Think of the texture coordinates as a generic set of 8 vectors that you can use for whatever you want. They don’t need to be used for textures at all.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.