2021-01-06 22:58:01 +11:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
|
2021-05-29 12:38:28 +02:00
|
|
|
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
2021-01-06 22:58:01 +11:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "GL/gl.h"
|
|
|
|
#include <AK/OwnPtr.h>
|
2021-04-24 01:57:01 +02:00
|
|
|
#include <LibGfx/Bitmap.h>
|
2021-04-24 22:43:42 +10:00
|
|
|
#include <LibGfx/Matrix4x4.h>
|
2021-01-06 22:58:01 +11:00
|
|
|
|
|
|
|
namespace GL {
|
|
|
|
|
|
|
|
class GLContext {
|
|
|
|
public:
|
2021-04-24 01:57:01 +02:00
|
|
|
virtual ~GLContext();
|
2021-01-06 22:58:01 +11:00
|
|
|
|
|
|
|
virtual void gl_begin(GLenum mode) = 0;
|
|
|
|
virtual void gl_clear(GLbitfield mask) = 0;
|
|
|
|
virtual void gl_clear_color(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) = 0;
|
2021-05-06 23:17:35 +02:00
|
|
|
virtual void gl_clear_depth(GLdouble depth) = 0;
|
2021-01-06 22:58:01 +11:00
|
|
|
virtual void gl_color(GLdouble r, GLdouble g, GLdouble b, GLdouble a) = 0;
|
2021-05-10 07:52:39 +10:00
|
|
|
virtual void gl_delete_textures(GLsizei n, const GLuint* textures) = 0;
|
2021-01-06 22:58:01 +11:00
|
|
|
virtual void gl_end() = 0;
|
|
|
|
virtual void gl_frustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val) = 0;
|
2021-05-10 07:52:39 +10:00
|
|
|
virtual void gl_gen_textures(GLsizei n, GLuint* textures) = 0;
|
2021-04-23 23:48:28 +10:00
|
|
|
virtual GLenum gl_get_error() = 0;
|
2021-01-06 22:58:01 +11:00
|
|
|
virtual GLubyte* gl_get_string(GLenum name) = 0;
|
|
|
|
virtual void gl_load_identity() = 0;
|
2021-04-24 22:43:42 +10:00
|
|
|
virtual void gl_load_matrix(const FloatMatrix4x4& matrix) = 0;
|
2021-01-06 22:58:01 +11:00
|
|
|
virtual void gl_matrix_mode(GLenum mode) = 0;
|
2021-04-24 17:40:15 +04:30
|
|
|
virtual void gl_ortho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val) = 0;
|
2021-01-06 22:58:01 +11:00
|
|
|
virtual void gl_push_matrix() = 0;
|
|
|
|
virtual void gl_pop_matrix() = 0;
|
|
|
|
virtual void gl_rotate(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) = 0;
|
2021-04-24 22:11:48 +10:00
|
|
|
virtual void gl_scale(GLdouble x, GLdouble y, GLdouble z) = 0;
|
2021-01-06 22:58:01 +11:00
|
|
|
virtual void gl_translate(GLdouble x, GLdouble y, GLdouble z) = 0;
|
|
|
|
virtual void gl_vertex(GLdouble x, GLdouble y, GLdouble z, GLdouble w) = 0;
|
|
|
|
virtual void gl_viewport(GLint x, GLint y, GLsizei width, GLsizei height) = 0;
|
2021-04-24 12:09:56 +02:00
|
|
|
virtual void gl_enable(GLenum) = 0;
|
|
|
|
virtual void gl_disable(GLenum) = 0;
|
|
|
|
virtual void gl_front_face(GLenum) = 0;
|
|
|
|
virtual void gl_cull_face(GLenum) = 0;
|
2021-05-09 08:25:15 +04:30
|
|
|
virtual GLuint gl_gen_lists(GLsizei range) = 0;
|
|
|
|
virtual void gl_call_list(GLuint list) = 0;
|
|
|
|
virtual void gl_delete_lists(GLuint list, GLsizei range) = 0;
|
|
|
|
virtual void gl_end_list(void) = 0;
|
|
|
|
virtual void gl_new_list(GLuint list, GLenum mode) = 0;
|
2021-05-14 21:47:25 +02:00
|
|
|
virtual void gl_flush() = 0;
|
|
|
|
virtual void gl_finish() = 0;
|
2021-05-15 22:45:05 +02:00
|
|
|
virtual void gl_blend_func(GLenum src_factor, GLenum dst_factor) = 0;
|
2021-05-16 14:05:13 +02:00
|
|
|
virtual void gl_shade_model(GLenum mode) = 0;
|
2021-05-16 16:43:09 +02:00
|
|
|
virtual void gl_alpha_func(GLenum func, GLclampf ref) = 0;
|
2021-05-20 23:20:23 +02:00
|
|
|
virtual void gl_hint(GLenum target, GLenum mode) = 0;
|
2021-05-24 15:24:49 +02:00
|
|
|
virtual void gl_read_buffer(GLenum mode) = 0;
|
2021-05-24 16:11:06 +02:00
|
|
|
virtual void gl_read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) = 0;
|
2021-05-13 22:18:17 +10:00
|
|
|
virtual void gl_tex_image_2d(GLenum target, GLint level, GLint internal_format, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data) = 0;
|
2021-05-23 20:38:18 +10:00
|
|
|
virtual void gl_tex_coord(GLfloat s, GLfloat t, GLfloat r, GLfloat q) = 0;
|
2021-05-30 00:15:51 +02:00
|
|
|
virtual void gl_bind_texture(GLenum target, GLuint texture) = 0;
|
2021-05-30 16:56:56 +10:00
|
|
|
virtual void gl_active_texture(GLenum texture) = 0;
|
2021-06-08 21:34:50 -06:00
|
|
|
virtual void gl_get_floatv(GLenum pname, GLfloat* params) = 0;
|
2021-04-24 01:57:01 +02:00
|
|
|
|
|
|
|
virtual void present() = 0;
|
2021-01-06 22:58:01 +11:00
|
|
|
};
|
|
|
|
|
2021-04-24 01:57:01 +02:00
|
|
|
OwnPtr<GLContext> create_context(Gfx::Bitmap&);
|
2021-01-06 22:58:01 +11:00
|
|
|
void make_context_current(GLContext*);
|
|
|
|
|
|
|
|
}
|