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

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

+4
source share
1 answer

There is no equivalent as shown below.

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

If you are in Tegra , you can slightly change your program to emit gl_FragData[i] using the NV_draw_buffers extension, but you cannot use user-defined variables, there is only the variable gl_FragData[i] out which can be displayed on different attachments.

To answer your question, you need to change the fragment shader to use gl_FragColor or gl_FragData[0] , there are no user-defined variables .

+7
source

Source: https://habr.com/ru/post/1481053/


All Articles