done with fragment programs nowadays.
- MESA_GLX_ALPHA_BITS env var for xlib driver
Changes:
- removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead)
+ - removed GL_SGIX/SGIS_pixel_texture extensions
Bug fixes:
multiarb \
occlude \
paltex \
- pixeltex \
pointblast \
ray \
readpix \
+++ /dev/null
-/*
- * GL_SGIS_pixel_texture demo
- *
- * Brian Paul
- * 6 Apr 2000
- *
- * Copyright (C) 2000 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/*
- * How this works:
- * 1. We load the image into a 2D texture.
- * 2. We generate a sequence of RGB images in which the R component
- * is really the S texture coordinate and the G component is really
- * the T texture coordinate.
- * By warping the mapping from R to S and G to T we can get non-linear
- * distortions.
- * 3. Draw the warped image (a 2-D warping function) with pixel texgen
- * enabled.
- * 4. Loop over the warped images to animate.
- *
- * The pixel texgen extension can also be used to do color-space
- * conversions. For example, we could convert YCR to RGB with a
- * 3D texture map which takes YCR as the S,T,R texture coordinate and
- * returns RGB texel values.
- *
- * You can use this extension in (at least) two ways:
- * 1. glDrawPixels w/ color space conversion/warping
- * 2. glDrawPixels to spatially warp another image in texture memory
- *
- * We're basically using glDrawPixels to draw a texture coordinate image.
- */
-
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <GL/glut.h>
-#include <GL/glext.h>
-#include "readtex.h"
-
-#define TEXTURE_FILE "../images/girl.rgb"
-
-static int ImgWidth = 300, ImgHeight = 300;
-#define FRAMES 20
-static GLubyte *ImgData[FRAMES];
-static GLint Frame = 0;
-
-static GLboolean TextureFlag = GL_TRUE;
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT );
-
- if (TextureFlag) {
- glEnable(GL_PIXEL_TEXTURE_SGIS);
- glEnable(GL_TEXTURE_2D);
- }
- else {
- glDisable(GL_PIXEL_TEXTURE_SGIS);
- glDisable(GL_TEXTURE_2D);
- }
-
- glColor3f(1, 1, 1);
- glRasterPos2f(10, 10);
- glDrawPixels(ImgWidth, ImgHeight, GL_RGB, GL_UNSIGNED_BYTE, ImgData[Frame]);
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho(0, width, 0, height, -1, 1);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case ' ':
- TextureFlag = !TextureFlag;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Idle(void)
-{
- Frame++;
- if (Frame >= FRAMES)
- Frame = 0;
- glutPostRedisplay();
-}
-
-
-static GLubyte warp(GLfloat s, int frame)
-{
- static const GLfloat pi = 3.14159265;
- static int halfFrame = FRAMES / 2;
- GLfloat y, weight, v;
- if (frame >= halfFrame)
- frame = halfFrame - (frame - halfFrame);
- y = sin(s * pi);
- weight = (float) frame / (FRAMES-1);
- v = y * (0.8 * weight + 0.2);
- return (GLint) (v * 255.0F);
-}
-
-
-static void InitImage(void)
-{
- int i, j, frame;
- for (frame = 0; frame < FRAMES; frame++) {
- ImgData[frame] = (GLubyte *) malloc(ImgWidth * ImgHeight * 3);
- for (i = 0; i < ImgHeight; i++) {
- for (j = 0; j < ImgWidth; j++) {
- GLubyte *pixel = ImgData[frame] + (i * ImgWidth + j) * 3;
- pixel[0] = warp((float) j / (ImgWidth - 0), frame);
- pixel[1] = warp((float) i / (ImgHeight - 0), frame);
- pixel[2] = 0.0;
- }
- }
- }
-}
-
-
-static void Init( int argc, char *argv[] )
-{
- const char *exten = (const char *) glGetString(GL_EXTENSIONS);
- if (!strstr(exten, "GL_SGIS_pixel_texture")) {
- printf("Sorry, GL_SGIS_pixel_texture not supported by this renderer.\n");
- exit(1);
- }
-
- /* linear filtering looks nicer, but it's slower, since it's in software */
-#if 1
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-#else
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-#endif
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image\n");
- exit(1);
- }
-
- glClearColor(0.3, 0.3, 0.4, 1.0);
-
- InitImage();
-
- printf("Hit SPACE to toggle pixel texgen\n");
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowSize( 330, 330 );
- glutInitWindowPosition( 0, 0 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0] );
-
- Init( argc, argv );
-
- glutKeyboardFunc( Key );
- glutReshapeFunc( Reshape );
- glutDisplayFunc( Display );
- glutIdleFunc( Idle );
-
- glutMainLoop();
- return 0;
-}
MEMCPY(attr->Map2Attrib, ctx->Eval.Map2Attrib, sizeof(ctx->Eval.Map2Attrib));
attr->Normalize = ctx->Transform.Normalize;
attr->RasterPositionUnclipped = ctx->Transform.RasterPositionUnclipped;
- attr->PixelTexture = ctx->Pixel.PixelTextureEnabled;
attr->PointSmooth = ctx->Point.SmoothFlag;
attr->PointSprite = ctx->Point.PointSprite;
attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint;
TEST_AND_UPDATE(ctx->Transform.RasterPositionUnclipped,
enable->RasterPositionUnclipped,
GL_RASTER_POSITION_UNCLIPPED_IBM);
- TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture,
- GL_POINT_SMOOTH);
TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth,
GL_POINT_SMOOTH);
if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite) {
OPCODE_WINDOW_POS,
/* GL_ARB_multitexture */
OPCODE_ACTIVE_TEXTURE,
- /* GL_SGIX/SGIS_pixel_texture */
- OPCODE_PIXEL_TEXGEN_SGIX,
- OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS,
/* GL_ARB_texture_compression */
OPCODE_COMPRESSED_TEX_IMAGE_1D,
OPCODE_COMPRESSED_TEX_IMAGE_2D,
InstSize[OPCODE_CONTINUE] = 2;
InstSize[OPCODE_ERROR] = 3;
InstSize[OPCODE_END_OF_LIST] = 1;
- /* GL_SGIX/SGIS_pixel_texture */
- InstSize[OPCODE_PIXEL_TEXGEN_SGIX] = 2;
- InstSize[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS] = 3;
/* GL_ARB_texture_compression */
InstSize[OPCODE_COMPRESSED_TEX_IMAGE_1D] = 8;
InstSize[OPCODE_COMPRESSED_TEX_IMAGE_2D] = 9;
}
-static void GLAPIENTRY
-save_PixelTexGenSGIX(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_SGIX, 1 );
- if (n) {
- n[1].e = mode;
- }
- if (ctx->ExecuteFlag) {
- CALL_PixelTexGenSGIX(ctx->Exec, ( mode ));
- }
-}
-
-
/* GL_ARB_texture_compression */
static void GLAPIENTRY
save_CompressedTexImage1DARB(GLenum target, GLint level,
}
-/* GL_SGIS_pixel_texture */
-
-static void GLAPIENTRY
-save_PixelTexGenParameteriSGIS(GLenum target, GLint value)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, 2 );
- if (n) {
- n[1].e = target;
- n[2].i = value;
- }
- if (ctx->ExecuteFlag) {
- CALL_PixelTexGenParameteriSGIS(ctx->Exec, ( target, value ));
- }
-}
-
-
-static void GLAPIENTRY
-save_PixelTexGenParameterfSGIS(GLenum target, GLfloat value)
-{
- save_PixelTexGenParameteriSGIS(target, (GLint) value);
-}
-
-
-static void GLAPIENTRY
-save_PixelTexGenParameterivSGIS(GLenum target, const GLint *value)
-{
- save_PixelTexGenParameteriSGIS(target, *value);
-}
-
-
-static void GLAPIENTRY
-save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value)
-{
- save_PixelTexGenParameteriSGIS(target, (GLint) *value);
-}
-
-
/*
* GL_NV_vertex_program
*/
case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
CALL_ActiveTextureARB(ctx->Exec, ( n[1].e ));
break;
- case OPCODE_PIXEL_TEXGEN_SGIX: /* GL_SGIX_pixel_texture */
- CALL_PixelTexGenSGIX(ctx->Exec, ( n[1].e ));
- break;
- case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS: /* GL_SGIS_pixel_texture */
- CALL_PixelTexGenParameteriSGIS(ctx->Exec, ( n[1].e, n[2].i ));
- break;
case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
CALL_CompressedTexImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
n[4].i, n[5].i, n[6].i, n[7].data));
type, row, column));
}
-static void GLAPIENTRY exec_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPixelTexGenParameterivSGIS(ctx->Exec, ( target, value));
-}
-
-static void GLAPIENTRY exec_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPixelTexGenParameterfvSGIS(ctx->Exec, ( target, value));
-}
-
static void GLAPIENTRY exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride,
GLsizei count, const GLvoid *ptr)
{
SET_TexSubImage3DEXT(table, save_TexSubImage3D);
#endif
- /* 15. GL_SGIX_pixel_texture */
- SET_PixelTexGenSGIX(table, save_PixelTexGenSGIX);
-
- /* 15. GL_SGIS_pixel_texture */
- SET_PixelTexGenParameteriSGIS(table, save_PixelTexGenParameteriSGIS);
- SET_PixelTexGenParameterfSGIS(table, save_PixelTexGenParameterfSGIS);
- SET_PixelTexGenParameterivSGIS(table, save_PixelTexGenParameterivSGIS);
- SET_PixelTexGenParameterfvSGIS(table, save_PixelTexGenParameterfvSGIS);
- SET_GetPixelTexGenParameterivSGIS(table, exec_GetPixelTexGenParameterivSGIS);
- SET_GetPixelTexGenParameterfvSGIS(table, exec_GetPixelTexGenParameterfvSGIS);
-
/* 30. GL_EXT_vertex_array */
SET_ColorPointerEXT(table, exec_ColorPointerEXT);
SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT);
client_state( ctx, cap, state );
return;
- /* GL_SGIS_pixel_texture */
- case GL_PIXEL_TEXTURE_SGIS:
- CHECK_EXTENSION(SGIS_pixel_texture, cap);
- if (ctx->Pixel.PixelTextureEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PixelTextureEnabled = state;
- break;
-
- /* GL_SGIX_pixel_texture */
- case GL_PIXEL_TEX_GEN_SGIX:
- CHECK_EXTENSION(SGIX_pixel_texture, cap);
- if (ctx->Pixel.PixelTextureEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PixelTextureEnabled = state;
- break;
-
/* GL_SGI_color_table */
case GL_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table, cap);
CHECK_EXTENSION(EXT_histogram);
return ctx->Pixel.MinMaxEnabled;
- /* GL_SGIS_pixel_texture */
- case GL_PIXEL_TEXTURE_SGIS:
- CHECK_EXTENSION(SGIS_pixel_texture);
- return ctx->Pixel.PixelTextureEnabled;
-
- /* GL_SGIX_pixel_texture */
- case GL_PIXEL_TEX_GEN_SGIX:
- CHECK_EXTENSION(SGIX_pixel_texture);
- return ctx->Pixel.PixelTextureEnabled;
-
/* GL_SGI_color_table */
case GL_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table);
{ OFF, "GL_SGI_color_table", F(SGI_color_table) },
{ OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) },
{ OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) },
- { OFF, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) },
{ OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) },
{ ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
{ ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) },
{ OFF, "GL_SGIX_depth_texture", F(SGIX_depth_texture) },
- { OFF, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) },
{ OFF, "GL_SGIX_shadow", F(SGIX_shadow) },
{ OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) },
{ OFF, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) },
ctx->Extensions.SGI_color_table = GL_TRUE;
ctx->Extensions.SGI_texture_color_table = GL_TRUE;
ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;
- ctx->Extensions.SGIS_pixel_texture = GL_TRUE;
ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE;
ctx->Extensions.SGIX_depth_texture = GL_TRUE;
- ctx->Extensions.SGIX_pixel_texture = GL_TRUE;
ctx->Extensions.SGIX_shadow = GL_TRUE;
ctx->Extensions.SGIX_shadow_ambient = GL_TRUE;
}
CHECK1(EXTNAME, "Float", PNAME )
-/**
- * Helper routine.
- */
-static GLenum
-pixel_texgen_mode(const GLcontext *ctx)
-{
- if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) {
- if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) {
- return GL_RGBA;
- }
- else {
- return GL_RGB;
- }
- }
- else {
- if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) {
- return GL_ALPHA;
- }
- else {
- return GL_NONE;
- }
- }
-}
-
void GLAPIENTRY
_mesa_GetBooleanv( GLenum pname, GLboolean *params )
{
params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
}
break;
- case GL_PIXEL_TEXTURE_SGIS:
- CHECK_EXTENSION_B(SGIS_pixel_texture, pname);
- params[0] = ctx->Pixel.PixelTextureEnabled;
- break;
- case GL_PIXEL_TEX_GEN_SGIX:
- CHECK_EXTENSION_B(SGIX_pixel_texture, pname);
- params[0] = ctx->Pixel.PixelTextureEnabled;
- break;
- case GL_PIXEL_TEX_GEN_MODE_SGIX:
- CHECK_EXTENSION_B(SGIX_pixel_texture, pname);
- params[0] = ENUM_TO_BOOLEAN(pixel_texgen_mode(ctx));
- break;
case GL_COLOR_MATRIX_SGI:
{
const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;
params[15] = matrix[15];
}
break;
- case GL_PIXEL_TEXTURE_SGIS:
- CHECK_EXTENSION_F(SGIS_pixel_texture, pname);
- params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PixelTextureEnabled);
- break;
- case GL_PIXEL_TEX_GEN_SGIX:
- CHECK_EXTENSION_F(SGIX_pixel_texture, pname);
- params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PixelTextureEnabled);
- break;
- case GL_PIXEL_TEX_GEN_MODE_SGIX:
- CHECK_EXTENSION_F(SGIX_pixel_texture, pname);
- params[0] = ENUM_TO_FLOAT(pixel_texgen_mode(ctx));
- break;
case GL_COLOR_MATRIX_SGI:
{
const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;
params[15] = IROUND(matrix[15]);
}
break;
- case GL_PIXEL_TEXTURE_SGIS:
- CHECK_EXTENSION_I(SGIS_pixel_texture, pname);
- params[0] = BOOLEAN_TO_INT(ctx->Pixel.PixelTextureEnabled);
- break;
- case GL_PIXEL_TEX_GEN_SGIX:
- CHECK_EXTENSION_I(SGIX_pixel_texture, pname);
- params[0] = BOOLEAN_TO_INT(ctx->Pixel.PixelTextureEnabled);
- break;
- case GL_PIXEL_TEX_GEN_MODE_SGIX:
- CHECK_EXTENSION_I(SGIX_pixel_texture, pname);
- params[0] = ENUM_TO_INT(pixel_texgen_mode(ctx));
- break;
case GL_COLOR_MATRIX_SGI:
{
const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;
"matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
"const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ),
- # GL_SGIS_pixel_texture
- ( "GL_PIXEL_TEXTURE_SGIS", GLboolean, ["ctx->Pixel.PixelTextureEnabled"],
- "", "SGIS_pixel_texture" ),
-
- # GL_SGIX_pixel_texture
- ( "GL_PIXEL_TEX_GEN_SGIX", GLboolean, ["ctx->Pixel.PixelTextureEnabled"],
- "", "SGIX_pixel_texture" ),
- ( "GL_PIXEL_TEX_GEN_MODE_SGIX", GLenum, ["pixel_texgen_mode(ctx)"],
- "", "SGIX_pixel_texture" ),
-
# GL_SGI_color_matrix (also in 1.2 imaging)
( "GL_COLOR_MATRIX_SGI", GLfloat,
["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
#define CHECK_EXTENSION_F(EXTNAME, PNAME) \\
CHECK1(EXTNAME, "Float", PNAME )
-
-/**
- * Helper routine.
- */
-static GLenum
-pixel_texgen_mode(const GLcontext *ctx)
-{
- if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) {
- if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) {
- return GL_RGBA;
- }
- else {
- return GL_RGB;
- }
- }
- else {
- if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) {
- return GL_ALPHA;
- }
- else {
- return GL_NONE;
- }
- }
-}
"""
return
/** GL_EXT_histogram */
GLboolean HistogramEnabled;
GLboolean MinMaxEnabled;
- /** GL_SGIS_pixel_texture */
- GLboolean PixelTextureEnabled;
- GLenum FragmentRgbSource;
- GLenum FragmentAlphaSource;
/** GL_SGI_color_matrix */
GLfloat PostColorMatrixScale[4]; /**< RGBA */
GLfloat PostColorMatrixBias[4]; /**< RGBA */
GLboolean SGI_color_table;
GLboolean SGI_texture_color_table;
GLboolean SGIS_generate_mipmap;
- GLboolean SGIS_pixel_texture;
GLboolean SGIS_texture_edge_clamp;
GLboolean SGIS_texture_lod;
GLboolean SGIX_depth_texture;
- GLboolean SGIX_pixel_texture;
GLboolean SGIX_shadow;
GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */
GLboolean TDFX_texture_compression_FXT1;
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
ctx->Pixel.MapAtoA[0] = 0.0;
ctx->Pixel.HistogramEnabled = GL_FALSE;
ctx->Pixel.MinMaxEnabled = GL_FALSE;
- ctx->Pixel.PixelTextureEnabled = GL_FALSE;
- ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS;
- ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS;
ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0);
ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0);
ASSIGN_4V(ctx->Pixel.ColorTableScale, 1.0, 1.0, 1.0, 1.0);
SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv);
#endif
- /* ?. GL_SGIX_pixel_texture */
-#if _HAVE_FULL_GL
- SET_PixelTexGenSGIX(exec, _mesa_PixelTexGenSGIX);
-#endif
-
- /* 15. GL_SGIS_pixel_texture */
-#if _HAVE_FULL_GL
- SET_PixelTexGenParameteriSGIS(exec, _mesa_PixelTexGenParameteriSGIS);
- SET_PixelTexGenParameterivSGIS(exec, _mesa_PixelTexGenParameterivSGIS);
- SET_PixelTexGenParameterfSGIS(exec, _mesa_PixelTexGenParameterfSGIS);
- SET_PixelTexGenParameterfvSGIS(exec, _mesa_PixelTexGenParameterfvSGIS);
- SET_GetPixelTexGenParameterivSGIS(exec, _mesa_GetPixelTexGenParameterivSGIS);
- SET_GetPixelTexGenParameterfvSGIS(exec, _mesa_GetPixelTexGenParameterfvSGIS);
-#endif
-
/* 30. GL_EXT_vertex_array */
#if _HAVE_FULL_GL
SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT);
-/**********************************************************************/
-/* Pixel Texgen Extensions */
-/**********************************************************************/
-
-void GLAPIENTRY
-_mesa_PixelTexGenSGIX(GLenum mode)
-{
- GLenum newRgbSource, newAlphaSource;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- switch (mode) {
- case GL_NONE:
- newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS;
- newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS;
- break;
- case GL_ALPHA:
- newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS;
- newAlphaSource = GL_CURRENT_RASTER_COLOR;
- break;
- case GL_RGB:
- newRgbSource = GL_CURRENT_RASTER_COLOR;
- newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS;
- break;
- case GL_RGBA:
- newRgbSource = GL_CURRENT_RASTER_COLOR;
- newAlphaSource = GL_CURRENT_RASTER_COLOR;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenSGIX(mode)");
- return;
- }
-
- if (newRgbSource == ctx->Pixel.FragmentRgbSource &&
- newAlphaSource == ctx->Pixel.FragmentAlphaSource)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.FragmentRgbSource = newRgbSource;
- ctx->Pixel.FragmentAlphaSource = newAlphaSource;
-}
-
-
-void GLAPIENTRY
-_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value)
-{
- _mesa_PixelTexGenParameteriSGIS(target, (GLint) value);
-}
-
-
-void GLAPIENTRY
-_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value)
-{
- _mesa_PixelTexGenParameteriSGIS(target, (GLint) *value);
-}
-
-
-void GLAPIENTRY
-_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (value != GL_CURRENT_RASTER_COLOR && value != GL_PIXEL_GROUP_COLOR_SGIS) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(value)");
- return;
- }
-
- switch (target) {
- case GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS:
- if (ctx->Pixel.FragmentRgbSource == (GLenum) value)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.FragmentRgbSource = (GLenum) value;
- break;
- case GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS:
- if (ctx->Pixel.FragmentAlphaSource == (GLenum) value)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.FragmentAlphaSource = (GLenum) value;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(target)");
- return;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value)
-{
- _mesa_PixelTexGenParameteriSGIS(target, *value);
-}
-
-
-void GLAPIENTRY
-_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) {
- *value = (GLfloat) ctx->Pixel.FragmentRgbSource;
- }
- else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) {
- *value = (GLfloat) ctx->Pixel.FragmentAlphaSource;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterfvSGIS(target)");
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) {
- *value = (GLint) ctx->Pixel.FragmentRgbSource;
- }
- else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) {
- *value = (GLint) ctx->Pixel.FragmentAlphaSource;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterivSGIS(target)");
- }
-}
-
-
-
/**********************************************************************/
/***** State management *****/
/**********************************************************************/
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.5
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
_mesa_ClientActiveTextureARB( GLenum target );
-/*
- * Pixel Texture Extensions
- */
-
-extern void GLAPIENTRY
-_mesa_PixelTexGenSGIX(GLenum mode);
-
-extern void GLAPIENTRY
-_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value);
-
-#ifdef VMS
-#define _mesa_PixelTexGenParameterfvSGIS _mesa_PixelTexGenParameterfv
-#endif
-extern void GLAPIENTRY
-_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value);
-
-extern void GLAPIENTRY
-_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value);
-
-#ifdef VMS
-#define _mesa_PixelTexGenParameterivSGIS _mesa_PixelTexGenParameteriv
-#endif
-extern void GLAPIENTRY
-_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value);
-
-#ifdef VMS
-#define _mesa_GetPixelTexGenParameterfvSGIS _mesa_GetPixelTexGenParameterfv
-#endif
-extern void GLAPIENTRY
-_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value);
-
-#ifdef VMS
-#define _mesa_GetPixelTexGenParameterivSGIS _mesa_GetPixelTexGenParameteriv
-#endif
-extern void GLAPIENTRY
-_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value);
-
-/*@}*/
-
-
/**
* \name Initialization, state maintenance
*/
swrast/s_logic.c \
swrast/s_masking.c \
swrast/s_nvfragprog.c \
- swrast/s_pixeltex.c \
swrast/s_points.c \
swrast/s_readpix.c \
swrast/s_span.c \
SOURCES = s_aaline.c s_aatriangle.c s_accum.c s_alpha.c \
s_bitmap.c s_blend.c s_buffers.c s_context.c s_copypix.c s_depth.c \
s_drawpix.c s_feedback.c s_fog.c s_imaging.c s_lines.c s_logic.c \
- s_masking.c s_nvfragprog.c s_pixeltex.c s_points.c s_readpix.c \
+ s_masking.c s_nvfragprog.c s_points.c s_readpix.c \
s_span.c s_stencil.c s_texstore.c s_texcombine.c s_texfilter.c \
s_triangle.c s_zoom.c s_atifragshader.c
s_buffers.obj,s_context.obj,s_atifragshader.obj,\
s_copypix.obj,s_depth.obj,s_drawpix.obj,s_feedback.obj,s_fog.obj,\
s_imaging.obj,s_lines.obj,s_logic.obj,s_masking.obj,s_nvfragprog.obj,\
- s_pixeltex.obj,s_points.obj,s_readpix.obj,s_span.obj,s_stencil.obj,\
+ s_points.obj,s_readpix.obj,s_span.obj,s_stencil.obj,\
s_texstore.obj,s_texcombine.obj,s_texfilter.obj,s_triangle.obj,s_zoom.obj
##### RULES #####
s_logic.obj : s_logic.c
s_masking.obj : s_masking.c
s_nvfragprog.obj : s_nvfragprog.c
-s_pixeltex.obj : s_pixeltex.c
s_points.obj : s_points.c
s_readpix.obj : s_readpix.c
s_span.obj : s_span.c
#include "s_context.h"
#include "s_depth.h"
-#include "s_pixeltex.h"
#include "s_span.h"
#include "s_stencil.h"
#include "s_zoom.h"
/* convert floats back to chan */
float_span_to_chan(width, (const GLfloat (*)[4]) src, span.array->rgba);
- if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) {
- span.end = width;
- _swrast_pixel_texture(ctx, &span);
- }
-
/* write row to framebuffer */
-
dy = desty + row;
if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) {
drawRb->PutRow(ctx, drawRb, width, destx, dy, span.array->rgba, NULL);
span.array->rgba);
}
- if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) {
- span.end = width;
- _swrast_pixel_texture(ctx, &span);
- }
-
/* Write color span */
if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) {
drawRb->PutRow(ctx, drawRb, width, destx, dy, span.array->rgba, NULL);
#include "s_context.h"
#include "s_drawpix.h"
-#include "s_pixeltex.h"
#include "s_span.h"
#include "s_stencil.h"
#include "s_zoom.h"
(ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink))
continue;
- if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) {
- _swrast_pixel_texture(ctx, &span);
- }
-
/* draw the span */
if (quickDraw) {
rb->PutRow(ctx, rb, span.end, span.x, span.y,
+++ /dev/null
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/*
- * This file implements both the GL_SGIX_pixel_texture and
- * GL_SIGS_pixel_texture extensions. Luckily, they pretty much
- * overlap in functionality so we use the same state variables
- * and execution code for both.
- */
-
-
-#include "glheader.h"
-#include "colormac.h"
-#include "imports.h"
-
-#include "s_context.h"
-#include "s_pixeltex.h"
-
-
-/*
- * Convert RGBA values into strq texture coordinates.
- */
-static void
-pixeltexgen(GLcontext *ctx, GLuint n, const GLchan rgba[][4],
- GLfloat texcoord[][4])
-{
- if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_COLOR) {
- GLuint i;
- for (i = 0; i < n; i++) {
- texcoord[i][0] = ctx->Current.RasterColor[RCOMP];
- texcoord[i][1] = ctx->Current.RasterColor[GCOMP];
- texcoord[i][2] = ctx->Current.RasterColor[BCOMP];
- }
- }
- else {
- GLuint i;
- ASSERT(ctx->Pixel.FragmentRgbSource == GL_PIXEL_GROUP_COLOR_SGIS);
- for (i = 0; i < n; i++) {
- texcoord[i][0] = CHAN_TO_FLOAT(rgba[i][RCOMP]);
- texcoord[i][1] = CHAN_TO_FLOAT(rgba[i][GCOMP]);
- texcoord[i][2] = CHAN_TO_FLOAT(rgba[i][BCOMP]);
- }
- }
-
- if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_COLOR) {
- GLuint i;
- for (i = 0; i < n; i++) {
- texcoord[i][3] = ctx->Current.RasterColor[ACOMP];
- }
- }
- else {
- GLuint i;
- ASSERT(ctx->Pixel.FragmentAlphaSource == GL_PIXEL_GROUP_COLOR_SGIS);
- for (i = 0; i < n; i++) {
- texcoord[i][3] = CHAN_TO_FLOAT(rgba[i][ACOMP]);
- }
- }
-}
-
-
-
-/*
- * Used by glDraw/CopyPixels: the incoming image colors are treated
- * as texture coordinates. Use those coords to texture the image.
- * This is for GL_SGIS_pixel_texture / GL_SGIX_pixel_texture.
- */
-void
-_swrast_pixel_texture(GLcontext *ctx, struct sw_span *span)
-{
- GLuint unit;
-
- ASSERT(!(span->arrayMask & SPAN_TEXTURE));
- span->arrayMask |= SPAN_TEXTURE;
- span->interpMask &= ~SPAN_TEXTURE;
-
- /* convert colors into texture coordinates */
- pixeltexgen( ctx, span->end,
- (const GLchan (*)[4]) span->array->rgba,
- span->array->texcoords[0] );
-
- /* copy the new texture units for all enabled units */
- for (unit = 1; unit < ctx->Const.MaxTextureUnits; unit++) {
- if (ctx->Texture.Unit[unit]._ReallyEnabled) {
- MEMCPY( span->array->texcoords[unit], span->array->texcoords[0],
- span->end * 4 * sizeof(GLfloat) );
- }
- }
-}
+++ /dev/null
-
-/*
- * Mesa 3-D graphics library
- * Version: 4.1
- *
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef S_PIXELTEX_H
-#define S_PIXELTEX_H
-
-#include "mtypes.h"
-#include "swrast.h"
-
-
-extern void
-_swrast_pixel_texture(GLcontext *ctx, struct sw_span *span);
-
-
-#endif
# End Source File\r
# Begin Source File\r
\r
-SOURCE=..\..\..\..\src\mesa\swrast\s_pixeltex.c\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=..\..\..\..\src\mesa\swrast\s_points.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=..\..\..\..\src\mesa\swrast\s_pixeltex.h\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=..\..\..\..\src\mesa\swrast\s_points.h\r
# End Source File\r
# Begin Source File\r
<File\r
RelativePath="..\..\..\..\src\mesa\swrast\s_nvfragprog.c">\r
</File>\r
- <File\r
- RelativePath="..\..\..\..\src\mesa\swrast\s_pixeltex.c">\r
- </File>\r
<File\r
RelativePath="..\..\..\..\src\mesa\swrast\s_points.c">\r
</File>\r
<File\r
RelativePath="..\..\..\..\src\mesa\swrast\s_nvfragprog.h">\r
</File>\r
- <File\r
- RelativePath="..\..\..\..\src\mesa\swrast\s_pixeltex.h">\r
- </File>\r
<File\r
RelativePath="..\..\..\..\src\mesa\swrast\s_points.h">\r
</File>\r