| 1 | /* $Id: rect.c,v 1.2 2000-03-01 18:49:35 jeroen Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * Mesa 3-D graphics library | 
|---|
| 5 | * Version:  3.1 | 
|---|
| 6 | * | 
|---|
| 7 | * Copyright (C) 1999  Brian Paul   All Rights Reserved. | 
|---|
| 8 | * | 
|---|
| 9 | * Permission is hereby granted, free of charge, to any person obtaining a | 
|---|
| 10 | * copy of this software and associated documentation files (the "Software"), | 
|---|
| 11 | * to deal in the Software without restriction, including without limitation | 
|---|
| 12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 
|---|
| 13 | * and/or sell copies of the Software, and to permit persons to whom the | 
|---|
| 14 | * Software is furnished to do so, subject to the following conditions: | 
|---|
| 15 | * | 
|---|
| 16 | * The above copyright notice and this permission notice shall be included | 
|---|
| 17 | * in all copies or substantial portions of the Software. | 
|---|
| 18 | * | 
|---|
| 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | 
|---|
| 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
|---|
| 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | 
|---|
| 22 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | 
|---|
| 23 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | 
|---|
| 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 
|---|
| 25 | */ | 
|---|
| 26 | /* $XFree86: xc/lib/GL/mesa/src/rect.c,v 1.2 1999/04/04 00:20:30 dawes Exp $ */ | 
|---|
| 27 |  | 
|---|
| 28 |  | 
|---|
| 29 |  | 
|---|
| 30 |  | 
|---|
| 31 |  | 
|---|
| 32 | #ifdef PC_HEADER | 
|---|
| 33 | #include "all.h" | 
|---|
| 34 | #else | 
|---|
| 35 | #ifndef XFree86Server | 
|---|
| 36 | #else | 
|---|
| 37 | #include "GL/xf86glx.h" | 
|---|
| 38 | #endif | 
|---|
| 39 | #include "types.h" | 
|---|
| 40 | #include "context.h" | 
|---|
| 41 | #include "macros.h" | 
|---|
| 42 | #include "rect.h" | 
|---|
| 43 | #include "vbfill.h" | 
|---|
| 44 | #endif | 
|---|
| 45 |  | 
|---|
| 46 |  | 
|---|
| 47 |  | 
|---|
| 48 | /* | 
|---|
| 49 | * Execute a glRect*() function. | 
|---|
| 50 | */ | 
|---|
| 51 | void gl_Rectf( GLcontext *ctx, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) | 
|---|
| 52 | { | 
|---|
| 53 | /* | 
|---|
| 54 | * TODO: we could examine a bunch of state variables and ultimately | 
|---|
| 55 | * call the Driver->RectFunc() function to draw a screen-aligned | 
|---|
| 56 | * filled rectangle.  Someday... | 
|---|
| 57 | * | 
|---|
| 58 | * KW: What happens to cull mode here? | 
|---|
| 59 | */ | 
|---|
| 60 | ASSERT_OUTSIDE_BEGIN_END(ctx, "glRect"); | 
|---|
| 61 | RESET_IMMEDIATE(ctx); | 
|---|
| 62 | gl_Begin( ctx, GL_QUADS ); | 
|---|
| 63 | gl_Vertex2f( ctx, x1, y1 ); | 
|---|
| 64 | gl_Vertex2f( ctx, x2, y1 ); | 
|---|
| 65 | gl_Vertex2f( ctx, x2, y2 ); | 
|---|
| 66 | gl_Vertex2f( ctx, x1, y2 ); | 
|---|
| 67 | gl_End( ctx ); | 
|---|
| 68 | } | 
|---|