-/* $Id: drawpix.c,v 1.7 2002/04/22 16:03:37 brianp Exp $ */
+/* $Id: drawpix.c,v 1.8 2002/07/12 15:54:02 brianp Exp $ */
/*
* glDrawPixels demo/test/benchmark
if (ciMode) {
/* Convert RGB image to grayscale */
- GLubyte *indexImage = malloc( ImgWidth * ImgHeight );
+ GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
GLint i;
for (i=0; i<ImgWidth*ImgHeight; i++) {
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.1);
- p = malloc(sizeof(part) * np);
+ p = (part *) malloc(sizeof(part) * np);
for (i = 0; i < np; i++)
setnewpart(&p[i]);
-/* $Id: paltex.c,v 1.7 2002/01/16 00:48:43 kschultz Exp $ */
+/* $Id: paltex.c,v 1.8 2002/07/12 15:54:02 brianp Exp $ */
/*
* Paletted texture demo. Written by Brian Paul.
0, /* border */
GL_COLOR_INDEX, /* texture format */
GL_UNSIGNED_BYTE, /* texture type */
- texture); /* teh texture */
+ texture); /* the texture */
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-/* $Id: readpix.c,v 1.7 2002/05/02 09:17:59 alanh Exp $ */
+/* $Id: readpix.c,v 1.8 2002/07/12 15:54:02 brianp Exp $ */
/*
* glReadPixels and glCopyPixels test
if (ciMode) {
/* Convert RGB image to grayscale */
- GLubyte *indexImage = malloc( ImgWidth * ImgHeight );
+ GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
GLint i;
for (i=0; i<ImgWidth*ImgHeight; i++) {
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
-/* $Id: shadowtex.c,v 1.6 2002/03/23 16:34:18 brianp Exp $ */
+/* $Id: shadowtex.c,v 1.7 2002/07/12 15:54:02 brianp Exp $ */
/*
* Shadow demo using the GL_ARB_depth_texture, GL_ARB_shadow and
*/
if (DisplayMode == SHOW_DEPTH_MAPPING) {
/* load depth image as gray-scale luminance texture */
- GLfloat *depth = malloc(ShadowTexWidth * ShadowTexHeight
- * sizeof(GLfloat));
+ GLfloat *depth = (GLfloat *) malloc(ShadowTexWidth * ShadowTexHeight
+ * sizeof(GLfloat));
if (depth) {
glReadPixels(0, 0, ShadowTexWidth, ShadowTexHeight,
GL_DEPTH_COMPONENT, GL_FLOAT, depth);
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
+#include <string.h>
#include <time.h>
#ifdef WIN32
-/* $Id: tessdemo.c,v 1.11 2001/03/21 02:47:32 gareth Exp $ */
+/* $Id: tessdemo.c,v 1.12 2002/07/12 15:54:02 brianp Exp $ */
/*
* A demo of the GLU polygon tesselation functions written by Bogdan Sikorski.
height = h;
}
+typedef void (GLAPIENTRY *callback_t)();
+
static void tesse( void )
{
GLUtesselator *tobj;
if ( tobj != NULL ) {
gluTessNormal( tobj, 0.0, 0.0, 1.0 );
- gluTessCallback( tobj, GLU_TESS_BEGIN, glBegin );
- gluTessCallback( tobj, GLU_TESS_VERTEX, glVertex2fv );
- gluTessCallback( tobj, GLU_TESS_END, glEnd );
- gluTessCallback( tobj, GLU_TESS_ERROR, error_callback );
- gluTessCallback( tobj, GLU_TESS_COMBINE, combine_callback );
+ gluTessCallback( tobj, GLU_TESS_BEGIN, (callback_t) glBegin );
+ gluTessCallback( tobj, GLU_TESS_VERTEX, (callback_t) glVertex2fv );
+ gluTessCallback( tobj, GLU_TESS_END, (callback_t) glEnd );
+ gluTessCallback( tobj, GLU_TESS_ERROR, (callback_t) error_callback );
+ gluTessCallback( tobj, GLU_TESS_COMBINE, (callback_t) combine_callback );
glNewList( list_start, GL_COMPILE );
gluBeginPolygon( tobj );
gluEndPolygon( tobj );
glEndList();
- gluTessCallback( tobj, GLU_TESS_BEGIN, begin_callback );
- gluTessCallback( tobj, GLU_TESS_VERTEX, vertex_callback );
- gluTessCallback( tobj, GLU_TESS_END, end_callback );
- gluTessCallback( tobj, GLU_TESS_EDGE_FLAG, edge_callback );
+ gluTessCallback( tobj, GLU_TESS_BEGIN, (callback_t) begin_callback );
+ gluTessCallback( tobj, GLU_TESS_VERTEX, (callback_t) vertex_callback );
+ gluTessCallback( tobj, GLU_TESS_END, (callback_t) end_callback );
+ gluTessCallback( tobj, GLU_TESS_EDGE_FLAG, (callback_t) edge_callback );
glNewList( list_start + 1, GL_COMPILE );
gluBeginPolygon( tobj );
-/* $Id: trispd.c,v 1.3 2002/04/22 16:03:37 brianp Exp $ */
+/* $Id: trispd.c,v 1.4 2002/07/12 15:54:02 brianp Exp $ */
/*
* Simple GLUT program to measure triangle strip rendering speed.
{
GLubyte *pixels;
int x, y;
- pixels = malloc(4*256*256);
+ pixels = (GLubyte *) malloc(4*256*256);
for (y = 0; y < 256; ++y)
for (x = 0; x < 256; ++x) {
pixels[(y*256+x)*4+0] = (int)(128.5 + 127.0 * cos(0.024544 * x));
pointer = (GLdouble *) vertex;
glColor3dv(pointer+3);
- glVertex3dv(vertex);
+ glVertex3dv(pointer);
}
/* combineCallback is used to create a new vertex when edges
exit(1);
}
- result = malloc(sizeof(PPMImage));
+ result = (PPMImage *) malloc(sizeof(PPMImage));
if (!result)
{
fprintf(stderr, "Unable to allocate memory\n");
while (fgetc(fp) != '\n')
;
- result->data = malloc(3 * result->sizeX * result->sizeY);
+ result->data = (GLubyte *) malloc(3 * result->sizeX * result->sizeY);
if (!result)
{
fprintf(stderr, "Unable to allocate memory\n");
}
}
+typedef void (GLAPIENTRY *callback_t)();
+
static void Init(void)
{
theNurbs = gluNewNurbsRenderer();
- gluNurbsCallback(theNurbs, GLU_ERROR, ErrorCallback);
+ gluNurbsCallback(theNurbs, GLU_ERROR, (callback_t) ErrorCallback);
gluNurbsProperty(theNurbs, GLU_SAMPLING_TOLERANCE, 15.0);
gluNurbsProperty(theNurbs, GLU_DISPLAY_MODE, GLU_OUTLINE_PATCH);
fprintf(stderr, "Quad Error: %s\n", gluErrorString(which));
}
+typedef void (GLAPIENTRY *callback_t)();
+
static void Init(void)
{
static GLint colorIndexes[3] = {0, 200, 255};
}
quadObj = gluNewQuadric();
- gluQuadricCallback(quadObj, GLU_ERROR, ErrorHandler);
+ gluQuadricCallback(quadObj, GLU_ERROR, (callback_t) ErrorHandler);
radius1 = 10;
radius2 = 5;
-/* $Id: glxinfo.c,v 1.15 2002/03/08 19:44:28 brianp Exp $ */
+/* $Id: glxinfo.c,v 1.16 2002/07/12 15:54:02 brianp Exp $ */
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
const char *gluExtensions = (const char *) gluGetString(GLU_EXTENSIONS);
#endif
/* Strip the screen number from the display name, if present. */
- if (!(displayName = malloc(strlen(DisplayString(dpy)) + 1))) {
+ if (!(displayName = (char *) malloc(strlen(DisplayString(dpy)) + 1))) {
fprintf(stderr, "Error: malloc() failed\n");
exit(1);
}
static void
print_visual_info(Display *dpy, int scrnum, InfoMode mode)
{
- XVisualInfo template;
+ XVisualInfo theTemplate;
XVisualInfo *visuals;
int numVisuals;
long mask;
int i;
/* get list of all visuals on this screen */
- template.screen = scrnum;
+ theTemplate.screen = scrnum;
mask = VisualScreenMask;
- visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals);
+ visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals);
if (mode == Verbose) {
for (i = 0; i < numVisuals; i++) {
static int
find_best_visual(Display *dpy, int scrnum)
{
- XVisualInfo template;
+ XVisualInfo theTemplate;
XVisualInfo *visuals;
int numVisuals;
long mask;
struct visual_attribs bestVis;
/* get list of all visuals on this screen */
- template.screen = scrnum;
+ theTemplate.screen = scrnum;
mask = VisualScreenMask;
- visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals);
+ visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals);
/* init bestVis with first visual info */
get_visual_attribs(dpy, &visuals[0], &bestVis);
-/* $Id: glxpixmap.c,v 1.2 2000/07/11 16:05:29 brianp Exp $ */
+/* $Id: glxpixmap.c,v 1.3 2002/07/12 15:54:02 brianp Exp $ */
/*
#include <GL/gl.h>
+#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
#include <stdio.h>
#include <stdlib.h>