Age | Commit message (Collapse) | Author |
|
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules
"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
|
|
This simplifies a lot of code in `GLContext` and prevents potential
errors when testing against the current matrix mode.
|
|
Vectors of length 0 cannot be normalized, so prevent dividing by zero
in the `glRotate*` API. This fixes the skybox rendering of Quake2.
|
|
This merges GLContext and SoftwareGLContext into a single GLContext
class. Since the hardware abstraction is handled via the GPU device
interface we do not need the virtual base of GLContext anymore. All
context handling functionality from the old GLContext has been moved
into the new version. All methods in GLContext are now non virtual and
the class is marked as final.
|
|
We were lacking support for default textures (i.e. calling
`glBindTexture` with a `texture` argument of `0`) which caused our
Quake2 port to render red screens whenever a video was playing. Every
texture unit is now initialized with a default 2D texture.
Additionally, we had this concept of a "currently bound target" on our
texture units which is not how OpenGL wants us to handle targets.
Calling `glBindTexture` should set the texture for the provided target
only, making it sort of an alias for future operations on the same
target.
Finally, `glDeleteTextures` should not remove the bound texture from
the target in the texture unit, but it should reset it to the default
texture.
|
|
|
|
|
|
Used for `glDrawArrays` and `glDrawElements`, the normal pointer should
point to sets of X, Y and Z values.
|
|
We already had the implementation, but we were erroneously rejecting
`GL_LIGHT_MODEL_LOCAL_VIEWER` as a parameter to `glLightModel`.
|
|
No functional changes, just removal of superfluous braces.
|
|
|
|
|
|
This matches the rename of RGBA32 to ARGB32. It also makes more sense
when you see it used with 32-bit hexadecimal literals:
Before:
Color::from_rgba(0xaarrggbb)
After:
Color::from_argb(0xaarrggbb)
|
|
The ARGB32 typedef is used for 32-bit #AARRGGBB quadruplets. As such,
the name RGBA32 was misleading, so let's call it ARGB32 instead.
Since endianness is a thing, let's not encode any assumptions about byte
order in the name of this type. ARGB32 is basically a "machine word"
of color.
|
|
GL_LINEAR_MIPMAP_NEAREST means choose nearest mipmap level, interpolate
texels linearly.
GL_NEAREST_MIPMAP_LINEAR means choose the two closest mipmap levels,
sample the texels unfiltered and linearly interpolate based on the
fractional value of the mipmap level.
Previously we had this backwards.
|
|
We were erroneously setting the projection matrix when `GL_MODELVIEW`
was supplied.
|
|
Do not convert to float too early. Additionally, handle some error
cases for the input parameters.
|
|
|
|
Our API still specifies it as a double, but internally we communicate a
float to the rasterizer. Additionally, clamp the value to 0..1 as
described in the spec.
|
|
Our implementation keeps the top-most item on the matrix stacks in a
member variable, so we can always use that instead of considering the
actual stack.
Additionally, the current matrix mode should not influence retrieving
the projection or model view matrix.
|
|
No functional changes.
|
|
|
|
We get `double`s as input, so convert them to `float` first.
|
|
Between the OpenGL client and server, a lot of data type and color
conversion needs to happen. We are performing these conversions both in
`LibSoftGPU` and `LibGL`, which is not ideal. Additionally, some
concepts like the color, depth and stencil buffers should share their
logic but have separate implementations.
This is the first step towards generalizing our `LibSoftGPU` frame
buffer: a generalized `Typed3DBuffer` is introduced for arbitrary 3D
value storage and retrieval, and `Typed2DBuffer` wraps around it to
provide in an easy-to-use 2D pixel buffer. The color, depth and stencil
buffers are replaced by `Typed2DBuffer` and are now managed by the new
`FrameBuffer` class.
The `Image` class now uses multiple `Typed3DBuffer`s for layers and
mipmap levels. Additionally, the textures are now always stored as
BGRA8888, only converting between formats when reading or writing
pixels.
Ideally this refactor should have no functional changes, but some
graphical glitches in Grim Fandango seem to be fixed and most OpenGL
ports get an FPS boost on my machine. :^)
|
|
|
|
We check for primitive support in `glEnd()`, so we do not need to
preemptively reject the mode in `glBegin()`. This allows `glBegin()` to
be invoked with `GL_POINTS`, for example.
|
|
Each of the material faces is copied member by member then the copied
material state is passed by `const&` to another function, then
destroyed.
This is changed to simply passing the material state directly without
copying.
|
|
There is a loop over the lights in which each light state is copied
member by member then the copied light state is passed by `const&` to
another function, then destroyed.
This is changed to simply passing the light state directly without
copying.
|
|
|
|
|
|
This was only passing in the `R` value to the scene's ambient color,
which is incorrect.
|
|
|
|
|
|
|
|
The constant value for GL_DECAL is 0x2101 instead of 0x2102.
This was tripping up Half-Life when making the water texture
transparent when under water. The Half-Life port uses its own OpenGL
header, meaning this error wasn't hidden by us.
|
|
|
|
|
|
We were returning row-major matrices when OpenGL clients are expecting
column-major instead.
|
|
|
|
|
|
This prevents overwriting the front face mode when providing `GL_BACK`
as a parameter.
|
|
|
|
|
|
|
|
|
|
In addition to tracking a pointer to the active texture unit we also
track its index in the array.
|
|
Previously we only had a single current texture coordinate, set by
the glTexCoord family of functions. Since we now can have multiple
texture coordinates we track a vector of current texture coordinates
and set the requested one in glMultiTexCoord(). glTexCoord() Always sets
the first texture coordinate.
|
|
This now tracks one vertex attribute pointer per texture unit and calls
glMultiTexCoord() to set the texture coordinates for the correct texture
unit.
|
|
We now have one set of texture coordinates per texture unit.
Texture coordinate generation and texture coordinate assignment is
currently only stubbed. This will be rectified in another commit.
|
|
This makes glquake recognize multitexture support and choose the
multitexture rendering path.
|