1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Mesa 3-D graphics library 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. 5bf215546Sopenharmony_ci * Copyright (C) 2009 VMware, Inc. All Rights Reserved. 6bf215546Sopenharmony_ci * 7bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 8bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 9bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 10bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 12bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be included 15bf215546Sopenharmony_ci * in all copies or substantial portions of the Software. 16bf215546Sopenharmony_ci * 17bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21bf215546Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22bf215546Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23bf215546Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 24bf215546Sopenharmony_ci */ 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci/** 27bf215546Sopenharmony_ci * \file texgen.c 28bf215546Sopenharmony_ci * 29bf215546Sopenharmony_ci * glTexGen-related functions 30bf215546Sopenharmony_ci */ 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ci 33bf215546Sopenharmony_ci#include "main/glheader.h" 34bf215546Sopenharmony_ci#include "main/context.h" 35bf215546Sopenharmony_ci#include "main/enums.h" 36bf215546Sopenharmony_ci#include "main/macros.h" 37bf215546Sopenharmony_ci#include "main/texparam.h" 38bf215546Sopenharmony_ci#include "main/texstate.h" 39bf215546Sopenharmony_ci#include "math/m_matrix.h" 40bf215546Sopenharmony_ci#include "main/texobj.h" 41bf215546Sopenharmony_ci#include "api_exec_decl.h" 42bf215546Sopenharmony_ci 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_ci/** 45bf215546Sopenharmony_ci * Return texgen state for given coordinate 46bf215546Sopenharmony_ci */ 47bf215546Sopenharmony_cistatic struct gl_texgen * 48bf215546Sopenharmony_ciget_texgen(struct gl_context *ctx, GLuint texunitIndex, GLenum coord, const char* caller) 49bf215546Sopenharmony_ci{ 50bf215546Sopenharmony_ci struct gl_fixedfunc_texture_unit* texUnit; 51bf215546Sopenharmony_ci if (texunitIndex >= ctx->Const.MaxTextureCoordUnits) { 52bf215546Sopenharmony_ci _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unit=%d)", caller, texunitIndex); 53bf215546Sopenharmony_ci return NULL; 54bf215546Sopenharmony_ci } 55bf215546Sopenharmony_ci 56bf215546Sopenharmony_ci texUnit = _mesa_get_fixedfunc_tex_unit(ctx, texunitIndex); 57bf215546Sopenharmony_ci 58bf215546Sopenharmony_ci if (ctx->API == API_OPENGLES) { 59bf215546Sopenharmony_ci return (coord == GL_TEXTURE_GEN_STR_OES) 60bf215546Sopenharmony_ci ? &texUnit->GenS : NULL; 61bf215546Sopenharmony_ci } 62bf215546Sopenharmony_ci 63bf215546Sopenharmony_ci switch (coord) { 64bf215546Sopenharmony_ci case GL_S: 65bf215546Sopenharmony_ci return &texUnit->GenS; 66bf215546Sopenharmony_ci case GL_T: 67bf215546Sopenharmony_ci return &texUnit->GenT; 68bf215546Sopenharmony_ci case GL_R: 69bf215546Sopenharmony_ci return &texUnit->GenR; 70bf215546Sopenharmony_ci case GL_Q: 71bf215546Sopenharmony_ci return &texUnit->GenQ; 72bf215546Sopenharmony_ci default: 73bf215546Sopenharmony_ci return NULL; 74bf215546Sopenharmony_ci } 75bf215546Sopenharmony_ci} 76bf215546Sopenharmony_ci 77bf215546Sopenharmony_ci 78bf215546Sopenharmony_ci/* Helper for glTexGenfv and glMultiTexGenfvEXT functions */ 79bf215546Sopenharmony_cistatic void 80bf215546Sopenharmony_citexgenfv( GLuint texunitIndex, GLenum coord, GLenum pname, 81bf215546Sopenharmony_ci const GLfloat *params, const char* caller ) 82bf215546Sopenharmony_ci{ 83bf215546Sopenharmony_ci struct gl_texgen *texgen; 84bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 85bf215546Sopenharmony_ci 86bf215546Sopenharmony_ci texgen = get_texgen(ctx, texunitIndex, coord, caller); 87bf215546Sopenharmony_ci if (!texgen) { 88bf215546Sopenharmony_ci _mesa_error(ctx, GL_INVALID_ENUM, "%s(coord)", caller); 89bf215546Sopenharmony_ci return; 90bf215546Sopenharmony_ci } 91bf215546Sopenharmony_ci 92bf215546Sopenharmony_ci struct gl_fixedfunc_texture_unit *unit = &ctx->Texture.FixedFuncUnit[texunitIndex]; 93bf215546Sopenharmony_ci int index = coord == GL_TEXTURE_GEN_STR_OES ? 0 : (coord - GL_S); 94bf215546Sopenharmony_ci 95bf215546Sopenharmony_ci switch (pname) { 96bf215546Sopenharmony_ci case GL_TEXTURE_GEN_MODE: 97bf215546Sopenharmony_ci { 98bf215546Sopenharmony_ci GLenum mode = (GLenum) (GLint) params[0]; 99bf215546Sopenharmony_ci GLbitfield bit = 0x0; 100bf215546Sopenharmony_ci if (texgen->Mode == mode) 101bf215546Sopenharmony_ci return; 102bf215546Sopenharmony_ci switch (mode) { 103bf215546Sopenharmony_ci case GL_OBJECT_LINEAR: 104bf215546Sopenharmony_ci bit = TEXGEN_OBJ_LINEAR; 105bf215546Sopenharmony_ci break; 106bf215546Sopenharmony_ci case GL_EYE_LINEAR: 107bf215546Sopenharmony_ci bit = TEXGEN_EYE_LINEAR; 108bf215546Sopenharmony_ci break; 109bf215546Sopenharmony_ci case GL_SPHERE_MAP: 110bf215546Sopenharmony_ci if (coord == GL_S || coord == GL_T) 111bf215546Sopenharmony_ci bit = TEXGEN_SPHERE_MAP; 112bf215546Sopenharmony_ci break; 113bf215546Sopenharmony_ci case GL_REFLECTION_MAP_NV: 114bf215546Sopenharmony_ci if (coord != GL_Q) 115bf215546Sopenharmony_ci bit = TEXGEN_REFLECTION_MAP_NV; 116bf215546Sopenharmony_ci break; 117bf215546Sopenharmony_ci case GL_NORMAL_MAP_NV: 118bf215546Sopenharmony_ci if (coord != GL_Q) 119bf215546Sopenharmony_ci bit = TEXGEN_NORMAL_MAP_NV; 120bf215546Sopenharmony_ci break; 121bf215546Sopenharmony_ci default: 122bf215546Sopenharmony_ci ; /* nop */ 123bf215546Sopenharmony_ci } 124bf215546Sopenharmony_ci if (!bit) { 125bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); 126bf215546Sopenharmony_ci return; 127bf215546Sopenharmony_ci } 128bf215546Sopenharmony_ci if (ctx->API != API_OPENGL_COMPAT 129bf215546Sopenharmony_ci && (bit & (TEXGEN_REFLECTION_MAP_NV | TEXGEN_NORMAL_MAP_NV)) == 0) { 130bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); 131bf215546Sopenharmony_ci return; 132bf215546Sopenharmony_ci } 133bf215546Sopenharmony_ci 134bf215546Sopenharmony_ci FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE | _NEW_FF_VERT_PROGRAM, 135bf215546Sopenharmony_ci GL_TEXTURE_BIT); 136bf215546Sopenharmony_ci texgen->Mode = mode; 137bf215546Sopenharmony_ci texgen->_ModeBit = bit; 138bf215546Sopenharmony_ci } 139bf215546Sopenharmony_ci break; 140bf215546Sopenharmony_ci 141bf215546Sopenharmony_ci case GL_OBJECT_PLANE: 142bf215546Sopenharmony_ci { 143bf215546Sopenharmony_ci if (ctx->API != API_OPENGL_COMPAT) { 144bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); 145bf215546Sopenharmony_ci return; 146bf215546Sopenharmony_ci } 147bf215546Sopenharmony_ci if (TEST_EQ_4V(unit->ObjectPlane[index], params)) 148bf215546Sopenharmony_ci return; 149bf215546Sopenharmony_ci FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); 150bf215546Sopenharmony_ci COPY_4FV(unit->ObjectPlane[index], params); 151bf215546Sopenharmony_ci } 152bf215546Sopenharmony_ci break; 153bf215546Sopenharmony_ci 154bf215546Sopenharmony_ci case GL_EYE_PLANE: 155bf215546Sopenharmony_ci { 156bf215546Sopenharmony_ci GLfloat tmp[4]; 157bf215546Sopenharmony_ci 158bf215546Sopenharmony_ci if (ctx->API != API_OPENGL_COMPAT) { 159bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); 160bf215546Sopenharmony_ci return; 161bf215546Sopenharmony_ci } 162bf215546Sopenharmony_ci 163bf215546Sopenharmony_ci /* Transform plane equation by the inverse modelview matrix */ 164bf215546Sopenharmony_ci if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { 165bf215546Sopenharmony_ci _math_matrix_analyse(ctx->ModelviewMatrixStack.Top); 166bf215546Sopenharmony_ci } 167bf215546Sopenharmony_ci _mesa_transform_vector(tmp, params, 168bf215546Sopenharmony_ci ctx->ModelviewMatrixStack.Top->inv); 169bf215546Sopenharmony_ci if (TEST_EQ_4V(unit->EyePlane[index], tmp)) 170bf215546Sopenharmony_ci return; 171bf215546Sopenharmony_ci FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); 172bf215546Sopenharmony_ci COPY_4FV(unit->EyePlane[index], tmp); 173bf215546Sopenharmony_ci } 174bf215546Sopenharmony_ci break; 175bf215546Sopenharmony_ci 176bf215546Sopenharmony_ci default: 177bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); 178bf215546Sopenharmony_ci return; 179bf215546Sopenharmony_ci } 180bf215546Sopenharmony_ci} 181bf215546Sopenharmony_ci 182bf215546Sopenharmony_ci 183bf215546Sopenharmony_ci/* Helper for glGetTexGendv / glGetMultiTexGendvEXT */ 184bf215546Sopenharmony_cistatic void 185bf215546Sopenharmony_cigettexgendv( GLuint texunitIndex, GLenum coord, GLenum pname, 186bf215546Sopenharmony_ci GLdouble *params, const char* caller) 187bf215546Sopenharmony_ci{ 188bf215546Sopenharmony_ci struct gl_texgen *texgen; 189bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 190bf215546Sopenharmony_ci 191bf215546Sopenharmony_ci texgen = get_texgen(ctx, texunitIndex, coord, caller); 192bf215546Sopenharmony_ci if (!texgen) { 193bf215546Sopenharmony_ci _mesa_error(ctx, GL_INVALID_ENUM, "%s(coord)", caller); 194bf215546Sopenharmony_ci return; 195bf215546Sopenharmony_ci } 196bf215546Sopenharmony_ci 197bf215546Sopenharmony_ci struct gl_fixedfunc_texture_unit *unit = &ctx->Texture.FixedFuncUnit[texunitIndex]; 198bf215546Sopenharmony_ci int index = coord == GL_TEXTURE_GEN_STR_OES ? 0 : (coord - GL_S); 199bf215546Sopenharmony_ci 200bf215546Sopenharmony_ci switch (pname) { 201bf215546Sopenharmony_ci case GL_TEXTURE_GEN_MODE: 202bf215546Sopenharmony_ci params[0] = ENUM_TO_DOUBLE(texgen->Mode); 203bf215546Sopenharmony_ci break; 204bf215546Sopenharmony_ci case GL_OBJECT_PLANE: 205bf215546Sopenharmony_ci COPY_4V(params, unit->ObjectPlane[index]); 206bf215546Sopenharmony_ci break; 207bf215546Sopenharmony_ci case GL_EYE_PLANE: 208bf215546Sopenharmony_ci COPY_4V(params, unit->EyePlane[index]); 209bf215546Sopenharmony_ci break; 210bf215546Sopenharmony_ci default: 211bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "%s(pname)", caller ); 212bf215546Sopenharmony_ci } 213bf215546Sopenharmony_ci} 214bf215546Sopenharmony_ci 215bf215546Sopenharmony_ci 216bf215546Sopenharmony_ci/* Helper for glGetTexGenfv / glGetMultiTexGenfvEXT */ 217bf215546Sopenharmony_cistatic void 218bf215546Sopenharmony_cigettexgenfv( GLenum texunitIndex, GLenum coord, GLenum pname, 219bf215546Sopenharmony_ci GLfloat *params, const char* caller ) 220bf215546Sopenharmony_ci{ 221bf215546Sopenharmony_ci struct gl_texgen *texgen; 222bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 223bf215546Sopenharmony_ci 224bf215546Sopenharmony_ci texgen = get_texgen(ctx, texunitIndex, coord, caller); 225bf215546Sopenharmony_ci if (!texgen) { 226bf215546Sopenharmony_ci _mesa_error(ctx, GL_INVALID_ENUM, "%s(coord)", caller); 227bf215546Sopenharmony_ci return; 228bf215546Sopenharmony_ci } 229bf215546Sopenharmony_ci 230bf215546Sopenharmony_ci struct gl_fixedfunc_texture_unit *unit = &ctx->Texture.FixedFuncUnit[texunitIndex]; 231bf215546Sopenharmony_ci int index = coord == GL_TEXTURE_GEN_STR_OES ? 0 : (coord - GL_S); 232bf215546Sopenharmony_ci 233bf215546Sopenharmony_ci switch (pname) { 234bf215546Sopenharmony_ci case GL_TEXTURE_GEN_MODE: 235bf215546Sopenharmony_ci params[0] = ENUM_TO_FLOAT(texgen->Mode); 236bf215546Sopenharmony_ci break; 237bf215546Sopenharmony_ci case GL_OBJECT_PLANE: 238bf215546Sopenharmony_ci if (ctx->API != API_OPENGL_COMPAT) { 239bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "%s(param)", caller ); 240bf215546Sopenharmony_ci return; 241bf215546Sopenharmony_ci } 242bf215546Sopenharmony_ci COPY_4V(params, unit->ObjectPlane[index]); 243bf215546Sopenharmony_ci break; 244bf215546Sopenharmony_ci case GL_EYE_PLANE: 245bf215546Sopenharmony_ci if (ctx->API != API_OPENGL_COMPAT) { 246bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "%s(param)", caller ); 247bf215546Sopenharmony_ci return; 248bf215546Sopenharmony_ci } 249bf215546Sopenharmony_ci COPY_4V(params, unit->EyePlane[index]); 250bf215546Sopenharmony_ci break; 251bf215546Sopenharmony_ci default: 252bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "%s(pname)", caller ); 253bf215546Sopenharmony_ci } 254bf215546Sopenharmony_ci} 255bf215546Sopenharmony_ci 256bf215546Sopenharmony_ci 257bf215546Sopenharmony_ci/* Helper for glGetTexGeniv / glGetMultiTexGenivEXT */ 258bf215546Sopenharmony_cistatic void 259bf215546Sopenharmony_cigettexgeniv( GLenum texunitIndex, GLenum coord, GLenum pname, 260bf215546Sopenharmony_ci GLint *params, const char* caller) 261bf215546Sopenharmony_ci{ 262bf215546Sopenharmony_ci struct gl_texgen *texgen; 263bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 264bf215546Sopenharmony_ci 265bf215546Sopenharmony_ci texgen = get_texgen(ctx, texunitIndex, coord, caller); 266bf215546Sopenharmony_ci if (!texgen) { 267bf215546Sopenharmony_ci _mesa_error(ctx, GL_INVALID_ENUM, "%s(coord)", caller); 268bf215546Sopenharmony_ci return; 269bf215546Sopenharmony_ci } 270bf215546Sopenharmony_ci 271bf215546Sopenharmony_ci struct gl_fixedfunc_texture_unit *unit = &ctx->Texture.FixedFuncUnit[texunitIndex]; 272bf215546Sopenharmony_ci int index = coord == GL_TEXTURE_GEN_STR_OES ? 0 : (coord - GL_S); 273bf215546Sopenharmony_ci 274bf215546Sopenharmony_ci switch (pname) { 275bf215546Sopenharmony_ci case GL_TEXTURE_GEN_MODE: 276bf215546Sopenharmony_ci params[0] = texgen->Mode; 277bf215546Sopenharmony_ci break; 278bf215546Sopenharmony_ci case GL_OBJECT_PLANE: 279bf215546Sopenharmony_ci if (ctx->API != API_OPENGL_COMPAT) { 280bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "%s(param)" , caller); 281bf215546Sopenharmony_ci return; 282bf215546Sopenharmony_ci } 283bf215546Sopenharmony_ci params[0] = (GLint) unit->ObjectPlane[index][0]; 284bf215546Sopenharmony_ci params[1] = (GLint) unit->ObjectPlane[index][1]; 285bf215546Sopenharmony_ci params[2] = (GLint) unit->ObjectPlane[index][2]; 286bf215546Sopenharmony_ci params[3] = (GLint) unit->ObjectPlane[index][3]; 287bf215546Sopenharmony_ci break; 288bf215546Sopenharmony_ci case GL_EYE_PLANE: 289bf215546Sopenharmony_ci if (ctx->API != API_OPENGL_COMPAT) { 290bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "%s(param)" , caller); 291bf215546Sopenharmony_ci return; 292bf215546Sopenharmony_ci } 293bf215546Sopenharmony_ci params[0] = (GLint) unit->EyePlane[index][0]; 294bf215546Sopenharmony_ci params[1] = (GLint) unit->EyePlane[index][1]; 295bf215546Sopenharmony_ci params[2] = (GLint) unit->EyePlane[index][2]; 296bf215546Sopenharmony_ci params[3] = (GLint) unit->EyePlane[index][3]; 297bf215546Sopenharmony_ci break; 298bf215546Sopenharmony_ci default: 299bf215546Sopenharmony_ci _mesa_error( ctx, GL_INVALID_ENUM, "%s(pname)" , caller); 300bf215546Sopenharmony_ci } 301bf215546Sopenharmony_ci} 302bf215546Sopenharmony_ci 303bf215546Sopenharmony_ci 304bf215546Sopenharmony_civoid GLAPIENTRY 305bf215546Sopenharmony_ci_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) 306bf215546Sopenharmony_ci{ 307bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 308bf215546Sopenharmony_ci texgenfv(ctx->Texture.CurrentUnit, coord, pname, params, "glTexGenfv"); 309bf215546Sopenharmony_ci} 310bf215546Sopenharmony_ci 311bf215546Sopenharmony_ci 312bf215546Sopenharmony_civoid GLAPIENTRY 313bf215546Sopenharmony_ci_mesa_MultiTexGenfvEXT( GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params ) 314bf215546Sopenharmony_ci{ 315bf215546Sopenharmony_ci texgenfv(texunit - GL_TEXTURE0, coord, pname, params, "glMultiTexGenfvEXT"); 316bf215546Sopenharmony_ci} 317bf215546Sopenharmony_ci 318bf215546Sopenharmony_ci 319bf215546Sopenharmony_civoid GLAPIENTRY 320bf215546Sopenharmony_ci_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) 321bf215546Sopenharmony_ci{ 322bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 323bf215546Sopenharmony_ci GLfloat p[4]; 324bf215546Sopenharmony_ci p[0] = (GLfloat) params[0]; 325bf215546Sopenharmony_ci if (pname == GL_TEXTURE_GEN_MODE) { 326bf215546Sopenharmony_ci p[1] = p[2] = p[3] = 0.0F; 327bf215546Sopenharmony_ci } 328bf215546Sopenharmony_ci else { 329bf215546Sopenharmony_ci p[1] = (GLfloat) params[1]; 330bf215546Sopenharmony_ci p[2] = (GLfloat) params[2]; 331bf215546Sopenharmony_ci p[3] = (GLfloat) params[3]; 332bf215546Sopenharmony_ci } 333bf215546Sopenharmony_ci texgenfv(ctx->Texture.CurrentUnit, coord, pname, p, "glTexGeniv"); 334bf215546Sopenharmony_ci} 335bf215546Sopenharmony_ci 336bf215546Sopenharmony_civoid GLAPIENTRY 337bf215546Sopenharmony_ci_mesa_MultiTexGenivEXT(GLenum texunit, GLenum coord, GLenum pname, const GLint *params ) 338bf215546Sopenharmony_ci{ 339bf215546Sopenharmony_ci GLfloat p[4]; 340bf215546Sopenharmony_ci p[0] = (GLfloat) params[0]; 341bf215546Sopenharmony_ci if (pname == GL_TEXTURE_GEN_MODE) { 342bf215546Sopenharmony_ci p[1] = p[2] = p[3] = 0.0F; 343bf215546Sopenharmony_ci } 344bf215546Sopenharmony_ci else { 345bf215546Sopenharmony_ci p[1] = (GLfloat) params[1]; 346bf215546Sopenharmony_ci p[2] = (GLfloat) params[2]; 347bf215546Sopenharmony_ci p[3] = (GLfloat) params[3]; 348bf215546Sopenharmony_ci } 349bf215546Sopenharmony_ci texgenfv(texunit - GL_TEXTURE0, coord, pname, p, "glMultiTexGenivEXT"); 350bf215546Sopenharmony_ci} 351bf215546Sopenharmony_ci 352bf215546Sopenharmony_ci 353bf215546Sopenharmony_civoid GLAPIENTRY 354bf215546Sopenharmony_ci_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) 355bf215546Sopenharmony_ci{ 356bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 357bf215546Sopenharmony_ci GLfloat p[4]; 358bf215546Sopenharmony_ci p[0] = (GLfloat) param; 359bf215546Sopenharmony_ci p[1] = p[2] = p[3] = 0.0F; 360bf215546Sopenharmony_ci texgenfv(ctx->Texture.CurrentUnit, coord, pname, p, "glTexGend"); 361bf215546Sopenharmony_ci} 362bf215546Sopenharmony_ci 363bf215546Sopenharmony_ci 364bf215546Sopenharmony_civoid GLAPIENTRY 365bf215546Sopenharmony_ci_mesa_MultiTexGendEXT(GLenum texunit, GLenum coord, GLenum pname, GLdouble param ) 366bf215546Sopenharmony_ci{ 367bf215546Sopenharmony_ci GLfloat p[4]; 368bf215546Sopenharmony_ci p[0] = (GLfloat) param; 369bf215546Sopenharmony_ci p[1] = p[2] = p[3] = 0.0F; 370bf215546Sopenharmony_ci texgenfv(texunit - GL_TEXTURE0, coord, pname, p, "glMultiTexGendEXT"); 371bf215546Sopenharmony_ci} 372bf215546Sopenharmony_ci 373bf215546Sopenharmony_ci 374bf215546Sopenharmony_civoid GLAPIENTRY 375bf215546Sopenharmony_ci_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) 376bf215546Sopenharmony_ci{ 377bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 378bf215546Sopenharmony_ci GLfloat p[4]; 379bf215546Sopenharmony_ci p[0] = (GLfloat) params[0]; 380bf215546Sopenharmony_ci if (pname == GL_TEXTURE_GEN_MODE) { 381bf215546Sopenharmony_ci p[1] = p[2] = p[3] = 0.0F; 382bf215546Sopenharmony_ci } 383bf215546Sopenharmony_ci else { 384bf215546Sopenharmony_ci p[1] = (GLfloat) params[1]; 385bf215546Sopenharmony_ci p[2] = (GLfloat) params[2]; 386bf215546Sopenharmony_ci p[3] = (GLfloat) params[3]; 387bf215546Sopenharmony_ci } 388bf215546Sopenharmony_ci texgenfv(ctx->Texture.CurrentUnit, coord, pname, p, "glTexGendv"); 389bf215546Sopenharmony_ci} 390bf215546Sopenharmony_ci 391bf215546Sopenharmony_ci 392bf215546Sopenharmony_civoid GLAPIENTRY 393bf215546Sopenharmony_ci_mesa_MultiTexGendvEXT(GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params ) 394bf215546Sopenharmony_ci{ 395bf215546Sopenharmony_ci GLfloat p[4]; 396bf215546Sopenharmony_ci p[0] = (GLfloat) params[0]; 397bf215546Sopenharmony_ci if (pname == GL_TEXTURE_GEN_MODE) { 398bf215546Sopenharmony_ci p[1] = p[2] = p[3] = 0.0F; 399bf215546Sopenharmony_ci } 400bf215546Sopenharmony_ci else { 401bf215546Sopenharmony_ci p[1] = (GLfloat) params[1]; 402bf215546Sopenharmony_ci p[2] = (GLfloat) params[2]; 403bf215546Sopenharmony_ci p[3] = (GLfloat) params[3]; 404bf215546Sopenharmony_ci } 405bf215546Sopenharmony_ci texgenfv(texunit - GL_TEXTURE0, coord, pname, p, "glMultiTexGendvEXT"); 406bf215546Sopenharmony_ci} 407bf215546Sopenharmony_ci 408bf215546Sopenharmony_ci 409bf215546Sopenharmony_civoid GLAPIENTRY 410bf215546Sopenharmony_ci_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) 411bf215546Sopenharmony_ci{ 412bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 413bf215546Sopenharmony_ci GLfloat p[4]; 414bf215546Sopenharmony_ci p[0] = param; 415bf215546Sopenharmony_ci p[1] = p[2] = p[3] = 0.0F; 416bf215546Sopenharmony_ci texgenfv(ctx->Texture.CurrentUnit, coord, pname, p, "glTexGenf"); 417bf215546Sopenharmony_ci} 418bf215546Sopenharmony_ci 419bf215546Sopenharmony_ci 420bf215546Sopenharmony_civoid GLAPIENTRY 421bf215546Sopenharmony_ci_mesa_MultiTexGenfEXT( GLenum texunit, GLenum coord, GLenum pname, GLfloat param ) 422bf215546Sopenharmony_ci{ 423bf215546Sopenharmony_ci GLfloat p[4]; 424bf215546Sopenharmony_ci p[0] = param; 425bf215546Sopenharmony_ci p[1] = p[2] = p[3] = 0.0F; 426bf215546Sopenharmony_ci texgenfv(texunit - GL_TEXTURE0, coord, pname, p, "glMultiTexGenfEXT"); 427bf215546Sopenharmony_ci} 428bf215546Sopenharmony_ci 429bf215546Sopenharmony_ci 430bf215546Sopenharmony_civoid GLAPIENTRY 431bf215546Sopenharmony_ci_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) 432bf215546Sopenharmony_ci{ 433bf215546Sopenharmony_ci GLint p[4]; 434bf215546Sopenharmony_ci p[0] = param; 435bf215546Sopenharmony_ci p[1] = p[2] = p[3] = 0; 436bf215546Sopenharmony_ci _mesa_TexGeniv( coord, pname, p ); 437bf215546Sopenharmony_ci} 438bf215546Sopenharmony_ci 439bf215546Sopenharmony_ci 440bf215546Sopenharmony_civoid GLAPIENTRY 441bf215546Sopenharmony_ci_mesa_MultiTexGeniEXT( GLenum texunit, GLenum coord, GLenum pname, GLint param ) 442bf215546Sopenharmony_ci{ 443bf215546Sopenharmony_ci GLint p[4]; 444bf215546Sopenharmony_ci p[0] = param; 445bf215546Sopenharmony_ci p[1] = p[2] = p[3] = 0; 446bf215546Sopenharmony_ci _mesa_MultiTexGenivEXT( texunit, coord, pname, p ); 447bf215546Sopenharmony_ci} 448bf215546Sopenharmony_ci 449bf215546Sopenharmony_ci 450bf215546Sopenharmony_civoid GLAPIENTRY 451bf215546Sopenharmony_ci_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) 452bf215546Sopenharmony_ci{ 453bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 454bf215546Sopenharmony_ci gettexgendv(ctx->Texture.CurrentUnit, coord, pname, params, "glGetTexGendv"); 455bf215546Sopenharmony_ci} 456bf215546Sopenharmony_ci 457bf215546Sopenharmony_ci 458bf215546Sopenharmony_civoid GLAPIENTRY 459bf215546Sopenharmony_ci_mesa_GetMultiTexGendvEXT( GLenum texunit, GLenum coord, GLenum pname, GLdouble *params ) 460bf215546Sopenharmony_ci{ 461bf215546Sopenharmony_ci gettexgendv(texunit - GL_TEXTURE0, coord, pname, params, "glGetMultiTexGendvEXT"); 462bf215546Sopenharmony_ci} 463bf215546Sopenharmony_ci 464bf215546Sopenharmony_ci 465bf215546Sopenharmony_civoid GLAPIENTRY 466bf215546Sopenharmony_ci_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) 467bf215546Sopenharmony_ci{ 468bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 469bf215546Sopenharmony_ci gettexgenfv(ctx->Texture.CurrentUnit, coord, pname, params, "glGetTexGenfv"); 470bf215546Sopenharmony_ci} 471bf215546Sopenharmony_ci 472bf215546Sopenharmony_ci 473bf215546Sopenharmony_civoid GLAPIENTRY 474bf215546Sopenharmony_ci_mesa_GetMultiTexGenfvEXT( GLenum texunit, GLenum coord, GLenum pname, GLfloat *params ) 475bf215546Sopenharmony_ci{ 476bf215546Sopenharmony_ci gettexgenfv(texunit - GL_TEXTURE0, coord, pname, params, "glGetMultiTexGenfvEXT"); 477bf215546Sopenharmony_ci} 478bf215546Sopenharmony_ci 479bf215546Sopenharmony_ci 480bf215546Sopenharmony_civoid GLAPIENTRY 481bf215546Sopenharmony_ci_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) 482bf215546Sopenharmony_ci{ 483bf215546Sopenharmony_ci GET_CURRENT_CONTEXT(ctx); 484bf215546Sopenharmony_ci gettexgeniv(ctx->Texture.CurrentUnit, coord, pname, params, "glGetTexGeniv"); 485bf215546Sopenharmony_ci} 486bf215546Sopenharmony_ci 487bf215546Sopenharmony_ci 488bf215546Sopenharmony_civoid GLAPIENTRY 489bf215546Sopenharmony_ci_mesa_GetMultiTexGenivEXT( GLenum texunit, GLenum coord, GLenum pname, GLint *params ) 490bf215546Sopenharmony_ci{ 491bf215546Sopenharmony_ci gettexgeniv(texunit - GL_TEXTURE0, coord, pname, params, "glGetTexGenivEXT"); 492bf215546Sopenharmony_ci} 493