summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL
AgeCommit message (Collapse)Author
2021-10-17LibGL: Implement `glIsEnabled()`Jelle Raaijmakers
2021-10-17LibGL: Implement disabling GL_FOGJelle Raaijmakers
2021-10-17LibGL: Correct GL_MODELVIEW and GL_PROJECTION valuesJelle Raaijmakers
According to the Khronos group, GL enum values are in the spec: https://www.khronos.org/registry/OpenGL/docs/enums.html Not adhering to their values will cause issues with projects that ship their own copy of `gl.h`, such as ScummVM.
2021-10-08Libraries: Fix -Wunreachable-code warnings from clangNico Weber
2021-10-02LibGL: Remove duplicate GLboolean typedefLinus Groh
Fixes #10268.
2021-10-01Libraries: Fix typosNico Weber
2021-09-07Everywhere: Behaviour => BehaviorAndreas Kling
2021-09-03Everywhere: Prevent risky implicit casts of (Nonnull)RefPtrDaniel Bertalan
Our existing implementation did not check the element type of the other pointer in the constructors and move assignment operators. This meant that some operations that would require explicit casting on raw pointers were done implicitly, such as: - downcasting a base class to a derived class (e.g. `Kernel::Inode` => `Kernel::ProcFSDirectoryInode` in Kernel/ProcFS.cpp), - casting to an unrelated type (e.g. `Promise<bool>` => `Promise<Empty>` in LibIMAP/Client.cpp) This, of course, allows gross violations of the type system, and makes the need to type-check less obvious before downcasting. Luckily, while adding the `static_ptr_cast`s, only two truly incorrect usages were found; in the other instances, our casts just needed to be made explicit.
2021-09-02LibGL: Implement glTexSubImage2DStephan Unverwerth
2021-09-02LibGL: Add GL_TETXURE*_ARB aliasesStephan Unverwerth
These defines were introduced when multitexturing was only supported via the extension EXT_multitexture. GLQuake makes use of them.
2021-09-02LibGL: Support additional enums in glGetIntegervStephan Unverwerth
GL_MAX_TETXURE_UNITS: Returns the available units for multitexturing GL_MAX_TETXURE_SIZE: Returns the maximum width/height for textures
2021-09-02LibGL: Fix glTexImage2D texture dimension validationStephan Unverwerth
This now verifies that width and height are a power of 2. The previous check was nonsensical, probably because it was written against a spec with improper text formatting, turning 2^x into 2*x :^)
2021-09-02LibGL: Allow numerical internal formats in glTexImage2DStephan Unverwerth
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.
2021-09-02LibGL: Implement glPolygonOffsetStephan Unverwerth
2021-09-02LibGL: Implement glDrawBufferStephan Unverwerth
2021-08-26LibGL: Implement glTexEnvfStephan Unverwerth
This controls how fetched texels are combined with the color that was produced by a preceding texture unit or with the vertex color if it is the first texture unit. Currently only a small subset of possible combine modes is implemented as required by glquake.
2021-08-26LibGL: Implement glPixelStoreiStephan Unverwerth
This sets the length of a row for the image to be transferred. This value is measured in pixels. When a rectangle with a width less than this value is transferred the remaining pixels of this row are skipped.
2021-08-25LibGL: Implement fog effect in Software RasterizerJesse Buhagiar
We support three of the possible fog modes, EXP, EXP2 and LINEAR.
2021-08-25LibGL: Implement `glFogi`Jesse Buhagiar
2021-08-25LibGL: Implement `glFogf`Jesse Buhagiar
2021-08-25LibGL: Implement `glFogfv`Jesse Buhagiar
This currently just sets the fog colour in the rasterizer.
2021-08-21LibGL: Use integer comparison for GL_EQUAL and GL_NOTEQUALJesse Buhagiar
This is an interesting quirk that occurs due to us using the x87 FPU when Serenity is compiled for the i386 target. When we calculate our depth value to be stored in the buffer, it is an 80-bit x87 floating point number, however, when stored into the DepthBuffer, this is truncated to 32 bits. This 38 bit loss of precision means that when x87 `FCOMP` is eventually used here the comparison fails. This could be solved by using a `long double` for the depth buffer, however this would take up significantly more space and is completely overkill for a depth buffer. As such, comparing the first 32-bits of this depth value is "good enough" that if we get a hit on it being equal, we can pretty much guarantee that it's actually equal.
2021-08-20LibGL: Implement `glPolygonMode`Jesse Buhagiar
Currently just sets the renderer option for what polygon mode we want the rasterizer to draw in. GLQuake only uses `GL_FRONT_AND_BACK` with `GL_FILL` )which implies both back and front facing triangles are to be filled completely by the rasterizer), so keeping this as a small stub is perfectly fine for now.
2021-08-19LibGL: Don't crash on invalid pname value in glGetFloatvJesse Buhagiar
This brings `glGetFloatv` more inline with the other `glGet` functions. We should prevent crashing in the driver as much as possible and instead let the application deal with the generated GL error.
2021-08-18LibGL: Leave render loop early if color mask emptyStephan Unverwerth
2021-08-18LibGL: Fix triangle winding calculationStephan Unverwerth
Since we operate in screen space where y points down we need to reverse what is considered clock wise and what is considered counter clockwise. The rasterizer always expects triangles with a consistent winding order thus swap 2 vertices if necessary to reverse the winding before passing the triangle on to the rasterization stage.
2021-08-18LibGL: Fix clipping and interpolate vertex attributesStephan Unverwerth
The previous clipping implementation was problematic especially when clipping against the near plane. Triangles are now correctly clipped using homogenous coordinates against all frustum planes. Texture coordinates and vertex colors are now correctly interpolated. The earier implementation was just a placeholder.
2021-08-18LibGL: Improve texture sampling performanceStephan Unverwerth
GL_NEAREST: Remove unnecessary modulo. UV is always in range due to wrapping. GL_LINEAR: Rewrite filter equation to save a few math operations.
2021-08-18LibGL: Return white texel when sampling uninitialized textureStephan Unverwerth
2021-08-18LibGL: Complete glGetString implementationStephan Unverwerth
GL_VERSION: The spec mandates the following format: x.y or x.y.z optionally followed by text separated by space. GL_EXTENSIONS: Return empty string. We do not support any extensions.
2021-08-18LibGL: Implement glDepthFuncStephan Unverwerth
2021-08-18LibGL: Implement glDepthRangeStephan Unverwerth
2021-08-18LibGL: Fix incorrect blend factor setupStephan Unverwerth
2021-08-18LibGL: Allow glTexImage2D to create uninitialized texturesStephan Unverwerth
When passing a nullptr as the pixel array LibGL now allocates texture memory but does not initialize the texture contents.
2021-08-18LibGL: Fix interpretation of BGRA byte orderStephan Unverwerth
This fixes byte order interpretation in several places.
2021-08-18LibGL: Fix glVertexPointer argument validationStephan Unverwerth
2021-08-18LibGL: Fix glTexCoord behaviourStephan Unverwerth
glTexCoord should behave like glColor. It only updates a gl context variable that contains the current texture coordinates. The vertex is only actually created once glVertex is called.
2021-08-18LibGL+3DFileViewer: Make glRotatef accept degrees, not radiansStephan Unverwerth
This is in accordance with the GL spec. Also adjust rotation values in 3DFileViewer to take the new units into account.
2021-08-18LibGL: Implement `glGetIntegerv`Jesse Buhagiar
2021-08-18LibGL: Implenent `glGetBooleanv`Jesse Buhagiar
2021-08-15LibGL: Implement `glColorMask`Jesse Buhagiar
2021-08-14LibGL: Implement glDrawElementsStephan Unverwerth
2021-08-14LibGL: Implement glDrawArraysStephan Unverwerth
2021-08-14LibGL: Implement glTexCoord4fvStephan Unverwerth
2021-08-14LibGL: Implement glTexCoordPointerStephan Unverwerth
2021-08-14LibGL: Implement glColorPointerStephan Unverwerth
2021-08-14LibGL: Implement glVertexPointerStephan Unverwerth
2021-08-14LibGL: Implement glEnableClientState and glDisableClientStateStephan Unverwerth
2021-08-14LibGL: Implement glDepthMaskStephan Unverwerth
2021-08-14LibGL: Add missing defines needed for glquakeStephan Unverwerth