summaryrefslogtreecommitdiff
path: root/xc/unsupported/test/suspex/testcases/ocp_hp/pexocp.95.4.c
blob: b8c7d8fe97b46b741aecec2f6f4d7911d9c048ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
/* $XConsortium: pexocp.95.4.c,v 1.0 93/11/22 12:36:51 rws Exp $ */

/******************************************************************************/
/*                                                                            */
/*  (c) Copyright Hewlett-Packard Company, 1993, Fort Collins, Colorado       */
/*                                                                            */
/*                            All Rights Reserved                             */
/*                                                                            */
/*  Permission to use, copy, modify, and distribute this software and its     */
/*  documentation for any purpose and without fee is hereby granted,          */
/*  provided that the above copyright notices appear in all copies and that   */
/*  both the copyright notices and this permission notice appear in           */
/*  supporting documentation, and that the name of Hewlett-Packard not be     */
/*  used in advertising or publicity pertaining to distribution of the        */
/*  software without specific, written prior permission.                      */
/*                                                                            */
/*  HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS         */
/*  SOFTWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF        */
/*  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  Hewlett-Packard    */
/*  shall not be liable for errors contained herein or direct, indirect,      */
/*  special, incidental or consequential damages in connection with the       */
/*  furnishing, performance or use of this software.                          */
/*                                                                            */
/******************************************************************************/

#include <X11/PEX5/PEXlib.h>
#include <math.h>
#include <misc.h>
#include <lut.h>

#define		NUM_TRIANGLES		51
#define     NUM_FACETS          NUM_TRIANGLES
#define		NUM_VERTICES		(NUM_TRIANGLES+2)
#define		X_START				0.01
#define		X_END				0.99
#define		TWIST_Y0			0.9
#define		FLAT_Y0				(TWIST_Y0-((STRIP_HALF_WIDTH*2+GAP)*3))
#define		Z0					0.5
#define		STRIP_HALF_WIDTH	0.06
#define		TWIST_ANGLE			(M_PI*1)
#define		GAP					0.015
#define		DOWN				((STRIP_HALF_WIDTH*2)+GAP)


/*
 *	draw_image prototype
 */
void draw_image(
		Display				*dpy,
		XID					 rid,
		PEXOCRequestType	 req_type,
		PEXLookupTable		 light_lut,
		PEXLookupTable		 view_lut );

void set_view(
	Display			*dpy,
	PEXLookupTable	view_table );

void build_axes(
	Display				*dpy,
	XID					 res_id,
	PEXOCRequestType	 req_type,
	PEXCoord			*origin,
	double				 length );

void build_axes(
	Display				*dpy,
	XID					 res_id,
	PEXOCRequestType	 req_type,
	PEXCoord			*origin,
	double				 length )
{
    PEXVertexRGB	x_axis[2], y_axis[2], z_axis[2];
    PEXListOfVertex	axes[3];

    /*
	 *	Set the vertex coordinates and colors.
	 */
    axes[0].count			= 2;
    axes[0].vertices.rgb	= x_axis;

    x_axis[0].point			= *origin;

    x_axis[1].point.x		= origin->x + length;
    x_axis[1].point.y		= origin->y;
    x_axis[1].point.z		= origin->z;

	x_axis[0].rgb.red		= 1.0;
	x_axis[0].rgb.green		= 1.0;
	x_axis[0].rgb.blue		= 1.0;

	x_axis[1].rgb.red		= 1.0;
	x_axis[1].rgb.green		= 1.0;
	x_axis[1].rgb.blue		= 0.0;

    axes[1].count			= 2;
    axes[1].vertices.rgb	= y_axis;
    y_axis[0].point			= *origin;
    y_axis[1].point.x		= origin->x;
    y_axis[1].point.y		= origin->y + length;
    y_axis[1].point.z		= origin->z;

	y_axis[0].rgb.red		= 1.0;
	y_axis[0].rgb.green		= 1.0;
	y_axis[0].rgb.blue		= 1.0;

	y_axis[1].rgb.red		= 1.0;
	y_axis[1].rgb.green		= 1.0;
	y_axis[1].rgb.blue		= 0.0;
    
    axes[2].count			= 2;
    axes[2].vertices.rgb	= z_axis;
    z_axis[0].point			= *origin;
    z_axis[1].point.x		= origin->x;
    z_axis[1].point.y		= origin->y;
    z_axis[1].point.z		= origin->z + length;

	z_axis[0].rgb.red		= 1.0;
	z_axis[0].rgb.green		= 1.0;
	z_axis[0].rgb.blue		= 1.0;

	z_axis[1].rgb.red		= 1.0;
	z_axis[1].rgb.green		= 1.0;
	z_axis[1].rgb.blue		= 0.0;

	PEXSetPolylineInterpMethod( dpy, res_id, req_type, PEXPolylineInterpColor );
    PEXPolylineSetWithData( dpy, res_id, req_type, PEXGAColor,
			    PEXColorTypeRGB, 3, axes );
}


void set_view(
	Display			*dpy,
	PEXLookupTable	view_table )
{
    PEXViewEntry	view;
    PEXCoord2D		window[2];
    double			view_plane, front_plane, back_plane;
    PEXCoord		prp;
    PEXNPCSubVolume	viewport;

    /*
	 *	The view orientation parameters.
	 */
    static PEXCoord		view_ref_pt			= {  0.5, 0.5, 0.5 };
    static PEXVector	view_plane_normal	= {  0.0, 0.0,   1 };
    static PEXVector	view_up_vec			= {    0,   1,   0 };

    /*
	 *	Compute the view orientation transform.
	 */
    PEXViewOrientationMatrix( &view_ref_pt, &view_plane_normal,
				    &view_up_vec, view.orientation );
    
    /*
	 *	The view mapping parameters.
	 */
    prp.x = 0.0;
	prp.y = 0.0;
	prp.z =   5;

    window[0].x = -0.8; window[1].x = 0.8;
    window[0].y = -0.9; window[1].y = 0.7;

    front_plane = 3; view_plane = 0; back_plane = -1;

    viewport.min.x = 0; viewport.max.x = 1;
    viewport.min.y = 0; viewport.max.y = 1;
    viewport.min.z = 0; viewport.max.z = 1;
    
    /*
	 *	Compute the view mapping transform.
	 */
    PEXViewMappingMatrix( window, &viewport, True, &prp,
			        view_plane, back_plane, front_plane,
			        view.mapping );
    
    /*
	 *	The view clipping parameters.
	 */
    view.clip_flags		= PEXClipXY;
    view.clip_limits	= viewport;
    
    /*
	 *	Set view 1.
	 */
    PEXSetTableEntries( dpy, view_table, 1, 1, PEXLUTView,
		       (PEXPointer) &view );
}


/* 
 * PEXlib Triangle Strip: Mainline test for all permutations of
 *		data formats.
 */
void draw_image(
		Display				*dpy,
		XID					 res_id,
		PEXOCRequestType	 req_type,
		PEXLookupTable		 light_lut,
		PEXLookupTable		 view_lut )
{	
	/*
	 *	Data declarations
	 */
	int						i;
	float					dx, delta, angle, norm_angle;
	PEXTableIndex			lights_on[4];
	unsigned int			color_index;
	PEXCoord				origin;

	PEXColorIndexed			facet_index[NUM_FACETS];
	PEXColorIndexedNormal	facet_index_normal[NUM_FACETS];

	PEXCoord				twist_pts[NUM_VERTICES];
	PEXCoord				flat_pts[NUM_VERTICES];

	PEXVertexIndexed		pts_index[NUM_VERTICES];
	PEXVertexIndexedNormal	pts_index_normal[NUM_VERTICES];

	PEXArrayOfVertex		vertices;

	unsigned int			facet_attributes, vertex_attributes, count;
	int						color_type;

	PEXArrayOfFacetData		facet_data;

	PEXReflectionAttributes	refl_attributes;

	/*
	 *	Generate the points for the band.
	 */
	dx		= (X_END - X_START)/(NUM_VERTICES - 1);
	delta	= TWIST_ANGLE / (NUM_VERTICES - 1);

	for( i = 0; i < NUM_VERTICES; i += 1 )
	{
		angle			= i * delta;
		twist_pts[i].x	= X_START + i * dx;
		flat_pts[i].x	= twist_pts[i].x;
		flat_pts[i].z	= Z0;

		/*
		 *	Alternate between odd and even for vertices
		 */
		if( !(i & 0x1) ) /* odd or even? */
		{
			twist_pts[i].y	= TWIST_Y0 + STRIP_HALF_WIDTH * cos(angle);
			flat_pts[i].y	= FLAT_Y0  + STRIP_HALF_WIDTH;
			twist_pts[i].z	= Z0       + STRIP_HALF_WIDTH * sin(angle);
		}
		else
		{
			twist_pts[i].y	= TWIST_Y0 - STRIP_HALF_WIDTH * cos(angle);
			flat_pts[i].y	= FLAT_Y0  - STRIP_HALF_WIDTH;
			twist_pts[i].z	= Z0       - STRIP_HALF_WIDTH * sin(angle);
		}
	}

	set_view( dpy, view_lut );

	/*
	 *	Set the view index
	 */
/*
	PEXSetViewIndex( dpy, res_id, req_type, 1 );
*/

	/*
	 *	Build the axes.
	 */
	origin.x = origin.y = origin.z = 0;
	build_axes( dpy, res_id, req_type, &origin, 1.0 );


	/*
	 *	Turn on the lights
	 */
	lights_on[0] = 1;
	lights_on[1] = 2;
	lights_on[2] = 3;
	PEXSetLightSourceState( dpy, res_id, req_type, 3, lights_on, 0,
		((PEXTableIndex *) NULL ));

	/*
	 *	Set the reflection model
	 */
	PEXSetReflectionModel( dpy, res_id, req_type, PEXReflectionSpecular );

	/*
	 *	Set the reflection attributes
	 */
	refl_attributes.ambient							= 1.0;
	refl_attributes.diffuse							= 1.0;
	refl_attributes.specular						= 1.0;
	refl_attributes.specular_conc					= 5.0;
	refl_attributes.transmission					= 0.0;
	refl_attributes.specular_color.type				= PEXColorTypeRGB;
	refl_attributes.specular_color.value.rgb.red	= 0.0;
	refl_attributes.specular_color.value.rgb.green	= 0.0;
	refl_attributes.specular_color.value.rgb.blue	= 1.0;
	PEXSetReflectionAttributes( dpy, res_id, req_type, &refl_attributes );

	/*
	 *	No facet culling
	 */
	PEXSetFacetCullingMode( dpy, res_id, req_type, PEXNone );

	/*
	 *	Front/back facet distinguish
	 */
	PEXSetFacetDistinguishFlag( dpy, res_id, req_type, PEXOff );

	/*
	 *	Hollow interiors for front/back facets
	 */
	PEXSetInteriorStyle( dpy, res_id, req_type, PEXInteriorStyleHollow );
	PEXSetBFInteriorStyle( dpy, res_id, req_type, PEXInteriorStyleHollow );

	/*
	 *	Color index 1 for interior color for front/back facets
	 */
	color_index = 1;
	PEXSetSurfaceColorIndex( dpy, res_id, req_type, color_index );
	PEXSetBFSurfaceColorIndex( dpy, res_id, req_type, color_index );

	/*
	 *	Edges off but set to be magenta colored dashed lines
	 */
	PEXSetSurfaceEdgeFlag( dpy, res_id, req_type, PEXOff );

	/*
	 *	Goraud interior shading
	 */
	PEXSetSurfaceInterpMethod( dpy, res_id, req_type, PEXSurfaceInterpColor );

	/*
	 *	Render the twisted triangle strip with NO optional data.
	 *	Since no optional data is provided, the currently installed
	 *	attributes will be used.  The image should be a white twisted
	 *	triangle strip with hollow interiors and lighting/shading
	 *	effects.
	 *
	 *		FACET DATA:
	 *			color   - None
	 *			normals - None
	 *
	 *		VERTEX DATA:
	 *			color   - None
	 *			normals - None
	 *
	 */
	facet_attributes	= PEXGANone;
	vertex_attributes	= PEXGANone;
	color_type			= PEXColorTypeIndexed;
	count				= NUM_VERTICES;
	vertices.no_data	= twist_pts;
	PEXTriangleStrip(
		dpy, res_id, req_type,
		facet_attributes,
		vertex_attributes,
		color_type,
		facet_data,
		count,
		vertices );


	/*
	 *	Render the flat triangle strip with NO optional data.
	 *	Again, the current pipeline context will be used for
	 *	all attributes, so the image should be just a white flat
	 *	triangle strip with no lighting/shading effects.
	 *	
	 *
	 *		FACET DATA:
	 *			color   - None
	 *			normals - None
	 *
	 *		VERTEX DATA:
	 *			color   - None
	 *			normals - None
	 *
	 */
	vertices.no_data	= flat_pts;
	PEXTriangleStrip(
		dpy, res_id, req_type,
		facet_attributes,
		vertex_attributes,
		color_type,
		facet_data,
		count,
		vertices );

	/*
	 *	Bump the y's down a bit
	 */
	for( i = 0; i < NUM_VERTICES; i++ )
	{
		twist_pts[i].y		-= DOWN;
	}
	vertices.no_data	= twist_pts;

	/*
	 *	Set the top points vertex color to index 3,
	 *	the bottom points to vertex color index 4,
	 *	the odd facets to color index 5 and the even
	 *	facets to color index 6.
	 *	as well as red and green color per facet.
	 */
	for( i = 0; i < NUM_VERTICES; i += 2 )
	{
		facet_index[i].index		= 2.0;
	}
	for( i = 1; i < NUM_VERTICES; i += 2 )
	{
		facet_index[i].index		= 3.0;
	}
	facet_data.index	= facet_index;

	/*
	 *	Render the triangle strip with optional color
	 *	data per vertex and facet.  The interior is hollow
	 *	and if both facet and vertex color data is included,
	 *	the vertex data should override the facet data.  For
	 *	this case, the lines between the top and bottom
	 *	vertices should be interpolated and non-alternating.
	 *	The lighting/shading effects should be the same as
	 *	for the first white twisted strip.
	 *
	 *		FACET DATA:
	 *			color   - Yes, indexed color
	 *			normals - None
	 *
	 *		VERTEX DATA:
	 *			color   - None
	 *			normals - None
	 *
	 */
	facet_attributes	= PEXGAColor;
	vertex_attributes	= PEXGANone;
	PEXTriangleStrip(
		dpy, res_id, req_type,
		facet_attributes,
		vertex_attributes,
		color_type,
		facet_data,
		count,
		vertices );

	/*
	 *	Bump the y's down
	 */
	for( i = 0; i < NUM_VERTICES; i++ )
	{
		twist_pts[i].y		-= DOWN;
		pts_index[i].point	= twist_pts[i];
	}

	/*
	 *	Add indexed color per vertex and color per facet
	 */
	for( i = 0; i < NUM_VERTICES; i += 2 )
	{
		facet_index[i].index		= 2.0;
		pts_index[i].index.index	= 2.0;
	}
	for( i = 1; i < NUM_VERTICES; i += 2 )
	{
		facet_index[i].index		= 3.0;
		pts_index[i].index.index	= 3.0;
	}
	vertices.index	= pts_index;

	/*
	 *	Solid interiors for front/back facets
	 */
	PEXSetInteriorStyle( dpy, res_id, req_type, PEXInteriorStyleSolid );
	PEXSetBFInteriorStyle( dpy, res_id, req_type, PEXInteriorStyleSolid );

	/*
	 *	Render the triangle strip with optional color
	 *	data per vertex and facet.  The interior is now solid
	 *	and if both facet and vertex color data is included,
	 *	the vertex data should override the facet data.  For
	 *	this case, the color between the top and bottom
	 *	vertices should be interpolated and non-alternating.
	 *	The lighting/shading effects should be the same as
	 *	for the first white twisted strip.
	 *
	 *		FACET DATA:
	 *			color   - Yes, indexed color
	 *			normals - None
	 *
	 *		VERTEX DATA:
	 *			color   - Yes, indexed color
	 *			normals - None
	 */
	facet_attributes	= PEXGAColor;
	vertex_attributes	= PEXGAColor;
	PEXTriangleStrip(
		dpy, res_id, req_type,
		facet_attributes,
		vertex_attributes,
		color_type,
		facet_data,
		count,
		vertices );

	/*
	 *	Bump the y's down
	 */
	for( i = 0; i < NUM_VERTICES; i++ )
	{
		flat_pts[i].y		-= DOWN;
		pts_index[i].point	= flat_pts[i];
	}

	/*
	 *	Render the flat triangle strip with optional color
	 *	data per vertex and facet.  The interior is solid
	 *	and if both facet and vertex color data is included,
	 *	the vertex data should override the facet data.  For
	 *	this case, the color between the top and bottom
	 *	vertices should be interpolated and non-alternating.
	 *	The lighting/shading effects should be the same as
	 *	for the first white twisted strip.
	 *	
	 *		FACET DATA:
	 *			color   - Yes, direct RGBs
	 *			normals - None
	 *
	 *		VERTEX DATA:
	 *			color   - Yes, direct RGBs
	 *			normals - None
	 */
	PEXTriangleStrip(
		dpy, res_id, req_type,
		facet_attributes,
		vertex_attributes,
		color_type,
		facet_data,
		count,
		vertices );

	/*
	 *	Bump the y's down a bit
	 */
	for( i = 0; i < NUM_VERTICES; i++ )
	{
		flat_pts[i].y		-= DOWN;
		pts_index[i].point	= flat_pts[i];
	}
	vertices.index	= pts_index;

	/*
	 *	Now include normals per facet along with
	 *	color per facet.
	 */
	for( i = 0; i < NUM_FACETS; i += 2 )
	{
		facet_index_normal[i].index.index	= 2.0;
	}
	for( i = 1; i < NUM_FACETS; i += 2 )
	{
		facet_index_normal[i].index.index	= 3.0;
	}
	norm_angle	= M_PI*2/NUM_FACETS;
	for( i = 0; i < NUM_FACETS; i++ )
	{
		facet_index_normal[i].normal.x = -(cos( norm_angle * i ));
		facet_index_normal[i].normal.y = 0.0;
		facet_index_normal[i].normal.z = (sin( norm_angle * i ));
		if( facet_index_normal[i].normal.z < 0 )
		{
			facet_index_normal[i].normal.x = -facet_index_normal[i].normal.x;
		}
	}
	facet_data.index_normal	= facet_index_normal;

	/*
	 *	Render the flat triangle strip with optional color
	 *	data per vertex and per facet as well as normals per
	 *	facet.  The interior is hollow and if both facet and
	 *	vertex color data is included, the vertex data should
	 *	override the facet data.  For this case, the lines
	 *	between the top and bottom vertices should be
	 *	interpolated and non-alternating.  The lighting/shading
	 *	effects should be the same as for the first white
	 *	twisted strip.
	 *
	 *		FACET DATA:
	 *			color   - Yes, direct RGBs
	 *			normals - Yes
	 *
	 *		VERTEX DATA:
	 *			color   - Yes, direct RGBs
	 *			normals - No
	 *
	 */
	facet_attributes	= PEXGAColor | PEXGANormal;
	vertex_attributes	= PEXGAColor;
	PEXTriangleStrip(
		dpy, res_id, req_type,
		facet_attributes,
		vertex_attributes,
		color_type,
		facet_data,
		count,
		vertices );

	/*
	 *	Bump the y's down a bit
	 */
	for( i = 0; i < NUM_VERTICES; i++ )
	{
		flat_pts[i].y				-= DOWN;
		pts_index_normal[i].point	= flat_pts[i];
		pts_index_normal[i].index	= pts_index[i].index;
	}
	
	/*
	 *	Add the normal per vertex data.
	 */
	norm_angle  = M_PI*2/NUM_VERTICES;
	for( i = 0; i < NUM_VERTICES; i++ )
	{
		pts_index_normal[i].normal.x = -(cos( norm_angle * i ));
		pts_index_normal[i].normal.y = 0.0;
		pts_index_normal[i].normal.z = (sin( norm_angle * i ));
		if( pts_index_normal[i].normal.z < 0 )
		{
			pts_index_normal[i].normal.x = -pts_index_normal[i].normal.x;
		}
	}
	vertices.index_normal	= pts_index_normal;

	/*
	 *	Render the flat triangle strip with optional color
	 *	data per vertex and per facet as well as normals per
	 *	vertex and per facet.  The interior is solid and if
	 *	both facet and vertex optional data is included,
	 *	the vertex data should 	override the facet data.
	 *	This triangle strip, (the last one) should have the
	 *	"S" shaded appearance as the one just above it, but
	 *	the individual shading of each facet should not be
	 *	as dominant as in the case with only facet normals.
	 *
	 *		FACET DATA:
	 *			color   - Yes, direct RGBs
	 *			normals - Yes
	 *
	 *		VERTEX DATA:
	 *			color   - Yes, direct RGBs
	 *			normals - Yes
	 *
	 */
	vertex_attributes	= PEXGAColor | PEXGANormal;
	PEXTriangleStrip(
		dpy, res_id, req_type,
		facet_attributes,
		vertex_attributes,
		color_type,
		facet_data,
		count,
		vertices );

} /* draw_image */


void inquire_test_params(char *test_name, 
			 int  *num_images, 
			 int  *supported_modes, 
			 char *win_title)
{
    strcpy(test_name, "pexocp.95.4");
    *num_images      = 1;
    *supported_modes = IMM_MODE | STR_MODE | WKS_MODE;

    strcpy(win_title, "pexocp.95.4");
}

void misc_setup(Display *dpy, Window window, PEXRenderer renderer,
		int cur_image)
{
    unsigned long         mask = PEXRAHLHSRMode;
    PEXRendererAttributes attrs;
    PEXLightEntry			lights[3];

    attrs.hlhsr_mode = PEXHLHSRZBuffer;

    PEXChangeRenderer(dpy, renderer, mask, &attrs);
    set_view( dpy, viewLUT );
	/*
	 *	Define the Ambient light (weak)
	 */
	lights[0].type					= PEXLightAmbient;
	lights[0].color.type			= PEXColorTypeRGB;
	lights[0].color.value.rgb.red	= 0.5;
	lights[0].color.value.rgb.green	= 0.5;
	lights[0].color.value.rgb.blue	= 0.5;

	/*
	 *	Define the Directional light
	 */
	lights[1].type					= PEXLightWCVector;
	lights[1].direction.x			=  0.0;
	lights[1].direction.y			=  0.0;
	lights[1].direction.z			= -1.0; 
	lights[1].color.type			= PEXColorTypeRGB;
	lights[1].color.value.rgb.red	= 1.0;
	lights[1].color.value.rgb.green	= 1.0;
	lights[1].color.value.rgb.blue	= 1.0;

	/*
	 *	Define the Point light
	 */
	lights[2].type					= PEXLightWCPoint;
	lights[2].point.x				= 0.5;
	lights[2].point.y				= 0.5;
	lights[2].point.z				= 1.0;
	lights[2].attenuation1			= 1.0;
	lights[2].attenuation2			= 1.0;
	lights[2].concentration			= 1.0;
	lights[2].spread_angle			= 0.01;
	lights[2].color.type			= PEXColorTypeRGB;
	lights[2].color.value.rgb.red	= 1.0;
	lights[2].color.value.rgb.green	= 1.0;
	lights[2].color.value.rgb.blue	= 1.0;


	PEXSetTableEntries( dpy, lightLUT, 1, 3, PEXLUTLight, lights );
}

void execute_test(Display *dpy, XID resourceID, 
	       PEXOCRequestType req_type, int cur_image)
{
    describe_test( "\nPEXTriangleStrip Mainline Test:\n" );
    describe_test( "\n" );
    describe_test( "You should see 7 Triangle Strips, the top three twisted\n" );
    describe_test( "and the bottom four flat.  Three lights are on, one ambient\n" );
    describe_test( "white light, one white point light, and one white directional\n" );
    describe_test( "light.  The specular reflection color is blue.  The Triangle\n" );
    describe_test( "Strips appearances should be as follows:\n" );
    describe_test( "\n" );
    describe_test( "#1 - White with hollow interior and the left side brighter\n" );
    describe_test( "     than the right side.  (No optional data here)\n" );
    describe_test( "\n" );
    describe_test( "#2 - Red/yellow indexed color with hollow interior and the left side\n" );
    describe_test( "     brighter than the right side.  Some of the blue specular reflection\n" );
    describe_test( "     should be apparent as magenta/white on the leftmost part\n" );
    describe_test( "     of the strip.  (Color per vertex and facet are included as optional\n" );
    describe_test( "     data)\n" );
    describe_test( "\n" );
    describe_test( "#3 - Same as above but with solid interior.  The specular coloring\n" );
    describe_test( "     should be more evident.\n" );
    describe_test( "\n" );
    describe_test( "#4 - Same as #1 but with no twist, the whole strip is front facing.\n" );
    describe_test( "     (No optional data here either)\n" );
    describe_test( "\n" );
    describe_test( "#5 - Same as #4 but with red/yellow color per vertex with the specular\n" );
    describe_test( "     color (blue) blending with the red/yellow color per vertex.\n" );
    describe_test( "     (Color per vertex and facet is included as optional data)\n" );
    describe_test( "\n" );
    describe_test( "#6 - Same as #4 but with normals per vertex to make it look like\n" );
    describe_test( "     a sideways S to the lighting calculations.  Both sides\n" );
    describe_test( "     should show lighting effects (front facing) with \n" );
    describe_test( "     a dull spot in the middle. (Normals per facet are\n" );
    describe_test( "     included as optional data)\n" );
    describe_test( "\n" );
    describe_test( "#7 - Same as above but with both normals and color per vertex and per\n" );
    describe_test( "     facet are included.  Note the specular reflections. \n" );

    draw_image( dpy, resourceID, req_type, lightLUT, viewLUT );
}

void testproc(Display *dpy, Window window, int cur_image)
{
     image_testproc("pexocp.95.4", "pexocp.95.4", img_desc,
		      dpy,window, 0, 0, 
		      glob_window_width, glob_window_height);
}