Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent OpenGL ES 2.0 Method to void glBindFragDataLocation(GLuint program, GLuint colorNumber, const char * name);

The online documentation at http://www.khronos.org/opengles/sdk/docs/man/ does not give reference to the glBindFragDataLocation(GLuint program, GLuint colorNumber, const char * name); method. What is the equivalent to this in OpenGL es 2.0?

like image 399
Matthew Hoggan Avatar asked May 15 '13 23:05

Matthew Hoggan


1 Answers

There is not equivalent, read below.

OpenGL ES 2.0 does not allow to emit more than one fragment output, you either write to gl_FragColor or gl_FragData[0]. This is one of the things that with plain OpenGLES 2.0 makes really slow deferred shading since you cannot define multiple targets.

If you are on Tegra you can slightly change your program to emit gl_FragData[i] using NV_draw_buffers extension, but you cannot use an user defined out variables, there is only gl_FragData[i] out variable that could output to different attachments.

That being said, and trying to answer your question, you need to change your fragment shader to use gl_FragColor or gl_FragData[0], there are not user defined out variables.

like image 182
Trax Avatar answered Jan 01 '23 14:01

Trax