summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL/GLTexture.cpp
blob: f9281de0076d4bcdd4093ed898d8c2bcf5b51749 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
 * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
 * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include "GLContext.h"
#include <LibGL/GL/gl.h>

extern GL::GLContext* g_gl_context;

void glGenTextures(GLsizei n, GLuint* textures)
{
    g_gl_context->gl_gen_textures(n, textures);
}

void glDeleteTextures(GLsizei n, const GLuint* textures)
{
    g_gl_context->gl_delete_textures(n, textures);
}

void glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid* data)
{
    dbgln("glTexImage1D({:#x}, {}, {:#x}, {}, {}, {:#x}, {:#x}, {:p}): unimplemented", target, level, internalFormat, width, border, format, type, data);
    TODO();
}

void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data)
{
    g_gl_context->gl_tex_image_2d(target, level, internalFormat, width, height, border, format, type, data);
}

void glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* data)
{
    dbgln("glTexImage3D({:#x}, {}, {:#x}, {}, {}, {}, {}, {:#x}, {:#x}, {:p}): unimplemented", target, level, internalFormat, width, height, depth, border, format, type, data);
    TODO();
}

void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* data)
{
    g_gl_context->gl_tex_sub_image_2d(target, level, xoffset, yoffset, width, height, format, type, data);
}

void glBindTexture(GLenum target, GLuint texture)
{
    g_gl_context->gl_bind_texture(target, texture);
}

// Note: This is an _extremely_ misleading API name. This sets the active
// texture unit, NOT the active texture itself...
void glActiveTexture(GLenum texture)
{
    g_gl_context->gl_active_texture(texture);
}

void glTexParameteri(GLenum target, GLenum pname, GLint param)
{
    g_gl_context->gl_tex_parameter(target, pname, param);
}

void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
{
    g_gl_context->gl_tex_parameter(target, pname, param);
}

void glTexEnvf(GLenum target, GLenum pname, GLfloat param)
{
    g_gl_context->gl_tex_env(target, pname, param);
}

void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
{
    g_gl_context->gl_copy_tex_image_2d(target, level, internalformat, x, y, width, height, border);
}

void glTexGend(GLenum coord, GLenum pname, GLdouble param)
{
    g_gl_context->gl_tex_gen(coord, pname, param);
}

void glTexGenf(GLenum coord, GLenum pname, GLfloat param)
{
    g_gl_context->gl_tex_gen(coord, pname, param);
}

void glTexGenfv(GLenum coord, GLenum pname, GLfloat const* params)
{
    g_gl_context->gl_tex_gen_floatv(coord, pname, params);
}

void glTexGeni(GLenum coord, GLenum pname, GLint param)
{
    g_gl_context->gl_tex_gen(coord, pname, param);
}

void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* params)
{
    g_gl_context->gl_get_tex_parameter_integerv(target, level, pname, params);
}