mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
LibGL: Allow numerical internal formats in glTexImage2D
Prior to version 1.1 OpenGL only allowed the numbers 1,2,3 and 4 to be used as internal texture formats. Symbolic constants were introduced first with the EXT_texture extension and then later adopted into the core profile.
This commit is contained in:
parent
15299b763c
commit
05a7a4640d
1 changed files with 10 additions and 0 deletions
|
@ -642,6 +642,16 @@ void SoftwareGLContext::gl_tex_image_2d(GLenum target, GLint level, GLint intern
|
|||
// Check if there is actually a texture bound
|
||||
RETURN_WITH_ERROR_IF(target == GL_TEXTURE_2D && m_active_texture_unit->currently_bound_target() != GL_TEXTURE_2D, GL_INVALID_OPERATION);
|
||||
|
||||
// Internal format can also be a number between 1 and 4. Symbolic formats were only added with EXT_texture, promoted to core in OpenGL 1.1
|
||||
if (internal_format == 1)
|
||||
internal_format = GL_ALPHA;
|
||||
else if (internal_format == 2)
|
||||
internal_format = GL_LUMINANCE_ALPHA;
|
||||
else if (internal_format == 3)
|
||||
internal_format = GL_RGB;
|
||||
else if (internal_format == 4)
|
||||
internal_format = GL_RGBA;
|
||||
|
||||
// We only support symbolic constants for now
|
||||
RETURN_WITH_ERROR_IF(!(internal_format == GL_RGB || internal_format == GL_RGBA), GL_INVALID_ENUM);
|
||||
RETURN_WITH_ERROR_IF(type != GL_UNSIGNED_BYTE, GL_INVALID_VALUE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue