Table of Contents Glide Programming Guide


State Coherency and Contention Between Processes



Download 6.22 Mb.
Page100/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   96   97   98   99   100   101   102   103   ...   106
GLIDEPGM

7State Coherency and Contention Between Processes


Neither the Voodoo Graphics hardware nor Glide handle resource contention management in multithreaded or multitasking environments. Thus, an application that has multiple threads or processes accessing Glide and/or the Voodoo Graphics hardware must maintain state coherency and perform context management manually using some form of mutual exclusion management.
  1. Appendix A. A Sample Program


/*
** Copyright (c) 1995, 3Dfx Interactive, Inc.
** All Rights Reserved.
**
** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.;
** the contents of this file may not be disclosed to third parties, copied or
** duplicated in any form, in whole or in part, without the prior written
** permission of 3Dfx Interactive, Inc.
**
** RESTRICTED RIGHTS LEGEND:
** Use, duplication or disclosure by the Government is subject to restrictions
** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
** rights reserved under the Copyright Laws of the United States.
**
** $Id: test05.c,v 1.1 1995/06/30 06:47:04 garymct Exp $
*/
#ifdef __DOS__
#include
#endif
#include
#include
#include
#include

GrHwConfiguration hwconfig;


void main( void )


{ float color = 255.0;

puts( "\nTEST05:" );


puts( "renders a Gouraud-shaded triangle" );
#ifdef __DOS__
puts( "press a key to continue" );
getch();
#endif

grGlideInit();


if ( !grSstQueryHardware( &hwconfig ) )


grErrorSetCallback( "main: grSstQueryHardware failed!", FXTRUE );

/* Select SST 0 and open up the hardware */


grSstSelect( 0 );
if ( !grSstWinOpen( NULL, GR_RESOLUTION_640x480, GR_REFRESH_60Hz,
GR_COLORFORMAT_ABGR, GR_ORIGIN_LOWER_LEFT, 2, 0 ) )
grErrorSetCallback( "main: grSstWinOpen failed!", FXTRUE );

while ( 1 ) {


GrVertex vtx1, vtx2, vtx3;

grBufferClear( 0, 0, GR_WDEPTHVALUE_FARTHEST );


guColorCombineFunction( GR_COLORCOMBINE_ITRGB );

vtx1.x = 160;


vtx1.y = 120;
vtx1.r = color;
vtx1.g = 0;
vtx1.b = 0;
vtx1.a = 0;
vtx2.x = 480;
vtx2.y = 180;
vtx2.r = 0;
vtx2.g = color;
vtx2.b = 0;
vtx2.a = 128;
vtx3.x = 320;
vtx3.y = 360;
vtx3.r = 0;
vtx3.g = 0;
vtx3.b = color;
vtx3.a = 255;
grDrawTriangle( &vtx1, &vtx2, &vtx3 );

grBufferSwap( 1 );


#ifdef __DOS__
getch();
break;
#endif

}
grGlideShutdown();


}

  1. Download 6.22 Mb.

    Share with your friends:
1   ...   96   97   98   99   100   101   102   103   ...   106




The database is protected by copyright ©ininet.org 2024
send message

    Main page