Skip to content
NightFox edited this page Mar 5, 2023 · 3 revisions

From HL SDK 2.0

Triangle API

One of the changes to the client .dll code has been the addition of a basic triangle API through which MOD authors can generate and render textured triangles from the client .dll.

The relevant functionality can be found in the cl_dll/tri.cpp file. The only segregation of triangles occurs between triangles that require transparency and opaque triangles. A sample of drawing and texturing a couple of simple triangles exists in the #ifdef'd code in tri.cpp.

The triangle API is defined in common\triangleapi.h and is accessed in the client .dll by calling into gEngfuncs.pTriAPI->.

The triangle API supports setting the rendering mode for the triangle, framing the rendering with Begin and End calls, Setting the color of the polygon, if untextured, specifying vertex and texture coordinate values, specifying a brightness value, setting the face culling state, and loading a sprite ( .spr file ) as a texture for the triangles. The following parameters can be passed to the Begin function:

TRI_TRIANGLES		
TRI_TRIANGLE_FAN		
TRI_QUADS			
TRI_POLYGON			
TRI_LINES			
TRI_TRIANGLE_STRIP		
TRI_QUAD_STRIP		

These APIs are supported in both the software and hardware renderer.


In fact, the api has already been extended.