Light | Dark

# docs.GL

OpenGL 4
OpenGL 3
OpenGL ES 3

# glGetFragDataLocation

## Name

glGetFragDataLocation — query the bindings of color numbers to user-defined varying out variables

## C Specification

`GLint glGetFragDataLocation(` | GLuint program,
| const char * name`)`;

## Parameters

`program`

  The name of the program containing varying out variable whose binding to query

`name`

  The name of the user-defined varying out variable whose binding to query

## Description

`glGetFragDataLocation` retrieves the assigned color number binding for the user-defined varying out variable `name` for program `program`. `program` must have previously been linked. `name` must be a null-terminated string. If `name` is not the name of an active user-defined varying out fragment shader variable within `program`, -1 will be returned.

## Notes

In OpenGL ES Shading Language version 3.00, output variables must be explicitly bound to fragment colors within the shader text. This query simply returns that binding information.

## Errors

`GL_INVALID_OPERATION` is generated if `program` is not the name of a program object.

## API Version Support

| OpenGL ES API Version
--- | ---
Function Name | 2.0 | 3.0 | 3.1
glGetFragDataLocation | - | ✔ | ✔

## See Also

glCreateProgram,

## Copyright

Copyright © 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. https://opencontent.org/openpub/.

Think you can improve this page? Edit this page on GitHub.