Example #1
0
	/** Finds the location / index of the fragment data specified
	 *  by @p identifier in a @p program. If active_only is true then
	 *  throws if no such fragment data output exists or if it is not active.
	 *
	 *  @glsymbols
	 *  @glfunref{GetFragDataLocation}
	 */
	static GLint GetLocation(
		ProgramName program,
		StrCRef identifier,
		bool active_only
	)
	{
		GLint result = OGLPLUS_GLFUNC(GetFragDataLocation)(
			GetGLName(program),
			identifier.c_str()
		);
		OGLPLUS_CHECK(
			GetFragDataLocation,
			ProgVarError,
			Program(program).
			Identifier(identifier)
		);
		OGLPLUS_HANDLE_ERROR_IF(
			active_only && (result < 0),
			GL_INVALID_OPERATION,
			MsgGettingInactive(),
			ProgVarError,
			Program(program).
			Identifier(identifier)
		);
		return result;
	}
 /** Finds the location of the subroutine uniform specified
  *  by @p identifier in a @p program. If active_only is true then
  *  throws if no such subroutine exists or if it is not active.
  *
  *  @glsymbols
  *  @glfunref{GetSubroutineUniformLocation}
  */
 static GLint GetLocation(
   ProgramName program,
   ShaderType stage,
   StrCRef identifier,
   bool active_only) {
     GLint result = OGLPLUS_GLFUNC(GetSubroutineUniformLocation)(
       GetGLName(program), GLenum(stage), identifier.c_str());
     OGLPLUS_CHECK(
       GetSubroutineUniformLocation,
       ProgVarError,
       Program(program).Identifier(identifier).EnumParam(stage));
     OGLPLUS_HANDLE_ERROR_IF(
       active_only && (result < 0),
       GL_INVALID_OPERATION,
       MsgGettingInactive(),
       ProgVarError,
       Program(program).Identifier(identifier).EnumParam(stage));
     return result;
 }
    /** Finds the location / index of the subroutine specified
     *  by @p identifier in the @p stage of a @p program. If active_only
     *  is true then throws if no such subroutine exists or if it is
     *  not active.
     *
     *  @glsymbols
     *  @glfunref{GetSubroutineIndex}
     */
    static GLint GetLocation(
      ProgramName program,
      ShaderType stage,
      StrCRef identifier,
      bool active_only) {
        GLuint result = OGLPLUS_GLFUNC(GetSubroutineIndex)(
          GetGLName(program), GLenum(stage), identifier.c_str());
        OGLPLUS_CHECK(
          GetSubroutineIndex,
          ProgVarError,
          Program(program).Identifier(identifier).EnumParam(stage));
        OGLPLUS_HANDLE_ERROR_IF(
          active_only && (result == GL_INVALID_INDEX),
          GL_INVALID_OPERATION,
          MsgGettingInactive(),
          ProgVarError,
          Program(program).Identifier(identifier).EnumParam(stage));

        if(result == GL_INVALID_INDEX) {
            return -1;
        }
        return GLint(result);
    }