ReactOS  0.4.14-dev-376-gaedba84
texstate.h File Reference
#include "types.h"
Include dependency graph for texstate.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void gl_GetTexEnvfv (GLcontext *ctx, GLenum target, GLenum pname, GLfloat *params)
 
void gl_GetTexEnviv (GLcontext *ctx, GLenum target, GLenum pname, GLint *params)
 
void gl_GetTexGendv (GLcontext *ctx, GLenum coord, GLenum pname, GLdouble *params)
 
void gl_GetTexGenfv (GLcontext *ctx, GLenum coord, GLenum pname, GLfloat *params)
 
void gl_GetTexGeniv (GLcontext *ctx, GLenum coord, GLenum pname, GLint *params)
 
void gl_GetTexLevelParameterfv (GLcontext *ctx, GLenum target, GLint level, GLenum pname, GLfloat *params)
 
void gl_GetTexLevelParameteriv (GLcontext *ctx, GLenum target, GLint level, GLenum pname, GLint *params)
 
void gl_GetTexParameterfv (GLcontext *ctx, GLenum target, GLenum pname, GLfloat *params)
 
void gl_GetTexParameteriv (GLcontext *ctx, GLenum target, GLenum pname, GLint *params)
 
void gl_TexEnvfv (GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param)
 
void gl_TexParameterfv (GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *params)
 
void gl_TexGenfv (GLcontext *ctx, GLenum coord, GLenum pname, const GLfloat *params)
 
void gl_update_texture_state (GLcontext *ctx)
 

Function Documentation

◆ gl_GetTexEnvfv()

void gl_GetTexEnvfv ( GLcontext ctx,
GLenum  target,
GLenum  pname,
GLfloat params 
)

Definition at line 138 of file texstate.c.

140 {
141  if (target!=GL_TEXTURE_ENV) {
142  gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
143  return;
144  }
145  switch (pname) {
146  case GL_TEXTURE_ENV_MODE:
147  *params = ENUM_TO_FLOAT(ctx->Texture.EnvMode);
148  break;
150  COPY_4V( params, ctx->Texture.EnvColor );
151  break;
152  default:
153  gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
154  }
155 }
GLenum pname
Definition: glext.h:5645
GLenum const GLfloat * params
Definition: glext.h:5645
struct gl_texture_attrib Texture
Definition: types.h:1334
#define GL_TEXTURE_ENV_MODE
Definition: gl.h:643
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_TEXTURE_ENV
Definition: gl.h:642
#define GL_INVALID_ENUM
Definition: gl.h:694
GLenum target
Definition: glext.h:7315
#define ENUM_TO_FLOAT(X)
Definition: texstate.c:79
#define COPY_4V(DST, SRC)
Definition: macros.h:102
#define GL_TEXTURE_ENV_COLOR
Definition: gl.h:650

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_GetTexEnviv()

void gl_GetTexEnviv ( GLcontext ctx,
GLenum  target,
GLenum  pname,
GLint params 
)

Definition at line 158 of file texstate.c.

160 {
161  if (target!=GL_TEXTURE_ENV) {
162  gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
163  return;
164  }
165  switch (pname) {
166  case GL_TEXTURE_ENV_MODE:
167  *params = (GLint) ctx->Texture.EnvMode;
168  break;
170  params[0] = FLOAT_TO_INT( ctx->Texture.EnvColor[0] );
171  params[1] = FLOAT_TO_INT( ctx->Texture.EnvColor[1] );
172  params[2] = FLOAT_TO_INT( ctx->Texture.EnvColor[2] );
173  params[3] = FLOAT_TO_INT( ctx->Texture.EnvColor[3] );
174  break;
175  default:
176  gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
177  }
178 }
GLenum pname
Definition: glext.h:5645
GLenum const GLfloat * params
Definition: glext.h:5645
struct gl_texture_attrib Texture
Definition: types.h:1334
#define FLOAT_TO_INT(X)
Definition: macros.h:222
#define GL_TEXTURE_ENV_MODE
Definition: gl.h:643
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_TEXTURE_ENV
Definition: gl.h:642
#define GL_INVALID_ENUM
Definition: gl.h:694
GLenum target
Definition: glext.h:7315
int GLint
Definition: gl.h:156
#define GL_TEXTURE_ENV_COLOR
Definition: gl.h:650

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_GetTexGendv()

void gl_GetTexGendv ( GLcontext ctx,
GLenum  coord,
GLenum  pname,
GLdouble params 
)

Definition at line 732 of file texstate.c.

734 {
735  if (INSIDE_BEGIN_END(ctx)) {
736  gl_error( ctx, GL_INVALID_OPERATION, "glGetTexGendv" );
737  return;
738  }
739 
740  switch( coord ) {
741  case GL_S:
742  if (pname==GL_TEXTURE_GEN_MODE) {
743  params[0] = ENUM_TO_DOUBLE(ctx->Texture.GenModeS);
744  }
745  else if (pname==GL_OBJECT_PLANE) {
746  COPY_4V( params, ctx->Texture.ObjectPlaneS );
747  }
748  else if (pname==GL_EYE_PLANE) {
749  COPY_4V( params, ctx->Texture.EyePlaneS );
750  }
751  else {
752  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
753  return;
754  }
755  break;
756  case GL_T:
757  if (pname==GL_TEXTURE_GEN_MODE) {
758  params[0] = ENUM_TO_DOUBLE(ctx->Texture.GenModeT);
759  }
760  else if (pname==GL_OBJECT_PLANE) {
761  COPY_4V( params, ctx->Texture.ObjectPlaneT );
762  }
763  else if (pname==GL_EYE_PLANE) {
764  COPY_4V( params, ctx->Texture.EyePlaneT );
765  }
766  else {
767  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
768  return;
769  }
770  break;
771  case GL_R:
772  if (pname==GL_TEXTURE_GEN_MODE) {
773  params[0] = ENUM_TO_DOUBLE(ctx->Texture.GenModeR);
774  }
775  else if (pname==GL_OBJECT_PLANE) {
776  COPY_4V( params, ctx->Texture.ObjectPlaneR );
777  }
778  else if (pname==GL_EYE_PLANE) {
779  COPY_4V( params, ctx->Texture.EyePlaneR );
780  }
781  else {
782  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
783  return;
784  }
785  break;
786  case GL_Q:
787  if (pname==GL_TEXTURE_GEN_MODE) {
788  params[0] = ENUM_TO_DOUBLE(ctx->Texture.GenModeQ);
789  }
790  else if (pname==GL_OBJECT_PLANE) {
791  COPY_4V( params, ctx->Texture.ObjectPlaneQ );
792  }
793  else if (pname==GL_EYE_PLANE) {
794  COPY_4V( params, ctx->Texture.EyePlaneQ );
795  }
796  else {
797  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
798  return;
799  }
800  break;
801  default:
802  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)" );
803  return;
804  }
805 }
#define GL_TEXTURE_GEN_MODE
Definition: gl.h:655
#define GL_S
Definition: gl.h:681
#define GL_EYE_PLANE
Definition: gl.h:674
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
GLuint coord
Definition: glext.h:9511
GLenum pname
Definition: glext.h:5645
GLenum const GLfloat * params
Definition: glext.h:5645
#define GL_OBJECT_PLANE
Definition: gl.h:672
#define GL_Q
Definition: gl.h:684
struct gl_texture_attrib Texture
Definition: types.h:1334
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define ENUM_TO_DOUBLE(X)
Definition: texstate.c:80
#define GL_T
Definition: gl.h:682
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_R
Definition: gl.h:683
#define COPY_4V(DST, SRC)
Definition: macros.h:102

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_GetTexGenfv()

void gl_GetTexGenfv ( GLcontext ctx,
GLenum  coord,
GLenum  pname,
GLfloat params 
)

Definition at line 809 of file texstate.c.

811 {
812  if (INSIDE_BEGIN_END(ctx)) {
813  gl_error( ctx, GL_INVALID_OPERATION, "glGetTexGenfv" );
814  return;
815  }
816 
817  switch( coord ) {
818  case GL_S:
819  if (pname==GL_TEXTURE_GEN_MODE) {
820  params[0] = ENUM_TO_FLOAT(ctx->Texture.GenModeS);
821  }
822  else if (pname==GL_OBJECT_PLANE) {
823  COPY_4V( params, ctx->Texture.ObjectPlaneS );
824  }
825  else if (pname==GL_EYE_PLANE) {
826  COPY_4V( params, ctx->Texture.EyePlaneS );
827  }
828  else {
829  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
830  return;
831  }
832  break;
833  case GL_T:
834  if (pname==GL_TEXTURE_GEN_MODE) {
835  params[0] = ENUM_TO_FLOAT(ctx->Texture.GenModeT);
836  }
837  else if (pname==GL_OBJECT_PLANE) {
838  COPY_4V( params, ctx->Texture.ObjectPlaneT );
839  }
840  else if (pname==GL_EYE_PLANE) {
841  COPY_4V( params, ctx->Texture.EyePlaneT );
842  }
843  else {
844  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
845  return;
846  }
847  break;
848  case GL_R:
849  if (pname==GL_TEXTURE_GEN_MODE) {
850  params[0] = ENUM_TO_FLOAT(ctx->Texture.GenModeR);
851  }
852  else if (pname==GL_OBJECT_PLANE) {
853  COPY_4V( params, ctx->Texture.ObjectPlaneR );
854  }
855  else if (pname==GL_EYE_PLANE) {
856  COPY_4V( params, ctx->Texture.EyePlaneR );
857  }
858  else {
859  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
860  return;
861  }
862  break;
863  case GL_Q:
864  if (pname==GL_TEXTURE_GEN_MODE) {
865  params[0] = ENUM_TO_FLOAT(ctx->Texture.GenModeQ);
866  }
867  else if (pname==GL_OBJECT_PLANE) {
868  COPY_4V( params, ctx->Texture.ObjectPlaneQ );
869  }
870  else if (pname==GL_EYE_PLANE) {
871  COPY_4V( params, ctx->Texture.EyePlaneQ );
872  }
873  else {
874  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
875  return;
876  }
877  break;
878  default:
879  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)" );
880  return;
881  }
882 }
#define GL_TEXTURE_GEN_MODE
Definition: gl.h:655
#define GL_S
Definition: gl.h:681
#define GL_EYE_PLANE
Definition: gl.h:674
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
GLuint coord
Definition: glext.h:9511
GLenum pname
Definition: glext.h:5645
GLenum const GLfloat * params
Definition: glext.h:5645
#define GL_OBJECT_PLANE
Definition: gl.h:672
#define GL_Q
Definition: gl.h:684
struct gl_texture_attrib Texture
Definition: types.h:1334
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_T
Definition: gl.h:682
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_R
Definition: gl.h:683
#define ENUM_TO_FLOAT(X)
Definition: texstate.c:79
#define COPY_4V(DST, SRC)
Definition: macros.h:102

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_GetTexGeniv()

void gl_GetTexGeniv ( GLcontext ctx,
GLenum  coord,
GLenum  pname,
GLint params 
)

Definition at line 886 of file texstate.c.

888 {
889  if (INSIDE_BEGIN_END(ctx)) {
890  gl_error( ctx, GL_INVALID_OPERATION, "glGetTexGeniv" );
891  return;
892  }
893 
894  switch( coord ) {
895  case GL_S:
896  if (pname==GL_TEXTURE_GEN_MODE) {
897  params[0] = ctx->Texture.GenModeS;
898  }
899  else if (pname==GL_OBJECT_PLANE) {
900  COPY_4V( params, ctx->Texture.ObjectPlaneS );
901  }
902  else if (pname==GL_EYE_PLANE) {
903  COPY_4V( params, ctx->Texture.EyePlaneS );
904  }
905  else {
906  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
907  return;
908  }
909  break;
910  case GL_T:
911  if (pname==GL_TEXTURE_GEN_MODE) {
912  params[0] = ctx->Texture.GenModeT;
913  }
914  else if (pname==GL_OBJECT_PLANE) {
915  COPY_4V( params, ctx->Texture.ObjectPlaneT );
916  }
917  else if (pname==GL_EYE_PLANE) {
918  COPY_4V( params, ctx->Texture.EyePlaneT );
919  }
920  else {
921  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
922  return;
923  }
924  break;
925  case GL_R:
926  if (pname==GL_TEXTURE_GEN_MODE) {
927  params[0] = ctx->Texture.GenModeR;
928  }
929  else if (pname==GL_OBJECT_PLANE) {
930  COPY_4V( params, ctx->Texture.ObjectPlaneR );
931  }
932  else if (pname==GL_EYE_PLANE) {
933  COPY_4V( params, ctx->Texture.EyePlaneR );
934  }
935  else {
936  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
937  return;
938  }
939  break;
940  case GL_Q:
941  if (pname==GL_TEXTURE_GEN_MODE) {
942  params[0] = ctx->Texture.GenModeQ;
943  }
944  else if (pname==GL_OBJECT_PLANE) {
945  COPY_4V( params, ctx->Texture.ObjectPlaneQ );
946  }
947  else if (pname==GL_EYE_PLANE) {
948  COPY_4V( params, ctx->Texture.EyePlaneQ );
949  }
950  else {
951  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
952  return;
953  }
954  break;
955  default:
956  gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)" );
957  return;
958  }
959 }
#define GL_TEXTURE_GEN_MODE
Definition: gl.h:655
#define GL_S
Definition: gl.h:681
#define GL_EYE_PLANE
Definition: gl.h:674
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
GLuint coord
Definition: glext.h:9511
GLenum pname
Definition: glext.h:5645
GLenum const GLfloat * params
Definition: glext.h:5645
#define GL_OBJECT_PLANE
Definition: gl.h:672
#define GL_Q
Definition: gl.h:684
struct gl_texture_attrib Texture
Definition: types.h:1334
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_T
Definition: gl.h:682
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_R
Definition: gl.h:683
#define COPY_4V(DST, SRC)
Definition: macros.h:102

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_GetTexLevelParameterfv()

void gl_GetTexLevelParameterfv ( GLcontext ctx,
GLenum  target,
GLint  level,
GLenum  pname,
GLfloat params 
)

Definition at line 278 of file texstate.c.

280 {
281  GLint iparam;
282 
283  gl_GetTexLevelParameteriv( ctx, target, level, pname, &iparam );
284  *params = (GLfloat) iparam;
285 }
GLint level
Definition: gl.h:1546
GLenum pname
Definition: glext.h:5645
GLenum const GLfloat * params
Definition: glext.h:5645
float GLfloat
Definition: gl.h:161
GLenum target
Definition: glext.h:7315
int GLint
Definition: gl.h:156
void gl_GetTexLevelParameteriv(GLcontext *ctx, GLenum target, GLint level, GLenum pname, GLint *params)
Definition: texstate.c:289

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_GetTexLevelParameteriv()

void gl_GetTexLevelParameteriv ( GLcontext ctx,
GLenum  target,
GLint  level,
GLenum  pname,
GLint params 
)

Definition at line 289 of file texstate.c.

291 {
292  struct gl_texture_image *tex;
293 
295  gl_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" );
296  return;
297  }
298 
299  switch (target) {
300  case GL_TEXTURE_1D:
301  tex = ctx->Texture.Current1D->Image[level];
302  switch (pname) {
303  case GL_TEXTURE_WIDTH:
304  *params = tex->Width;
305  break;
307  *params = tex->Format;
308  break;
309  case GL_TEXTURE_BORDER:
310  *params = tex->Border;
311  break;
312  case GL_TEXTURE_RED_SIZE:
318  *params = 8; /* 8-bits */
319  break;
321  *params = 8;
322  break;
323  default:
325  "glGetTexLevelParameter[if]v(pname)" );
326  }
327  break;
328  case GL_TEXTURE_2D:
329  tex = ctx->Texture.Current2D->Image[level];
330  switch (pname) {
331  case GL_TEXTURE_WIDTH:
332  *params = tex->Width;
333  break;
334  case GL_TEXTURE_HEIGHT:
335  *params = tex->Height;
336  break;
338  *params = tex->Format;
339  break;
340  case GL_TEXTURE_BORDER:
341  *params = tex->Border;
342  break;
343  case GL_TEXTURE_RED_SIZE:
349  *params = 8; /* 8-bits */
350  break;
352  *params = 8;
353  break;
354  default:
356  "glGetTexLevelParameter[if]v(pname)" );
357  }
358  break;
359  case GL_PROXY_TEXTURE_1D:
360  tex = ctx->Texture.Proxy1D->Image[level];
361  switch (pname) {
362  case GL_TEXTURE_WIDTH:
363  *params = tex->Width;
364  break;
366  *params = tex->Format;
367  break;
368  case GL_TEXTURE_BORDER:
369  *params = tex->Border;
370  break;
371  case GL_TEXTURE_RED_SIZE:
377  *params = 8; /* 8-bits */
378  break;
380  *params = 8;
381  break;
382  default:
384  "glGetTexLevelParameter[if]v(pname)" );
385  }
386  break;
387  case GL_PROXY_TEXTURE_2D:
388  tex = ctx->Texture.Proxy2D->Image[level];
389  switch (pname) {
390  case GL_TEXTURE_WIDTH:
391  *params = tex->Width;
392  break;
393  case GL_TEXTURE_HEIGHT:
394  *params = tex->Height;
395  break;
397  *params = tex->Format;
398  break;
399  case GL_TEXTURE_BORDER:
400  *params = tex->Border;
401  break;
402  case GL_TEXTURE_RED_SIZE:
408  *params = 8; /* 8-bits */
409  break;
411  *params = 8;
412  break;
413  default:
415  "glGetTexLevelParameter[if]v(pname)" );
416  }
417  break;
418  default:
419  gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)");
420  }
421 }
GLint level
Definition: gl.h:1546
#define GL_PROXY_TEXTURE_2D
Definition: gl.h:727
#define GL_TEXTURE_ALPHA_SIZE
Definition: gl.h:664
#define GL_TEXTURE_BLUE_SIZE
Definition: gl.h:663
GLuint Width
Definition: types.h:296
#define GL_TEXTURE_LUMINANCE_SIZE
Definition: gl.h:665
#define GL_TEXTURE_INTENSITY_SIZE
Definition: gl.h:666
GLenum pname
Definition: glext.h:5645
#define GL_TEXTURE_GREEN_SIZE
Definition: gl.h:662
#define GL_TEXTURE_BORDER
Definition: gl.h:659
GLuint Height
Definition: types.h:297
GLenum const GLfloat * params
Definition: glext.h:5645
#define GL_TEXTURE_1D
Definition: gl.h:644
#define GL_TEXTURE_HEIGHT
Definition: gl.h:658
struct gl_texture_attrib Texture
Definition: types.h:1334
GLuint Border
Definition: types.h:295
#define GL_PROXY_TEXTURE_1D
Definition: gl.h:726
#define GL_TEXTURE_WIDTH
Definition: gl.h:657
#define GL_INVALID_VALUE
Definition: gl.h:695
#define GL_TEXTURE_COMPONENTS
Definition: gl.h:660
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_TEXTURE_2D
Definition: gl.h:645
GLenum Format
Definition: types.h:290
#define GL_TEXTURE_INDEX_SIZE_EXT
Definition: glext.h:2967
#define GL_TEXTURE_RED_SIZE
Definition: gl.h:661
GLenum target
Definition: glext.h:7315
#define MAX_TEXTURE_LEVELS
Definition: config.h:90

Referenced by gl_GetTexLevelParameterfv(), init_dlist_pointers(), and init_exec_pointers().

◆ gl_GetTexParameterfv()

void gl_GetTexParameterfv ( GLcontext ctx,
GLenum  target,
GLenum  pname,
GLfloat params 
)

Definition at line 426 of file texstate.c.

428 {
429  switch (target) {
430  case GL_TEXTURE_1D:
431  switch (pname) {
433  *params = ENUM_TO_FLOAT(ctx->Texture.Current1D->MagFilter);
434  break;
436  *params = ENUM_TO_FLOAT(ctx->Texture.Current1D->MinFilter);
437  break;
438  case GL_TEXTURE_WRAP_S:
439  *params = ENUM_TO_FLOAT(ctx->Texture.Current1D->WrapS);
440  break;
441  case GL_TEXTURE_WRAP_T:
442  *params = ENUM_TO_FLOAT(ctx->Texture.Current1D->WrapT);
443  break;
445  params[0] = ctx->Texture.Current1D->BorderColor[0] / 255.0f;
446  params[1] = ctx->Texture.Current1D->BorderColor[1] / 255.0f;
447  params[2] = ctx->Texture.Current1D->BorderColor[2] / 255.0f;
448  params[3] = ctx->Texture.Current1D->BorderColor[3] / 255.0f;
449  break;
450  case GL_TEXTURE_RESIDENT:
452  break;
453  case GL_TEXTURE_PRIORITY:
454  *params = ctx->Texture.Current1D->Priority;
455  break;
456  default:
457  gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname)" );
458  }
459  break;
460  case GL_TEXTURE_2D:
461  switch (pname) {
463  *params = ENUM_TO_FLOAT(ctx->Texture.Current2D->MagFilter);
464  break;
466  *params = ENUM_TO_FLOAT(ctx->Texture.Current2D->MinFilter);
467  break;
468  case GL_TEXTURE_WRAP_S:
469  *params = ENUM_TO_FLOAT(ctx->Texture.Current2D->WrapS);
470  break;
471  case GL_TEXTURE_WRAP_T:
472  *params = ENUM_TO_FLOAT(ctx->Texture.Current2D->WrapT);
473  break;
475  params[0] = ctx->Texture.Current2D->BorderColor[0] / 255.0f;
476  params[1] = ctx->Texture.Current2D->BorderColor[1] / 255.0f;
477  params[2] = ctx->Texture.Current2D->BorderColor[2] / 255.0f;
478  params[3] = ctx->Texture.Current2D->BorderColor[3] / 255.0f;
479  break;
480  case GL_TEXTURE_RESIDENT:
482  break;
483  case GL_TEXTURE_PRIORITY:
484  *params = ctx->Texture.Current2D->Priority;
485  break;
486  default:
487  gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname)" );
488  }
489  break;
490  default:
491  gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)" );
492  }
493 }
#define GL_TEXTURE_RESIDENT
Definition: gl.h:729
GLenum pname
Definition: glext.h:5645
GLenum const GLfloat * params
Definition: glext.h:5645
#define GL_TEXTURE_1D
Definition: gl.h:644
#define GL_TEXTURE_WRAP_T
Definition: gl.h:647
#define GL_TEXTURE_MIN_FILTER
Definition: gl.h:649
struct gl_texture_attrib Texture
Definition: types.h:1334
#define GL_TEXTURE_WRAP_S
Definition: gl.h:646
#define GL_TEXTURE_PRIORITY
Definition: gl.h:728
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_TEXTURE_MAG_FILTER
Definition: gl.h:648
#define GL_TRUE
Definition: gl.h:174
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_TEXTURE_BORDER_COLOR
Definition: gl.h:656
#define GL_TEXTURE_2D
Definition: gl.h:645
GLenum target
Definition: glext.h:7315
#define ENUM_TO_FLOAT(X)
Definition: texstate.c:79

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_GetTexParameteriv()

void gl_GetTexParameteriv ( GLcontext ctx,
GLenum  target,
GLenum  pname,
GLint params 
)

Definition at line 496 of file texstate.c.

498 {
499  switch (target) {
500  case GL_TEXTURE_1D:
501  switch (pname) {
503  *params = (GLint) ctx->Texture.Current1D->MagFilter;
504  break;
506  *params = (GLint) ctx->Texture.Current1D->MinFilter;
507  break;
508  case GL_TEXTURE_WRAP_S:
509  *params = (GLint) ctx->Texture.Current1D->WrapS;
510  break;
511  case GL_TEXTURE_WRAP_T:
512  *params = (GLint) ctx->Texture.Current1D->WrapT;
513  break;
515  {
516  GLfloat color[4];
517  color[0] = ctx->Texture.Current1D->BorderColor[0]/255.0;
518  color[1] = ctx->Texture.Current1D->BorderColor[1]/255.0;
519  color[2] = ctx->Texture.Current1D->BorderColor[2]/255.0;
520  color[3] = ctx->Texture.Current1D->BorderColor[3]/255.0;
521  params[0] = FLOAT_TO_INT( color[0] );
522  params[1] = FLOAT_TO_INT( color[1] );
523  params[2] = FLOAT_TO_INT( color[2] );
524  params[3] = FLOAT_TO_INT( color[3] );
525  }
526  break;
527  case GL_TEXTURE_RESIDENT:
528  *params = (GLint) GL_TRUE;
529  break;
530  case GL_TEXTURE_PRIORITY:
531  *params = (GLint) ctx->Texture.Current1D->Priority;
532  break;
533  default:
534  gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname)" );
535  }
536  break;
537  case GL_TEXTURE_2D:
538  switch (pname) {
540  *params = (GLint) ctx->Texture.Current2D->MagFilter;
541  break;
543  *params = (GLint) ctx->Texture.Current2D->MinFilter;
544  break;
545  case GL_TEXTURE_WRAP_S:
546  *params = (GLint) ctx->Texture.Current2D->WrapS;
547  break;
548  case GL_TEXTURE_WRAP_T:
549  *params = (GLint) ctx->Texture.Current2D->WrapT;
550  break;
552  {
553  GLfloat color[4];
554  color[0] = ctx->Texture.Current2D->BorderColor[0]/255.0;
555  color[1] = ctx->Texture.Current2D->BorderColor[1]/255.0;
556  color[2] = ctx->Texture.Current2D->BorderColor[2]/255.0;
557  color[3] = ctx->Texture.Current2D->BorderColor[3]/255.0;
558  params[0] = FLOAT_TO_INT( color[0] );
559  params[1] = FLOAT_TO_INT( color[1] );
560  params[2] = FLOAT_TO_INT( color[2] );
561  params[3] = FLOAT_TO_INT( color[3] );
562  }
563  break;
564  case GL_TEXTURE_RESIDENT:
565  *params = (GLint) GL_TRUE;
566  break;
567  case GL_TEXTURE_PRIORITY:
568  *params = (GLint) ctx->Texture.Current2D->Priority;
569  break;
570  default:
571  gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname)" );
572  }
573  break;
574  default:
575  gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)" );
576  }
577 }
#define GL_TEXTURE_RESIDENT
Definition: gl.h:729
GLenum pname
Definition: glext.h:5645
GLenum const GLfloat * params
Definition: glext.h:5645
#define GL_TEXTURE_1D
Definition: gl.h:644
GLuint color
Definition: glext.h:6243
#define GL_TEXTURE_WRAP_T
Definition: gl.h:647
#define GL_TEXTURE_MIN_FILTER
Definition: gl.h:649
struct gl_texture_attrib Texture
Definition: types.h:1334
#define FLOAT_TO_INT(X)
Definition: macros.h:222
#define GL_TEXTURE_WRAP_S
Definition: gl.h:646
#define GL_TEXTURE_PRIORITY
Definition: gl.h:728
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_TEXTURE_MAG_FILTER
Definition: gl.h:648
#define GL_TRUE
Definition: gl.h:174
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_TEXTURE_BORDER_COLOR
Definition: gl.h:656
#define GL_TEXTURE_2D
Definition: gl.h:645
float GLfloat
Definition: gl.h:161
GLenum target
Definition: glext.h:7315
int GLint
Definition: gl.h:156

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_TexEnvfv()

void gl_TexEnvfv ( GLcontext ctx,
GLenum  target,
GLenum  pname,
const GLfloat param 
)

Definition at line 90 of file texstate.c.

92 {
93  if (INSIDE_BEGIN_END(ctx)) {
94  gl_error( ctx, GL_INVALID_OPERATION, "glTexEnv" );
95  return;
96  }
97 
98  if (target!=GL_TEXTURE_ENV) {
99  gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
100  return;
101  }
102 
103  if (pname==GL_TEXTURE_ENV_MODE) {
104  GLenum mode = (GLenum) (GLint) *param;
105  switch (mode) {
106  case GL_MODULATE:
107  case GL_BLEND:
108  case GL_DECAL:
109  case GL_REPLACE:
110  ctx->Texture.EnvMode = mode;
111  break;
112  default:
113  gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
114  return;
115  }
116  }
117  else if (pname==GL_TEXTURE_ENV_COLOR) {
118  ctx->Texture.EnvColor[0] = CLAMP( param[0], 0.0, 1.0 );
119  ctx->Texture.EnvColor[1] = CLAMP( param[1], 0.0, 1.0 );
120  ctx->Texture.EnvColor[2] = CLAMP( param[2], 0.0, 1.0 );
121  ctx->Texture.EnvColor[3] = CLAMP( param[3], 0.0, 1.0 );
122  }
123  else {
124  gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
125  return;
126  }
127 
128  /* Tell device driver about the new texture environment */
129  if (ctx->Driver.TexEnv) {
130  (*ctx->Driver.TexEnv)( ctx, pname, param );
131  }
132 }
#define GL_MODULATE
Definition: gl.h:677
#define GL_BLEND
Definition: gl.h:371
#define GL_DECAL
Definition: gl.h:676
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
GLenum pname
Definition: glext.h:5645
struct dd_function_table Driver
Definition: types.h:1276
#define CLAMP(f, min, max)
Definition: tif_color.c:177
struct gl_texture_attrib Texture
Definition: types.h:1334
#define GL_TEXTURE_ENV_MODE
Definition: gl.h:643
GLfloat param
Definition: glext.h:5796
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_REPLACE
Definition: gl.h:460
unsigned int GLenum
Definition: gl.h:150
GLenum mode
Definition: glext.h:6217
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_TEXTURE_ENV
Definition: gl.h:642
#define GL_INVALID_ENUM
Definition: gl.h:694
GLenum target
Definition: glext.h:7315
int GLint
Definition: gl.h:156
#define GL_TEXTURE_ENV_COLOR
Definition: gl.h:650

Referenced by execute_list(), and init_exec_pointers().

◆ gl_TexGenfv()

void gl_TexGenfv ( GLcontext ctx,
GLenum  coord,
GLenum  pname,
const GLfloat params 
)

Definition at line 587 of file texstate.c.

589 {
590  if (INSIDE_BEGIN_END(ctx)) {
591  gl_error( ctx, GL_INVALID_OPERATION, "glTexGenfv" );
592  return;
593  }
594 
595  switch( coord ) {
596  case GL_S:
597  if (pname==GL_TEXTURE_GEN_MODE) {
598  GLenum mode = (GLenum) (GLint) *params;
599  if (mode==GL_OBJECT_LINEAR ||
600  mode==GL_EYE_LINEAR ||
601  mode==GL_SPHERE_MAP) {
602  ctx->Texture.GenModeS = mode;
603  }
604  else {
605  gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
606  return;
607  }
608  }
609  else if (pname==GL_OBJECT_PLANE) {
610  ctx->Texture.ObjectPlaneS[0] = params[0];
611  ctx->Texture.ObjectPlaneS[1] = params[1];
612  ctx->Texture.ObjectPlaneS[2] = params[2];
613  ctx->Texture.ObjectPlaneS[3] = params[3];
614  }
615  else if (pname==GL_EYE_PLANE) {
616  /* Transform plane equation by the inverse modelview matrix */
617  if (ctx->NewModelViewMatrix) {
619  }
620  gl_transform_vector( ctx->Texture.EyePlaneS, params,
621  ctx->ModelViewInv );
622  }
623  else {
624  gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
625  return;
626  }
627  break;
628  case GL_T:
629  if (pname==GL_TEXTURE_GEN_MODE) {
630  GLenum mode = (GLenum) (GLint) *params;
631  if (mode==GL_OBJECT_LINEAR ||
632  mode==GL_EYE_LINEAR ||
633  mode==GL_SPHERE_MAP) {
634  ctx->Texture.GenModeT = mode;
635  }
636  else {
637  gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
638  return;
639  }
640  }
641  else if (pname==GL_OBJECT_PLANE) {
642  ctx->Texture.ObjectPlaneT[0] = params[0];
643  ctx->Texture.ObjectPlaneT[1] = params[1];
644  ctx->Texture.ObjectPlaneT[2] = params[2];
645  ctx->Texture.ObjectPlaneT[3] = params[3];
646  }
647  else if (pname==GL_EYE_PLANE) {
648  /* Transform plane equation by the inverse modelview matrix */
649  if (ctx->NewModelViewMatrix) {
651  }
652  gl_transform_vector( ctx->Texture.EyePlaneT, params,
653  ctx->ModelViewInv );
654  }
655  else {
656  gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
657  return;
658  }
659  break;
660  case GL_R:
661  if (pname==GL_TEXTURE_GEN_MODE) {
662  GLenum mode = (GLenum) (GLint) *params;
663  if (mode==GL_OBJECT_LINEAR ||
664  mode==GL_EYE_LINEAR) {
665  ctx->Texture.GenModeR = mode;
666  }
667  else {
668  gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
669  return;
670  }
671  }
672  else if (pname==GL_OBJECT_PLANE) {
673  ctx->Texture.ObjectPlaneR[0] = params[0];
674  ctx->Texture.ObjectPlaneR[1] = params[1];
675  ctx->Texture.ObjectPlaneR[2] = params[2];
676  ctx->Texture.ObjectPlaneR[3] = params[3];
677  }
678  else if (pname==GL_EYE_PLANE) {
679  /* Transform plane equation by the inverse modelview matrix */
680  if (ctx->NewModelViewMatrix) {
682  }
683  gl_transform_vector( ctx->Texture.EyePlaneR, params,
684  ctx->ModelViewInv );
685  }
686  else {
687  gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
688  return;
689  }
690  break;
691  case GL_Q:
692  if (pname==GL_TEXTURE_GEN_MODE) {
693  GLenum mode = (GLenum) (GLint) *params;
694  if (mode==GL_OBJECT_LINEAR ||
695  mode==GL_EYE_LINEAR) {
696  ctx->Texture.GenModeQ = mode;
697  }
698  else {
699  gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
700  return;
701  }
702  }
703  else if (pname==GL_OBJECT_PLANE) {
704  ctx->Texture.ObjectPlaneQ[0] = params[0];
705  ctx->Texture.ObjectPlaneQ[1] = params[1];
706  ctx->Texture.ObjectPlaneQ[2] = params[2];
707  ctx->Texture.ObjectPlaneQ[3] = params[3];
708  }
709  else if (pname==GL_EYE_PLANE) {
710  /* Transform plane equation by the inverse modelview matrix */
711  if (ctx->NewModelViewMatrix) {
713  }
714  gl_transform_vector( ctx->Texture.EyePlaneQ, params,
715  ctx->ModelViewInv );
716  }
717  else {
718  gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
719  return;
720  }
721  break;
722  default:
723  gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" );
724  return;
725  }
726 
727  ctx->NewState |= NEW_TEXTURING;
728 }
#define GL_TEXTURE_GEN_MODE
Definition: gl.h:655
GLuint NewState
Definition: types.h:1355
#define GL_S
Definition: gl.h:681
GLboolean NewModelViewMatrix
Definition: types.h:1282
#define GL_EYE_PLANE
Definition: gl.h:674
void gl_transform_vector(GLfloat u[4], const GLfloat v[4], const GLfloat m[16])
Definition: xform.c:248
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
GLuint coord
Definition: glext.h:9511
GLenum pname
Definition: glext.h:5645
GLenum const GLfloat * params
Definition: glext.h:5645
#define GL_OBJECT_PLANE
Definition: gl.h:672
#define GL_Q
Definition: gl.h:684
#define GL_EYE_LINEAR
Definition: gl.h:673
struct gl_texture_attrib Texture
Definition: types.h:1334
#define NEW_TEXTURING
Definition: types.h:1234
GLfloat ModelViewInv[16]
Definition: types.h:1285
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_T
Definition: gl.h:682
unsigned int GLenum
Definition: gl.h:150
GLenum mode
Definition: glext.h:6217
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_OBJECT_LINEAR
Definition: gl.h:671
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_R
Definition: gl.h:683
void gl_analyze_modelview_matrix(GLcontext *ctx)
Definition: matrix.c:420
int GLint
Definition: gl.h:156
#define GL_SPHERE_MAP
Definition: gl.h:675

Referenced by execute_list(), and init_exec_pointers().

◆ gl_TexParameterfv()

void gl_TexParameterfv ( GLcontext ctx,
GLenum  target,
GLenum  pname,
const GLfloat params 
)

Definition at line 188 of file texstate.c.

190 {
191  GLenum eparam = (GLenum) (GLint) params[0];
192  struct gl_texture_object *texObj;
193 
194  switch (target) {
195  case GL_TEXTURE_1D:
196  texObj = ctx->Texture.Current1D;
197  break;
198  case GL_TEXTURE_2D:
199  texObj = ctx->Texture.Current2D;
200  break;
201  default:
202  gl_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
203  return;
204  }
205 
206  switch (pname) {
208  if (eparam==GL_NEAREST || eparam==GL_LINEAR
209  || eparam==GL_NEAREST_MIPMAP_NEAREST
210  || eparam==GL_LINEAR_MIPMAP_NEAREST
211  || eparam==GL_NEAREST_MIPMAP_LINEAR
212  || eparam==GL_LINEAR_MIPMAP_LINEAR) {
213  texObj->MinFilter = eparam;
214  ctx->NewState |= NEW_TEXTURING;
215  }
216  else {
217  gl_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
218  return;
219  }
220  break;
222  if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
223  texObj->MagFilter = eparam;
224  ctx->NewState |= NEW_TEXTURING;
225  }
226  else {
227  gl_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
228  return;
229  }
230  break;
231  case GL_TEXTURE_WRAP_S:
232  if (eparam==GL_CLAMP || eparam==GL_REPEAT) {
233  texObj->WrapS = eparam;
234  }
235  else {
236  gl_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
237  return;
238  }
239  break;
240  case GL_TEXTURE_WRAP_T:
241  if (eparam==GL_CLAMP || eparam==GL_REPEAT) {
242  texObj->WrapT = eparam;
243  }
244  else {
245  gl_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
246  return;
247  }
248  break;
250  if (eparam==GL_CLAMP || eparam==GL_REPEAT) {
251  texObj->WrapR = eparam;
252  }
253  else {
254  gl_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
255  }
256  break;
258  texObj->BorderColor[0] = CLAMP((GLint)(params[0]*255.0), 0, 255);
259  texObj->BorderColor[1] = CLAMP((GLint)(params[1]*255.0), 0, 255);
260  texObj->BorderColor[2] = CLAMP((GLint)(params[2]*255.0), 0, 255);
261  texObj->BorderColor[3] = CLAMP((GLint)(params[3]*255.0), 0, 255);
262  break;
263  default:
264  gl_error( ctx, GL_INVALID_ENUM, "glTexParameter(pname)" );
265  return;
266  }
267 
268  texObj->Dirty = GL_TRUE;
269  ctx->Texture.AnyDirty = GL_TRUE;
270 
271  if (ctx->Driver.TexParameter) {
272  (*ctx->Driver.TexParameter)( ctx, target, texObj, pname, params );
273  }
274 }
GLint BorderColor[4]
Definition: types.h:1093
GLuint NewState
Definition: types.h:1355
GLenum WrapR
Definition: types.h:1096
#define GL_NEAREST
Definition: gl.h:678
#define GL_NEAREST_MIPMAP_NEAREST
Definition: gl.h:667
#define GL_REPEAT
Definition: gl.h:679
GLenum WrapT
Definition: types.h:1095
GLenum MagFilter
Definition: types.h:1098
GLenum WrapS
Definition: types.h:1094
GLenum pname
Definition: glext.h:5645
struct dd_function_table Driver
Definition: types.h:1276
GLenum const GLfloat * params
Definition: glext.h:5645
#define GL_TEXTURE_1D
Definition: gl.h:644
#define GL_NEAREST_MIPMAP_LINEAR
Definition: gl.h:668
#define CLAMP(f, min, max)
Definition: tif_color.c:177
#define GL_TEXTURE_WRAP_T
Definition: gl.h:647
#define GL_TEXTURE_MIN_FILTER
Definition: gl.h:649
struct gl_texture_attrib Texture
Definition: types.h:1334
#define NEW_TEXTURING
Definition: types.h:1234
GLboolean Dirty
Definition: types.h:1109
#define GL_TEXTURE_WRAP_S
Definition: gl.h:646
GLenum MinFilter
Definition: types.h:1097
#define GL_LINEAR
Definition: gl.h:421
#define GL_INVALID_VALUE
Definition: gl.h:695
unsigned int GLenum
Definition: gl.h:150
#define GL_TEXTURE_WRAP_R_EXT
Definition: glext.h:2474
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_TEXTURE_MAG_FILTER
Definition: gl.h:648
#define GL_TRUE
Definition: gl.h:174
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_TEXTURE_BORDER_COLOR
Definition: gl.h:656
#define GL_LINEAR_MIPMAP_LINEAR
Definition: gl.h:670
#define GL_TEXTURE_2D
Definition: gl.h:645
#define GL_LINEAR_MIPMAP_NEAREST
Definition: gl.h:669
GLenum target
Definition: glext.h:7315
int GLint
Definition: gl.h:156
#define GL_CLAMP
Definition: gl.h:680

Referenced by execute_list(), and init_exec_pointers().

◆ gl_update_texture_state()

void gl_update_texture_state ( GLcontext ctx)

Definition at line 967 of file texstate.c.

968 {
969  struct gl_texture_object *t;
970 
971  if (ctx->Texture.Enabled & TEXTURE_2D)
972  ctx->Texture.Current = ctx->Texture.Current2D;
973  else if (ctx->Texture.Enabled & TEXTURE_1D)
974  ctx->Texture.Current = ctx->Texture.Current1D;
975  else
976  ctx->Texture.Current = NULL;
977 
978  if (ctx->Texture.AnyDirty) {
979  for (t = ctx->Shared->TexObjectList; t; t = t->Next) {
980  if (t->Dirty) {
983  t->Dirty = GL_FALSE;
984  }
985  }
986  ctx->Texture.AnyDirty = GL_FALSE;
987  }
988 }
#define GL_FALSE
Definition: gl.h:173
#define TEXTURE_2D
Definition: types.h:895
GLdouble GLdouble t
Definition: gl.h:2047
void gl_test_texture_object_completeness(struct gl_texture_object *t)
Definition: texobj.c:215
smooth NULL
Definition: ftsmooth.c:416
struct gl_texture_attrib Texture
Definition: types.h:1334
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] STATPROPSETSTG *rgelt, [out] ULONG *pceltFetched)
#define TEXTURE_1D
Definition: types.h:894
struct gl_shared_state * Shared
Definition: types.h:1265
void gl_set_texture_sampler(struct gl_texture_object *t)
Definition: texture.c:1319

Referenced by gl_update_state().