Exemplo n.º 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;
	}
Exemplo n.º 2
0
	static inline
	GLuint _check_i(GLint value, const char* query_name)
	{
		OGLPLUS_HANDLE_ERROR_IF(
			(value < 0),
			GL_INVALID_VALUE,
			LimitError::MessageNeg(),
			LimitError,
			Limit(_limit()).
			EnumParam(Query, query_name)
		);
		OGLPLUS_HANDLE_ERROR_IF(
			!(GLuint(value) < _limit()),
			GL_INVALID_VALUE,
			LimitError::Message(),
			LimitError,
			Value(GLuint(value)).
			Limit(_limit()).
			EnumParam(Query, query_name)
		);
		return GLuint(value);
	}
Exemplo n.º 3
0
	static void ThrowIfOverLimit(
		LimitQuery limit,
		GLint value,
		GLint max_limit
	)
	{
		OGLPLUS_HANDLE_ERROR_IF(
			value > max_limit,
			GL_INVALID_VALUE,
			LimitError::Message(),
			LimitError,
			GLFunc(EnumValueName(limit).c_str())
		);
	}
 /** 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);
    }