ReactOS 0.4.15-dev-8422-g6219a1a
triangle.h File Reference
#include "types.h"
Include dependency graph for triangle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void gl_set_triangle_function (GLcontext *ctx)
 

Function Documentation

◆ gl_set_triangle_function()

void gl_set_triangle_function ( GLcontext ctx)

Definition at line 708 of file triangle.c.

709{
710 GLboolean rgbmode = ctx->Visual->RGBAflag;
711
712 if (ctx->RenderMode==GL_RENDER) {
713 if (ctx->NoRaster) {
714 ctx->Driver.TriangleFunc = null_triangle;
715 return;
716 }
717 if (ctx->Driver.TriangleFunc) {
718 /* Device driver will draw triangles. */
719 }
720 else if (ctx->Texture.Enabled
721 && ctx->Texture.Current
722 && ctx->Texture.Current->Complete) {
723 if ( (ctx->Texture.Enabled==TEXTURE_2D)
724 && ctx->Texture.Current2D->MinFilter==GL_NEAREST
725 && ctx->Texture.Current2D->MagFilter==GL_NEAREST
726 && ctx->Texture.Current2D->WrapS==GL_REPEAT
727 && ctx->Texture.Current2D->WrapT==GL_REPEAT
728 && ctx->Texture.Current2D->Image[0]->Format==GL_RGB
729 && ctx->Texture.Current2D->Image[0]->Border==0
730 && (ctx->Texture.EnvMode==GL_DECAL
731 || ctx->Texture.EnvMode==GL_REPLACE)
732 && ctx->Hint.PerspectiveCorrection==GL_FASTEST
733 && ctx->TextureMatrixType==MATRIX_IDENTITY
734 && ((ctx->RasterMask==DEPTH_BIT
735 && ctx->Depth.Func==GL_LESS
736 && ctx->Depth.Mask==GL_TRUE)
737 || ctx->RasterMask==0)
738 && ctx->Polygon.StippleFlag==GL_FALSE
739 && ctx->Visual->EightBitColor) {
740 if (ctx->RasterMask==DEPTH_BIT) {
741 ctx->Driver.TriangleFunc = simple_z_textured_triangle;
742 }
743 else {
744 ctx->Driver.TriangleFunc = simple_textured_triangle;
745 }
746 }
747 else {
748 GLboolean needLambda = GL_TRUE;
749 /* if mag filter == min filter we're not mipmapping */
750 if (ctx->Texture.Enabled & TEXTURE_2D) {
751 if (ctx->Texture.Current2D->MinFilter==
752 ctx->Texture.Current2D->MagFilter) {
753 needLambda = GL_FALSE;
754 }
755 }
756 else if (ctx->Texture.Enabled & TEXTURE_1D) {
757 if (ctx->Texture.Current1D->MinFilter==
758 ctx->Texture.Current1D->MagFilter) {
759 needLambda = GL_FALSE;
760 }
761 }
762 if (needLambda)
763 ctx->Driver.TriangleFunc = lambda_textured_triangle;
764 else
765 ctx->Driver.TriangleFunc = general_textured_triangle;
766 }
767 }
768 else {
769 if (ctx->Light.ShadeModel==GL_SMOOTH) {
770 /* smooth shaded, no texturing, stippled or some raster ops */
771 if (rgbmode)
772 ctx->Driver.TriangleFunc = smooth_rgba_triangle;
773 else
774 ctx->Driver.TriangleFunc = smooth_ci_triangle;
775 }
776 else {
777 /* flat shaded, no texturing, stippled or some raster ops */
778 if (rgbmode)
779 ctx->Driver.TriangleFunc = flat_rgba_triangle;
780 else
781 ctx->Driver.TriangleFunc = flat_ci_triangle;
782 }
783 }
784 }
785 else if (ctx->RenderMode==GL_FEEDBACK) {
786 ctx->Driver.TriangleFunc = feedback_triangle;
787 }
788 else {
789 /* GL_SELECT mode */
790 ctx->Driver.TriangleFunc = select_triangle;
791 }
792}
#define TEXTURE_1D
Definition: types.h:894
#define DEPTH_BIT
Definition: types.h:1217
#define TEXTURE_2D
Definition: types.h:895
#define MATRIX_IDENTITY
Definition: types.h:1243
#define GL_RENDER
Definition: gl.h:388
#define GL_TRUE
Definition: gl.h:174
#define GL_FASTEST
Definition: gl.h:584
#define GL_LESS
Definition: gl.h:294
#define GL_SMOOTH
Definition: gl.h:339
#define GL_FEEDBACK
Definition: gl.h:387
#define GL_RGB
Definition: gl.h:502
#define GL_NEAREST
Definition: gl.h:678
#define GL_DECAL
Definition: gl.h:676
#define GL_REPEAT
Definition: gl.h:679
#define GL_FALSE
Definition: gl.h:173
#define GL_REPLACE
Definition: gl.h:460
unsigned char GLboolean
Definition: gl.h:151
static void flat_rgba_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:285
static void smooth_rgba_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:324
static void simple_textured_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:365
static void flat_ci_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:220
static void feedback_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:145
static void simple_z_textured_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:412
static void null_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:697
static void smooth_ci_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:254
static void lambda_textured_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:592
static void select_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:205
static void general_textured_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:471

Referenced by gl_update_state().