Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOFT RENDER: Textured Triangles #1783

SDLBugzilla opened this issue Feb 10, 2021 · 1 comment

SOFT RENDER: Textured Triangles #1783

SDLBugzilla opened this issue Feb 10, 2021 · 1 comment


Copy link

@SDLBugzilla SDLBugzilla commented Feb 10, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: All, All

Comments on the original bug report:

On 2015-02-28 02:53:10 +0000, Jared wrote:

Created attachment 2054
Textured-triangle renderer files.

A software-based 2D textured-triangle renderer.

Intended to act as the software-counterpart to simple 2D triangle renderers for Direct3D and OpenGL. Direct3D and OpenGL counterparts are left to others.

On 2015-02-28 02:57:14 +0000, Jared wrote:


Current implementation requires [2888] files to be in the same directory.

Implementation untested.

Implementation needs to be completed (e.g. pixel reading & writing calls).

On 2015-02-28 02:58:46 +0000, Jared wrote:

Comment on attachment 2054
Textured-triangle renderer files.

Expects to be untared in the same directory as the files.

Currently unfinished, and needs refactoring.

On 2015-03-14 14:18:33 +0000, Jared wrote:

Created attachment 2062
Software rendered engine

A set of files that implement a "pixel-perfect" textured-triangle 2D software renderer. Can be used as a basis for less "pixel-perfect" versions by replacing parts, starting with SRC_TERM.

Currently does everything short of the actual pixel access. Not yet tested for this reason.

Expects to be untar'ed in the same directory as the files from [2888].

Call TRI_REND() to use.

On 2015-03-15 06:22:27 +0000, Jared wrote:

Created attachment 2064
Software textured-triangle renderer

This version is ready for testing. It expects to be built in the same directory as the SDL headers.

On 2015-03-16 05:28:13 +0000, Jared wrote:

Created attachment 2065
Test program

A .bmp and a program file to test the textured-triangle software renderer with.

On 2015-03-17 02:14:57 +0000, Jared wrote:

Created attachment 2067
Software textured-triangle renderer

This has been successfully compiled, and doesn't seem to "explode".

On 2015-03-17 02:15:58 +0000, Jared wrote:

Created attachment 2068
Renderer test

Successfully runs, but not certain about the output: it's solid black.

On 2015-03-20 03:54:09 +0000, Jared wrote:

Created attachment 2073
A software textured-triangle renderer

Trying to get this working. Runs, but surface-reading seems to fail... with a program crash as the result.

On 2015-03-20 03:55:26 +0000, Jared wrote:

Created attachment 2074
Renderer test

Attempts to use the textured-triangle software renderer to actually render something. Currently crashes instead.

On 2015-03-22 08:02:33 +0000, Jared wrote:

Created attachment 2078
A software textured-triangle renderer

Fixes several functions insode geo_code.xmacro
Adds a VEC_PERP() function.

Partially tested. To turn off debug messages, define NDEBUG.

On 2015-03-22 08:03:45 +0000, Jared wrote:

Created attachment 2079
Renderer test

Currently testing support code with tri_pretest1.c

To turn off debug messages, define NDEBUG.

On 2015-03-23 04:48:42 +0000, Jared wrote:

Created attachment 2081
A software textured-triangle renderer

The (separate) pretest runs to completion. The (also separate) renderer test still faults. Debugging continues.

On 2015-03-23 04:50:02 +0000, Jared wrote:

Created attachment 2082
Renderer test

A set of tests for the renderer. The "pretest" runs to completion, but it's behavior has not been fully verified. The "test" still faults.

On 2015-03-25 05:19:08 +0000, Jared wrote:

Created attachment 2085
A software textured-triangle renderer

Runs the pretest to completion.

On 2015-03-25 05:21:25 +0000, Jared wrote:

Created attachment 2086
Renderer test

Runs the pretest to completion, though there still seem to be logic defects.

On 2015-03-27 03:11:10 +0000, Jared wrote:

Created attachment 2094
A software textured-triangle renderer

Pre-test mostly runs correctly, with no undesired triangles reported.

On 2015-03-27 03:11:55 +0000, Jared wrote:

Created attachment 2095
Renderer test

Slightly updated pretests.

On 2015-03-28 20:07:16 +0000, Jared wrote:

Created attachment 2098
A software textured-triangle renderer

Fixed geometry bug: pretest still doesn't pass all tests, but it DOES pass-through enough triangles, and all of the passed-through triangles are within the correct area.

Close enough for the moment. Time to look at actually rendering.

On 2015-03-28 20:18:16 +0000, Jared wrote:

Created attachment 2099
Renderer test

The pretest now runs to completion, and the only failure is a single mis-formed triangle. The code at fault should be
TWEEN ( s0, s2, p2, 2, retf[ 2 ] );
in either
} else if( reti[ 0 ] > 0 && reti[ 2 ] > 0 )
} else if( reti[ 1 ] > 0 && reti[ 2 ] > 0 )

The problem is that it uses the wrong side of the input triangle.

I consider this a minor issue, and therefor will ignore it until later.

On 2015-04-01 03:51:20 +0000, Jared wrote:

Created attachment 2103
A software textured-triangle renderer

Now places a small number of pixels on the destination surface in one of the tests.

On 2015-04-01 03:52:35 +0000, Jared wrote:

Created attachment 2104
Renderer test

Test runs to completion, and draws some (not most) pixels to the destination surface.

On 2015-04-24 23:41:27 +0000, Jared wrote:

Created attachment 2134
A software textured-triangle renderer

More iteration on the software renderer.

On 2015-04-24 23:42:17 +0000, Jared wrote:

Created attachment 2135
Renderer test

The output bitmaps are vaguely correct, yay!

On 2015-05-27 01:48:34 +0000, Jared wrote:

Created attachment 2162
A software textured-triangle renderer


On 2015-05-27 01:49:07 +0000, Jared wrote:

Created attachment 2163
Renderer test


On 2015-10-31 18:55:47 +0000, Jared wrote:

Created attachment 2293
A software textured-triangle renderer

Probably this doesn't have any changes, but it's been long enough that I feel the need to take precautions.

On 2015-10-31 18:57:19 +0000, Jared wrote:

Created attachment 2294
Triangle subdivision test.

Testing has restarted on the triangle subdivider, since that's the most important part.

On 2015-10-31 19:00:17 +0000, Jared wrote:

Swapped out the testing: the triangle subdivider is all that's tested at the moment, and not very comprehensibly. The image test previously drew within the correct outlines, yet still didn't render the triangle correctly. Since I apparently can't do image manipulation code worth a darn, I'm restraining the tests to geometric concerns.

@SDLBugzilla SDLBugzilla added the enhancement label Feb 10, 2021
Copy link

@icculus icculus commented Nov 30, 2021

We added triangles in 2.0.18 from a different patch. Closing this one.

@icculus icculus closed this as completed Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants