<commit_before>/* Copyright (c) 2001, Stanford University
 * All rights reserved.
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

/*

  exec.cpp

  This is an example of GL_EXT_blend_color, described
  on page 86 of the NVidia OpenGL Extension Specifications.

  <NAME>, <EMAIL>, 6/27/2001

*/

/* --- Preprocessor --------------------------------------------------------- */

#include <stdlib.h>
#include "exec.h"
#include "../common/logo.h"

typedef void (APIENTRY * GLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);

GLBLENDCOLOREXTPROC glBlendColor_ext;


/* --- Global Variables ----------------------------------------------------- */

GLuint	currentWidth, currentHeight;

static GLuint	texture[1];
static GLfloat	bgColor[4] = { 0.2, 0.3, 0.8, 0.0 };


/* --- Function Definitions ------------------------------------------------- */

void	InitGL	( void )
{
	currentWidth = 320;
	currentHeight = 240;

#ifdef MULTIPLE_VIEWPORTS
	currentWidth <<= 1;
#endif

	glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE );
	glutInitWindowPosition( 5, 25 );
	glutInitWindowSize( currentWidth, currentHeight );
	glutCreateWindow( TEST_EXTENSION_STRING );
	
	glClearColor( bgColor[0], bgColor[1], bgColor[2], bgColor[3] );
	glClear( GL_COLOR_BUFFER_BIT );
	
	glutIdleFunc( Idle );
	glutDisplayFunc( Display );
	glutReshapeFunc( Reshape );
	glutKeyboardFunc( Keyboard );
	glutMouseFunc( NULL );
	glutMotionFunc( NULL );
	glutSpecialFunc( NULL );
}


void	InitSpecial	( void )
{
	GLubyte	textureData[ 32*32 ];

	for( int x=0; x<32; x++ )
	{
		for( int y=0; y<32; y++ )
		{
			if(( x < 16 && y < 16 ) || ( x >= 16 && y >= 16 ))
				textureData[ y*32+x ] = 0;
			else
				textureData[ y*32+x ] = 255;
		}
	}
	
	// Create the tile texture.
	glGenTextures( 1, texture );
	
	// Create Trilinear MipMapped Texture
	glBindTexture( GL_TEXTURE_2D, texture[0] );
	glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST );
	glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR );
	gluBuild2DMipmaps( GL_TEXTURE_2D, GL_LUMINANCE, 32, 32, GL_LUMINANCE, GL_UNSIGNED_BYTE, textureData );
	
#ifdef WIN32
	glBlendColor_ext = (GLBLENDCOLOREXTPROC)wglGetProcAddress( "glBlendColorEXT" );
#else
	glBlendColor_ext = (GLBLENDCOLOREXTPROC)glXGetProcAddressARB( (const GLubyte *) "glBlendColorEXT" );
#endif
	if ( glBlendColor_ext == NULL )
	{
		cout << "Error linking to extensions!" << endl;
		exit( 0 );
	}

	return;
}


void	Idle		( void )
{
	glutPostRedisplay();
	return;
}


void	Display		( void )
{
	const float		size = 50.0;
	static double	theta = 0.0;

	glClear( GL_COLOR_BUFFER_BIT );
	
	theta += 0.005;

	glLoadIdentity();<commit_msg>work-around glXGetProcAddressARB missing in IRIX libGL<commit_after>/* Copyright (c) 2001, Stanford University
 * All rights reserved.
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

/*

  exec.cpp

  This is an example of GL_EXT_blend_color, described
  on page 86 of the NVidia OpenGL Extension Specifications.

  <NAME>, <EMAIL>, 6/27/2001

*/

/* --- Preprocessor --------------------------------------------------------- */

#include <stdlib.h>
#include "exec.h"
#include "../common/logo.h"

typedef void (APIENTRY * GLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);

GLBLENDCOLOREXTPROC glBlendColor_ext;


/* --- Global Variables ----------------------------------------------------- */

GLuint	currentWidth, currentHeight;

static GLuint	texture[1];
static GLfloat	bgColor[4] = { 0.2, 0.3, 0.8, 0.0 };


/* --- Function Definitions ------------------------------------------------- */

void	InitGL	( void )
{
	currentWidth = 320;
	currentHeight = 240;

#ifdef MULTIPLE_VIEWPORTS
	currentWidth <<= 1;
#endif

	glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE );
	glutInitWindowPosition( 5, 25 );
	glutInitWindowSize( currentWidth, currentHeight );
	glutCreateWindow( TEST_EXTENSION_STRING );
	
	glClearColor( bgColor[0], bgColor[1], bgColor[2], bgColor[3] );
	glClear( GL_COLOR_BUFFER_BIT );
	
	glutIdleFunc( Idle );
	glutDisplayFunc( Display );
	glutReshapeFunc( Reshape );
	glutKeyboardFunc( Keyboard );
	glutMouseFunc( NULL );
	glutMotionFunc( NULL );
	glutSpecialFunc( NULL );
}


void	InitSpecial	( void )
{
	GLubyte	textureData[ 32*32 ];

	for( int x=0; x<32; x++ )
	{
		for( int y=0; y<32; y++ )
		{
			if(( x < 16 && y < 16 ) || ( x >= 16 && y >= 16 ))
				textureData[ y*32+x ] = 0;
			else
				textureData[ y*32+x ] = 255;
		}
	}
	
	// Create the tile texture.
	glGenTextures( 1, texture );
	
	// Create Trilinear MipMapped Texture
	glBindTexture( GL_TEXTURE_2D, texture[0] );
	glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST );
	glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR );
	gluBuild2DMipmaps( GL_TEXTURE_2D, GL_LUMINANCE, 32, 32, GL_LUMINANCE, GL_UNSIGNED_BYTE, textureData );
	
#ifdef WIN32
	glBlendColor_ext = (GLBLENDCOLOREXTPROC)wglGetProcAddress( "glBlendColorEXT" );
#elif defined(IRIX)
	glBlendColor_ext = glBlendColorEXT;
#else
	glBlendColor_ext = (GLBLENDCOLOREXTPROC)glXGetProcAddressARB( (const GLubyte *) "glBlendColorEXT" );
#endif
	if ( glBlendColor_ext == NULL )
	{
		cout << "Error linking to extensions!" << endl;
		exit( 0 );
	}

	return;
}


void	Idle		( void )
{
	glutPostRedisplay();
	return;
}


void	Display		( void )
{
	const float		size = 50.0;
	static double	theta = 0.0;

	glClear( GL_COLOR_BUFFER_BIT );
	
	theta += 0.005;

	glLoadIdentity();
{'fraction_non_alphanumeric': 0.1754894851341552, 'fraction_numerical': 0.03118201595358956, 'mean_word_length': 3.2340752110514197, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5312946', 'n_tokens_mistral': 2224, 'n_tokens_neox': 1969, 'n_words': 456}