~pali/mesa/mesa-demos

« back to all changes in this revision

Viewing changes to src/demos/fogcoord.c

  • Committer: Jose Fonseca
  • Date: 2020-09-16 09:03:35 UTC
  • Revision ID: git-v1:5435fc7fbd332e171da9a71e33a9b190e9462cf0
Use glad instead of GLEW.

glad is a more modern, cleaner, and flexible alternative to GLEW.  In
particular it has first-class citizen support for OpenGL ES end EGL.

Glad can't be used just for defines.  For old demos which only need
defines, we could bundle Khronos glext, but for now place the necessary
defines on gl_wrap.h

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#include <stdio.h>
11
11
#include <stdlib.h>
12
12
#include <math.h>
13
 
#include <GL/glew.h>
 
13
#include <glad/glad.h>
14
14
#include "glut_wrap.h"
15
15
 
16
16
#define DEPTH 5.0f
116
116
static GLboolean
117
117
SetFogCoord(GLboolean fogCoord)
118
118
{
119
 
   if (!GLEW_EXT_fog_coord) {
 
119
   if (!GLAD_GL_EXT_fog_coord) {
120
120
      return GL_FALSE;
121
121
   }
122
122
 
365
365
 
366
366
   printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
367
367
 
368
 
   if (!GLEW_EXT_fog_coord) {
 
368
   if (!GLAD_GL_EXT_fog_coord) {
369
369
      printf("GL_EXT_fog_coord not supported!\n");
370
370
   }
371
371
 
392
392
   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
393
393
   glTexCoordPointer(2, GL_FLOAT, 0, texcoord_pointer);
394
394
 
395
 
   if (GLEW_EXT_fog_coord) {
 
395
   if (GLAD_GL_EXT_fog_coord) {
396
396
      glEnableClientState(GL_FOG_COORDINATE_ARRAY_EXT);
397
397
      glFogCoordPointerEXT(GL_FLOAT, 0, fogcoord_pointer);
398
398
   }
408
408
   glutInit( &argc, argv );
409
409
   glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
410
410
   glutCreateWindow(argv[0]);
411
 
   glewInit();
 
411
   gladLoadGL();
412
412
   glutReshapeFunc( Reshape );
413
413
   glutKeyboardFunc( Key );
414
414
   glutDisplayFunc( Display );