mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 11:55:08 +00:00

This change introduces GL.h with error check wrappers for all the OpenGL functions we used so far. For now, the error check is simply: `VERIFY(glGetError() == GL_NO_ERROR);` but that is better than continuing execution after encounting an error.
35 lines
648 B
C++
35 lines
648 B
C++
/*
|
|
* Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Noncopyable.h>
|
|
#include <LibAccelGfx/GL.h>
|
|
|
|
namespace AccelGfx {
|
|
|
|
class Program {
|
|
AK_MAKE_NONCOPYABLE(Program);
|
|
|
|
public:
|
|
static Program create(char const* vertex_shader_source, char const* fragment_shader_source);
|
|
|
|
void use();
|
|
GL::VertexAttribute get_attribute_location(char const* name);
|
|
GL::Uniform get_uniform_location(char const* name);
|
|
|
|
~Program();
|
|
|
|
private:
|
|
Program(GL::Program program)
|
|
: m_program(program)
|
|
{
|
|
}
|
|
|
|
GL::Program m_program;
|
|
};
|
|
|
|
}
|