1 /* $Id: rastpos.c,v 1.31 2001/09/18 23:06:14 kschultz Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
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:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
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.
41 #include "simple_list.h"
44 #include "math/m_matrix.h"
45 #include "math/m_xform.h"
50 * Clip a point against the view volume.
51 * Input: v - vertex-vector describing the point to clip
52 * Return: 0 = outside view volume
53 * 1 = inside view volume
56 viewclip_point( const GLfloat v
[] )
58 if ( v
[0] > v
[3] || v
[0] < -v
[3]
59 || v
[1] > v
[3] || v
[1] < -v
[3]
60 || v
[2] > v
[3] || v
[2] < -v
[3] ) {
69 /* As above, but only clip test against far/near Z planes */
71 viewclip_point_z( const GLfloat v
[] )
73 if (v
[2] > v
[3] || v
[2] < -v
[3] ) {
84 * Clip a point against the user clipping planes.
85 * Input: v - vertex-vector describing the point to clip.
86 * Return: 0 = point was clipped
87 * 1 = point not clipped
90 userclip_point( GLcontext
* ctx
, const GLfloat v
[] )
94 for (p
= 0; p
< ctx
->Const
.MaxClipPlanes
; p
++) {
95 if (ctx
->Transform
.ClipEnabled
[p
]) {
96 GLfloat dot
= v
[0] * ctx
->Transform
._ClipUserPlane
[p
][0]
97 + v
[1] * ctx
->Transform
._ClipUserPlane
[p
][1]
98 + v
[2] * ctx
->Transform
._ClipUserPlane
[p
][2]
99 + v
[3] * ctx
->Transform
._ClipUserPlane
[p
][3];
110 /* This has been split off to allow the normal shade routines to
111 * get a little closer to the vertex buffer, and to use the
112 * GLvector objects directly.
113 * Input: ctx - the context
114 * vertex - vertex location
115 * normal - normal vector
116 * Output: Rcolor - returned color
117 * Rspec - returned specular color (if separate specular enabled)
118 * Rindex - returned color index
121 shade_rastpos(GLcontext
*ctx
,
122 const GLfloat vertex
[4],
123 const GLfloat normal
[3],
128 GLfloat (*base
)[3] = ctx
->Light
._BaseColor
;
129 struct gl_light
*light
;
130 GLfloat diffuseColor
[4], specularColor
[4];
131 GLfloat diffuse
= 0, specular
= 0;
133 if (!ctx
->_ShineTable
[0] || !ctx
->_ShineTable
[1])
134 _mesa_validate_all_lighting_tables( ctx
);
136 COPY_3V(diffuseColor
, base
[0]);
137 diffuseColor
[3] = CLAMP( ctx
->Light
.Material
[0].Diffuse
[3], 0.0F
, 1.0F
);
138 ASSIGN_4V(specularColor
, 0.0, 0.0, 0.0, 0.0);
140 foreach (light
, &ctx
->Light
.EnabledList
) {
142 GLfloat attenuation
= 1.0;
146 GLfloat diffuseContrib
[3], specularContrib
[3];
147 GLboolean normalized
;
149 if (!(light
->_Flags
& LIGHT_POSITIONAL
)) {
150 COPY_3V(VP
, light
->_VP_inf_norm
);
151 attenuation
= light
->_VP_inf_spot_attenuation
;
156 SUB_3V(VP
, light
->_Position
, vertex
);
157 d
= (GLfloat
) LEN_3FV( VP
);
160 GLfloat invd
= 1.0F
/ d
;
161 SELF_SCALE_SCALAR_3V(VP
, invd
);
163 attenuation
= 1.0F
/ (light
->ConstantAttenuation
+ d
*
164 (light
->LinearAttenuation
+ d
*
165 light
->QuadraticAttenuation
));
167 if (light
->_Flags
& LIGHT_SPOT
) {
168 GLfloat PV_dot_dir
= - DOT3(VP
, light
->_NormDirection
);
170 if (PV_dot_dir
<light
->_CosCutoff
) {
174 double x
= PV_dot_dir
* (EXP_TABLE_SIZE
-1);
176 GLfloat spot
= (GLfloat
) (light
->_SpotExpTable
[k
][0]
177 + (x
-k
)*light
->_SpotExpTable
[k
][1]);
183 if (attenuation
< 1e-3)
186 n_dot_VP
= DOT3( normal
, VP
);
188 if (n_dot_VP
< 0.0F
) {
189 ACC_SCALE_SCALAR_3V(diffuseColor
, attenuation
, light
->_MatAmbient
[0]);
193 COPY_3V(diffuseContrib
, light
->_MatAmbient
[0]);
194 ACC_SCALE_SCALAR_3V(diffuseContrib
, n_dot_VP
, light
->_MatDiffuse
[0]);
195 diffuse
+= n_dot_VP
* light
->_dli
* attenuation
;
196 ASSIGN_3V(specularContrib
, 0.0, 0.0, 0.0);
199 if (ctx
->Light
.Model
.LocalViewer
) {
207 else if (light
->_Flags
& LIGHT_POSITIONAL
) {
209 ACC_3V(h
, ctx
->_EyeZDir
);
213 h
= light
->_h_inf_norm
;
217 n_dot_h
= DOT3(normal
, h
);
219 if (n_dot_h
> 0.0F
) {
220 const struct gl_material
*mat
= &ctx
->Light
.Material
[0];
222 GLfloat shininess
= mat
->Shininess
;
226 n_dot_h
/= LEN_SQUARED_3FV( h
);
230 GET_SHINE_TAB_ENTRY( ctx
->_ShineTable
[0], n_dot_h
, spec_coef
);
232 if (spec_coef
> 1.0e-10) {
233 if (ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
) {
234 ACC_SCALE_SCALAR_3V( specularContrib
, spec_coef
,
235 light
->_MatSpecular
[0]);
238 ACC_SCALE_SCALAR_3V( diffuseContrib
, spec_coef
,
239 light
->_MatSpecular
[0]);
241 specular
+= spec_coef
* light
->_sli
* attenuation
;
246 ACC_SCALE_SCALAR_3V( diffuseColor
, attenuation
, diffuseContrib
);
247 ACC_SCALE_SCALAR_3V( specularColor
, attenuation
, specularContrib
);
250 if (ctx
->Visual
.rgbMode
) {
251 Rcolor
[0] = CLAMP(diffuseColor
[0], 0.0F
, 1.0F
);
252 Rcolor
[1] = CLAMP(diffuseColor
[1], 0.0F
, 1.0F
);
253 Rcolor
[2] = CLAMP(diffuseColor
[2], 0.0F
, 1.0F
);
254 Rcolor
[3] = CLAMP(diffuseColor
[3], 0.0F
, 1.0F
);
255 Rspec
[0] = CLAMP(specularColor
[0], 0.0F
, 1.0F
);
256 Rspec
[1] = CLAMP(specularColor
[1], 0.0F
, 1.0F
);
257 Rspec
[2] = CLAMP(specularColor
[2], 0.0F
, 1.0F
);
258 Rspec
[3] = CLAMP(specularColor
[3], 0.0F
, 1.0F
);
261 struct gl_material
*mat
= &ctx
->Light
.Material
[0];
262 GLfloat d_a
= mat
->DiffuseIndex
- mat
->AmbientIndex
;
263 GLfloat s_a
= mat
->SpecularIndex
- mat
->AmbientIndex
;
264 GLfloat ind
= mat
->AmbientIndex
265 + diffuse
* (1.0F
-specular
) * d_a
267 if (ind
> mat
->SpecularIndex
) {
268 ind
= mat
->SpecularIndex
;
270 *Rindex
= (GLuint
) (GLint
) ind
;
276 * Caller: context->API.RasterPos4f
279 raster_pos4f(GLcontext
*ctx
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
281 GLfloat v
[4], eye
[4], clip
[4], ndc
[3], d
;
282 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
283 FLUSH_CURRENT(ctx
, 0);
286 _mesa_update_state( ctx
);
288 ASSIGN_4V( v
, x
, y
, z
, w
);
289 TRANSFORM_POINT( eye
, ctx
->ModelView
.m
, v
);
292 if (ctx
->Light
.Enabled
) {
293 GLfloat
*norm
, eyenorm
[3];
294 GLfloat
*objnorm
= ctx
->Current
.Normal
;
296 if (ctx
->_NeedEyeCoords
) {
297 GLfloat
*inv
= ctx
->ModelView
.inv
;
298 TRANSFORM_NORMAL( eyenorm
, objnorm
, inv
);
305 shade_rastpos( ctx
, v
, norm
,
306 ctx
->Current
.RasterColor
,
307 ctx
->Current
.RasterSecondaryColor
,
308 &ctx
->Current
.RasterIndex
);
312 /* use current color or index */
313 if (ctx
->Visual
.rgbMode
) {
314 COPY_4FV(ctx
->Current
.RasterColor
, ctx
->Current
.Color
);
315 COPY_4FV(ctx
->Current
.RasterSecondaryColor
,
316 ctx
->Current
.SecondaryColor
);
319 ctx
->Current
.RasterIndex
= ctx
->Current
.Index
;
323 /* compute raster distance */
324 ctx
->Current
.RasterDistance
= (GLfloat
)
325 GL_SQRT( eye
[0]*eye
[0] + eye
[1]*eye
[1] + eye
[2]*eye
[2] );
327 /* apply projection matrix: clip = Proj * eye */
328 TRANSFORM_POINT( clip
, ctx
->ProjectionMatrix
.m
, eye
);
330 /* clip to view volume */
331 if (ctx
->Transform
.RasterPositionUnclipped
) {
332 /* GL_IBM_rasterpos_clip: only clip against Z */
333 if (viewclip_point_z(clip
) == 0)
334 ctx
->Current
.RasterPosValid
= GL_FALSE
;
336 else if (viewclip_point(clip
) == 0) {
337 /* Normal OpenGL behaviour */
338 ctx
->Current
.RasterPosValid
= GL_FALSE
;
342 /* clip to user clipping planes */
343 if (ctx
->Transform
._AnyClip
&&
344 userclip_point(ctx
, clip
) == 0) {
345 ctx
->Current
.RasterPosValid
= GL_FALSE
;
350 ASSERT( clip
[3]!=0.0 );
352 ndc
[0] = clip
[0] * d
;
353 ndc
[1] = clip
[1] * d
;
354 ndc
[2] = clip
[2] * d
;
356 ctx
->Current
.RasterPos
[0] = (ndc
[0] * ctx
->Viewport
._WindowMap
.m
[MAT_SX
] +
357 ctx
->Viewport
._WindowMap
.m
[MAT_TX
]);
358 ctx
->Current
.RasterPos
[1] = (ndc
[1] * ctx
->Viewport
._WindowMap
.m
[MAT_SY
] +
359 ctx
->Viewport
._WindowMap
.m
[MAT_TY
]);
360 ctx
->Current
.RasterPos
[2] = (ndc
[2] * ctx
->Viewport
._WindowMap
.m
[MAT_SZ
] +
361 ctx
->Viewport
._WindowMap
.m
[MAT_TZ
]) / ctx
->DepthMaxF
;
362 ctx
->Current
.RasterPos
[3] = clip
[3];
363 ctx
->Current
.RasterPosValid
= GL_TRUE
;
365 ctx
->Current
.RasterFogCoord
= ctx
->Current
.FogCoord
;
369 for (texSet
= 0; texSet
< ctx
->Const
.MaxTextureUnits
; texSet
++) {
370 COPY_4FV( ctx
->Current
.RasterMultiTexCoord
[texSet
],
371 ctx
->Current
.Texcoord
[texSet
] );
375 if (ctx
->RenderMode
==GL_SELECT
) {
376 _mesa_update_hitflag( ctx
, ctx
->Current
.RasterPos
[2] );
384 _mesa_RasterPos2d(GLdouble x
, GLdouble y
)
386 _mesa_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
390 _mesa_RasterPos2f(GLfloat x
, GLfloat y
)
392 _mesa_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
396 _mesa_RasterPos2i(GLint x
, GLint y
)
398 _mesa_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
402 _mesa_RasterPos2s(GLshort x
, GLshort y
)
404 _mesa_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
408 _mesa_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
410 _mesa_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
414 _mesa_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
416 _mesa_RasterPos4f(x
, y
, z
, 1.0F
);
420 _mesa_RasterPos3i(GLint x
, GLint y
, GLint z
)
422 _mesa_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
426 _mesa_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
428 _mesa_RasterPos4f(x
, y
, z
, 1.0F
);
432 _mesa_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
434 _mesa_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
438 _mesa_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
440 GET_CURRENT_CONTEXT(ctx
);
441 raster_pos4f(ctx
, x
, y
, z
, w
);
445 _mesa_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
447 _mesa_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
451 _mesa_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
453 _mesa_RasterPos4f(x
, y
, z
, w
);
457 _mesa_RasterPos2dv(const GLdouble
*v
)
459 _mesa_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
463 _mesa_RasterPos2fv(const GLfloat
*v
)
465 _mesa_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
469 _mesa_RasterPos2iv(const GLint
*v
)
471 _mesa_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
475 _mesa_RasterPos2sv(const GLshort
*v
)
477 _mesa_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
481 _mesa_RasterPos3dv(const GLdouble
*v
)
483 _mesa_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
487 _mesa_RasterPos3fv(const GLfloat
*v
)
489 _mesa_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
493 _mesa_RasterPos3iv(const GLint
*v
)
495 _mesa_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
499 _mesa_RasterPos3sv(const GLshort
*v
)
501 _mesa_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
505 _mesa_RasterPos4dv(const GLdouble
*v
)
507 _mesa_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
508 (GLfloat
) v
[2], (GLfloat
) v
[3]);
512 _mesa_RasterPos4fv(const GLfloat
*v
)
514 _mesa_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
518 _mesa_RasterPos4iv(const GLint
*v
)
520 _mesa_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
521 (GLfloat
) v
[2], (GLfloat
) v
[3]);
525 _mesa_RasterPos4sv(const GLshort
*v
)
527 _mesa_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
532 /**********************************************************************/
533 /*** GL_MESA_window_pos ***/
534 /**********************************************************************/
538 * This is a MESA extension function. Pretty much just like glRasterPos
539 * except we don't apply the modelview or projection matrices; specify a
540 * window coordinate directly.
541 * Caller: context->API.WindowPos4fMESA pointer.
544 _mesa_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
546 GET_CURRENT_CONTEXT(ctx
);
547 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
548 FLUSH_CURRENT(ctx
, 0);
550 /* set raster position */
551 ctx
->Current
.RasterPos
[0] = x
;
552 ctx
->Current
.RasterPos
[1] = y
;
553 ctx
->Current
.RasterPos
[2] = CLAMP( z
, 0.0F
, 1.0F
);
554 ctx
->Current
.RasterPos
[3] = w
;
556 ctx
->Current
.RasterPosValid
= GL_TRUE
;
557 ctx
->Current
.RasterDistance
= 0.0F
;
558 ctx
->Current
.RasterFogCoord
= 0.0F
;
560 /* raster color = current color or index */
561 if (ctx
->Visual
.rgbMode
) {
562 ctx
->Current
.RasterColor
[0] = (ctx
->Current
.Color
[0]);
563 ctx
->Current
.RasterColor
[1] = (ctx
->Current
.Color
[1]);
564 ctx
->Current
.RasterColor
[2] = (ctx
->Current
.Color
[2]);
565 ctx
->Current
.RasterColor
[3] = (ctx
->Current
.Color
[3]);
568 ctx
->Current
.RasterIndex
= ctx
->Current
.Index
;
571 /* raster texcoord = current texcoord */
574 for (texSet
= 0; texSet
< ctx
->Const
.MaxTextureUnits
; texSet
++) {
575 COPY_4FV( ctx
->Current
.RasterMultiTexCoord
[texSet
],
576 ctx
->Current
.Texcoord
[texSet
] );
580 if (ctx
->RenderMode
==GL_SELECT
) {
581 _mesa_update_hitflag( ctx
, ctx
->Current
.RasterPos
[2] );
589 _mesa_WindowPos2dMESA(GLdouble x
, GLdouble y
)
591 _mesa_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
595 _mesa_WindowPos2fMESA(GLfloat x
, GLfloat y
)
597 _mesa_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
601 _mesa_WindowPos2iMESA(GLint x
, GLint y
)
603 _mesa_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
607 _mesa_WindowPos2sMESA(GLshort x
, GLshort y
)
609 _mesa_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
613 _mesa_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
615 _mesa_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
619 _mesa_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
621 _mesa_WindowPos4fMESA(x
, y
, z
, 1.0F
);
625 _mesa_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
627 _mesa_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
631 _mesa_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
633 _mesa_WindowPos4fMESA(x
, y
, z
, 1.0F
);
637 _mesa_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
639 _mesa_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
643 _mesa_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
645 _mesa_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
649 _mesa_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
651 _mesa_WindowPos4fMESA(x
, y
, z
, w
);
655 _mesa_WindowPos2dvMESA(const GLdouble
*v
)
657 _mesa_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
661 _mesa_WindowPos2fvMESA(const GLfloat
*v
)
663 _mesa_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
667 _mesa_WindowPos2ivMESA(const GLint
*v
)
669 _mesa_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
673 _mesa_WindowPos2svMESA(const GLshort
*v
)
675 _mesa_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
679 _mesa_WindowPos3dvMESA(const GLdouble
*v
)
681 _mesa_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
685 _mesa_WindowPos3fvMESA(const GLfloat
*v
)
687 _mesa_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
691 _mesa_WindowPos3ivMESA(const GLint
*v
)
693 _mesa_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
697 _mesa_WindowPos3svMESA(const GLshort
*v
)
699 _mesa_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
703 _mesa_WindowPos4dvMESA(const GLdouble
*v
)
705 _mesa_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
706 (GLfloat
) v
[2], (GLfloat
) v
[3]);
710 _mesa_WindowPos4fvMESA(const GLfloat
*v
)
712 _mesa_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
716 _mesa_WindowPos4ivMESA(const GLint
*v
)
718 _mesa_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
719 (GLfloat
) v
[2], (GLfloat
) v
[3]);
723 _mesa_WindowPos4svMESA(const GLshort
*v
)
725 _mesa_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
733 * OpenGL implementation of glWindowPos*MESA()
735 void glWindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
739 /* Push current matrix mode and viewport attributes */
740 glPushAttrib( GL_TRANSFORM_BIT
| GL_VIEWPORT_BIT
);
742 /* Setup projection parameters */
743 glMatrixMode( GL_PROJECTION
);
746 glMatrixMode( GL_MODELVIEW
);
750 glDepthRange( z
, z
);
751 glViewport( (int) x
- 1, (int) y
- 1, 2, 2 );
753 /* set the raster (window) position */
756 glRasterPos4f( fx
, fy
, 0.0, w
);
758 /* restore matrices, viewport and matrix mode */
760 glMatrixMode( GL_PROJECTION
);