ReactOS  0.4.14-dev-297-g23e575c
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
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 }
static void null_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:697
#define GL_FASTEST
Definition: gl.h:584
static void feedback_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:145
static void simple_textured_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:365
#define GL_FALSE
Definition: gl.h:173
#define TEXTURE_2D
Definition: types.h:895
#define GL_NEAREST
Definition: gl.h:678
GLboolean RGBAflag
Definition: types.h:1137
static void select_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:205
struct gl_polygon_attrib Polygon
Definition: types.h:1330
#define GL_REPEAT
Definition: gl.h:679
#define GL_DECAL
Definition: gl.h:676
GLvisual * Visual
Definition: types.h:1272
GLuint TextureMatrixType
Definition: types.h:1299
#define GL_SMOOTH
Definition: gl.h:339
#define DEPTH_BIT
Definition: types.h:1217
#define GL_LESS
Definition: gl.h:294
GLuint RasterMask
Definition: types.h:1361
struct dd_function_table Driver
Definition: types.h:1276
static void simple_z_textured_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:412
unsigned char GLboolean
Definition: gl.h:151
GLenum RenderMode
Definition: types.h:1356
struct gl_texture_attrib Texture
Definition: types.h:1334
GLboolean NoRaster
Definition: types.h:1404
static void flat_ci_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:220
GLboolean EightBitColor
Definition: types.h:1146
static void smooth_ci_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:254
#define GL_RGB
Definition: gl.h:502
#define GL_REPLACE
Definition: gl.h:460
#define TEXTURE_1D
Definition: types.h:894
static void flat_rgba_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:285
struct gl_hint_attrib Hint
Definition: types.h:1324
struct gl_depthbuffer_attrib Depth
Definition: types.h:1321
static void lambda_textured_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:592
#define GL_FEEDBACK
Definition: gl.h:387
#define GL_TRUE
Definition: gl.h:174
static void general_textured_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:471
#define GL_RENDER
Definition: gl.h:388
static void smooth_rgba_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
Definition: triangle.c:324
struct gl_light_attrib Light
Definition: types.h:1325
#define MATRIX_IDENTITY
Definition: types.h:1243

Referenced by gl_update_state().