Skip to main content
GameDev.net gamedev.net
🔒 Locked

GLSL 1.30 and FBO

Started by Bakura Feb 7, 2009 at 2:51 PM 2 replies 4.1k views
Original Post
Bakura
Bakura
Hi everyone, I'm trying to learn some of the new good habits of GLSL 1.30... but there is still one thing I don't understand. In the doc, it's said that the use of gl_FragData[n] is deprecated, and to use "out" instead. But how the hell can we know in which texture data is written. Let's take an exemple : with GLSL 1.20, when I want to write something using the FBO extension, I used to doing that : gl_FragData[0] = myVec41; gl_FragData[1] = myVec42; It was easy to know that the texture bounded to unit 1 has myVec41, and that texture bounded to unit 2 has myVec42. But how can we know now with GLSL 1.30 ? From what I've understood, it's something like that :

out vec4 myVec41;
out vec4 myVec42;

void main ()
{
// Don't use gl_FragData
}


I think that GLSL 1.30 is intelligent enough, so myVec41 will be written to the first active texture (because it is declared first), and myVec42 will be written to the second active texture (because it is declared second). Am I right ? Furthermore, what if I want to write myVec41 in a the third active unit, and myVec42 to the fourth one ? Thanks ;)
JvdWulp
JvdWulp
So, what is the status on this?

Is this true, should we use out instead of gl_FragData[x]?

I read that attributes are deprecated too. What do you think of this?

Greetz Jaap
i_luv_cplusplus
i_luv_cplusplus
I use only one out because I didn't need FBOs yet, so I guess you just need to try.

As for attributes being deprecated - the keyword "attribute" is deprecated, you just use in. instead of:

attribute vec3 tangent;

you'd use:

in vec3 tangent;

OpenGL fanboy.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.