mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:57:47 +00:00
LibSoftGPU: Apply regular cartesian coordinate system
Currently, LibSoftGPU is still OpenGL-minded in that it uses a coordinate system with the origin of `(0, 0)` at the lower-left of textures, buffers and window coordinates. Because we are blitting to a `Gfx::Bitmap` that has the origin at the top-left, we need to flip the Y-coordinates somewhere in the rasterization logic. We used to do this during conversion of NDC-coordinates to window coordinates. This resulted in some incorrect behavior when rasterization did not pass through the vertex transformation logic, e.g. when calling `glDrawPixels`. This changes the coordinate system to OpenGL's throughout, only to blit the final color buffer upside down to the target bitmap. This fixes drawing to the depth buffer directly resulting in upside down images.
This commit is contained in:
parent
3832656464
commit
8c9fa50c61
3 changed files with 21 additions and 31 deletions
|
@ -143,8 +143,7 @@ public:
|
|||
|
||||
private:
|
||||
void draw_statistics_overlay(Gfx::Bitmap&);
|
||||
Gfx::IntRect raster_rect_in_target_coordinates(Gfx::IntSize size);
|
||||
Gfx::IntRect window_coordinates_to_target_coordinates(Gfx::IntRect const&);
|
||||
Gfx::IntRect get_rasterization_rect_of_size(Gfx::IntSize size);
|
||||
|
||||
void rasterize_triangle(const Triangle& triangle);
|
||||
void setup_blend_factors();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue