⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 colortab.c

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 C
📖 第 1 页 / 共 3 页
字号:
   if (pname == GL_COLOR_TABLE_SCALE_SGI) {      COPY_4V(scale, params);   }   else if (pname == GL_COLOR_TABLE_BIAS_SGI) {      COPY_4V(bias, params);   }   else {      _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");      return;   }   ctx->NewState |= _NEW_PIXEL;}void GLAPIENTRY_mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params){   GLfloat fparams[4];   if (pname == GL_COLOR_TABLE_SGI ||       pname == GL_TEXTURE_COLOR_TABLE_SGI ||       pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||       pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) {      /* four values */      fparams[0] = (GLfloat) params[0];      fparams[1] = (GLfloat) params[1];      fparams[2] = (GLfloat) params[2];      fparams[3] = (GLfloat) params[3];   }   else {      /* one values */      fparams[0] = (GLfloat) params[0];   }   _mesa_ColorTableParameterfv(target, pname, fparams);}void GLAPIENTRY_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ){   GET_CURRENT_CONTEXT(ctx);   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];   struct gl_color_table *table = NULL;   ASSERT_OUTSIDE_BEGIN_END(ctx);   switch (target) {      case GL_SHARED_TEXTURE_PALETTE_EXT:         table = &ctx->Texture.Palette;         break;      case GL_COLOR_TABLE:         table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];         if (pname == GL_COLOR_TABLE_SCALE_SGI) {            COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION]);            return;         }         else if (pname == GL_COLOR_TABLE_BIAS_SGI) {            COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION]);            return;         }         break;      case GL_PROXY_COLOR_TABLE:         table = &ctx->ProxyColorTable[COLORTABLE_PRECONVOLUTION];         break;      case GL_TEXTURE_COLOR_TABLE_SGI:         if (!ctx->Extensions.SGI_texture_color_table) {            _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");            return;         }         table = &(texUnit->ColorTable);         if (pname == GL_COLOR_TABLE_SCALE_SGI) {            COPY_4V(params, ctx->Pixel.TextureColorTableScale);            return;         }         else if (pname == GL_COLOR_TABLE_BIAS_SGI) {            COPY_4V(params, ctx->Pixel.TextureColorTableBias);            return;         }         break;      case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:         if (!ctx->Extensions.SGI_texture_color_table) {            _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");            return;         }         table = &(texUnit->ProxyColorTable);         break;      case GL_POST_CONVOLUTION_COLOR_TABLE:         table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];         if (pname == GL_COLOR_TABLE_SCALE_SGI) {            COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION]);            return;         }         else if (pname == GL_COLOR_TABLE_BIAS_SGI) {            COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION]);            return;         }         break;      case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:         table = &ctx->ProxyColorTable[COLORTABLE_POSTCONVOLUTION];         break;      case GL_POST_COLOR_MATRIX_COLOR_TABLE:         table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];         if (pname == GL_COLOR_TABLE_SCALE_SGI) {            COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX]);            return;         }         else if (pname == GL_COLOR_TABLE_BIAS_SGI) {            COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX]);            return;         }         break;      case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:         table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX];         break;      default:         /* try texture targets */         {            struct gl_texture_object *texobj               = _mesa_select_tex_object(ctx, texUnit, target);            if (texobj) {               table = &texobj->Palette;            }            else {               _mesa_error(ctx, GL_INVALID_ENUM,                           "glGetColorTableParameterfv(target)");               return;            }         }   }   assert(table);   switch (pname) {      case GL_COLOR_TABLE_FORMAT:         *params = (GLfloat) table->InternalFormat;         break;      case GL_COLOR_TABLE_WIDTH:         *params = (GLfloat) table->Size;         break;      case GL_COLOR_TABLE_RED_SIZE:         *params = (GLfloat) table->RedSize;         break;      case GL_COLOR_TABLE_GREEN_SIZE:         *params = (GLfloat) table->GreenSize;         break;      case GL_COLOR_TABLE_BLUE_SIZE:         *params = (GLfloat) table->BlueSize;         break;      case GL_COLOR_TABLE_ALPHA_SIZE:         *params = (GLfloat) table->AlphaSize;         break;      case GL_COLOR_TABLE_LUMINANCE_SIZE:         *params = (GLfloat) table->LuminanceSize;         break;      case GL_COLOR_TABLE_INTENSITY_SIZE:         *params = (GLfloat) table->IntensitySize;         break;      default:         _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(pname)" );         return;   }}void GLAPIENTRY_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ){   GET_CURRENT_CONTEXT(ctx);   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];   struct gl_color_table *table = NULL;   ASSERT_OUTSIDE_BEGIN_END(ctx);   switch (target) {      case GL_SHARED_TEXTURE_PALETTE_EXT:         table = &ctx->Texture.Palette;         break;      case GL_COLOR_TABLE:         table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];         if (pname == GL_COLOR_TABLE_SCALE_SGI) {            GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION];            params[0] = (GLint) scale[0];            params[1] = (GLint) scale[1];            params[2] = (GLint) scale[2];            params[3] = (GLint) scale[3];            return;         }         else if (pname == GL_COLOR_TABLE_BIAS_SGI) {            GLfloat *bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION];            params[0] = (GLint) bias[0];            params[1] = (GLint) bias[1];            params[2] = (GLint) bias[2];            params[3] = (GLint) bias[3];            return;         }         break;      case GL_PROXY_COLOR_TABLE:         table = &ctx->ProxyColorTable[COLORTABLE_PRECONVOLUTION];         break;      case GL_TEXTURE_COLOR_TABLE_SGI:         if (!ctx->Extensions.SGI_texture_color_table) {            _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");            return;         }         table = &(texUnit->ColorTable);         if (pname == GL_COLOR_TABLE_SCALE_SGI) {            params[0] = (GLint) ctx->Pixel.TextureColorTableScale[0];            params[1] = (GLint) ctx->Pixel.TextureColorTableScale[1];            params[2] = (GLint) ctx->Pixel.TextureColorTableScale[2];            params[3] = (GLint) ctx->Pixel.TextureColorTableScale[3];            return;         }         else if (pname == GL_COLOR_TABLE_BIAS_SGI) {            params[0] = (GLint) ctx->Pixel.TextureColorTableBias[0];            params[1] = (GLint) ctx->Pixel.TextureColorTableBias[1];            params[2] = (GLint) ctx->Pixel.TextureColorTableBias[2];            params[3] = (GLint) ctx->Pixel.TextureColorTableBias[3];            return;         }         break;      case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:         if (!ctx->Extensions.SGI_texture_color_table) {            _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");            return;         }         table = &(texUnit->ProxyColorTable);         break;      case GL_POST_CONVOLUTION_COLOR_TABLE:         table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];         if (pname == GL_COLOR_TABLE_SCALE_SGI) {            GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION];            params[0] = (GLint) scale[0];            params[1] = (GLint) scale[1];            params[2] = (GLint) scale[2];            params[3] = (GLint) scale[3];            return;         }         else if (pname == GL_COLOR_TABLE_BIAS_SGI) {            GLfloat *bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION];            params[0] = (GLint) bias[0];            params[1] = (GLint) bias[1];            params[2] = (GLint) bias[2];            params[3] = (GLint) bias[3];            return;         }         break;      case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:         table = &ctx->ProxyColorTable[COLORTABLE_POSTCONVOLUTION];         break;      case GL_POST_COLOR_MATRIX_COLOR_TABLE:         table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];         if (pname == GL_COLOR_TABLE_SCALE_SGI) {            GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX];            params[0] = (GLint) scale[0];            params[0] = (GLint) scale[1];            params[0] = (GLint) scale[2];            params[0] = (GLint) scale[3];            return;         }         else if (pname == GL_COLOR_TABLE_BIAS_SGI) {            GLfloat *bias = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX];            params[0] = (GLint) bias[0];            params[1] = (GLint) bias[1];            params[2] = (GLint) bias[2];            params[3] = (GLint) bias[3];            return;         }         break;      case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:         table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX];         break;      default:         /* Try texture targets */         {            struct gl_texture_object *texobj               = _mesa_select_tex_object(ctx, texUnit, target);            if (texobj) {               table = &texobj->Palette;            }            else {               _mesa_error(ctx, GL_INVALID_ENUM,                           "glGetColorTableParameteriv(target)");               return;            }         }   }   assert(table);   switch (pname) {      case GL_COLOR_TABLE_FORMAT:         *params = table->InternalFormat;         break;      case GL_COLOR_TABLE_WIDTH:         *params = table->Size;         break;      case GL_COLOR_TABLE_RED_SIZE:         *params = table->RedSize;         break;      case GL_COLOR_TABLE_GREEN_SIZE:         *params = table->GreenSize;         break;      case GL_COLOR_TABLE_BLUE_SIZE:         *params = table->BlueSize;         break;      case GL_COLOR_TABLE_ALPHA_SIZE:         *params = table->AlphaSize;         break;      case GL_COLOR_TABLE_LUMINANCE_SIZE:         *params = table->LuminanceSize;         break;      case GL_COLOR_TABLE_INTENSITY_SIZE:         *params = table->IntensitySize;         break;      default:         _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(pname)" );         return;   }}/**********************************************************************//*****                      Initialization                        *****//**********************************************************************/void_mesa_init_colortable( struct gl_color_table *p ){   p->TableF = NULL;   p->TableUB = NULL;   p->Size = 0;   p->InternalFormat = GL_RGBA;}void_mesa_free_colortable_data( struct gl_color_table *p ){   if (p->TableF) {      _mesa_free(p->TableF);      p->TableF = NULL;   }   if (p->TableUB) {      _mesa_free(p->TableUB);      p->TableUB = NULL;   }}/* * Initialize all colortables for a context. */void_mesa_init_colortables( GLcontext * ctx ){   GLuint i;   for (i = 0; i < COLORTABLE_MAX; i++) {      _mesa_init_colortable(&ctx->ColorTable[i]);      _mesa_init_colortable(&ctx->ProxyColorTable[i]);   }}/* * Free all colortable data for a context */void_mesa_free_colortables_data( GLcontext *ctx ){   GLuint i;   for (i = 0; i < COLORTABLE_MAX; i++) {      _mesa_free_colortable_data(&ctx->ColorTable[i]);      _mesa_free_colortable_data(&ctx->ProxyColorTable[i]);   }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -