ref: 75d8d14bd96170dd3395a2e1329ba2dd2b920e6e
parent: e215ef38e157469b503c7322b22d4a80875f8ae9
author: David <gek@katherine>
date: Mon Feb 15 10:30:56 EST 2021
Now compiling without ANY warnings
--- a/SDL_Examples/gears.c
+++ b/SDL_Examples/gears.c
@@ -24,40 +24,40 @@
GLubyte stipplepattern[128] = {
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA
+ 0x55,0x55,0x55,0x55
};
/*
@@ -312,7 +312,7 @@
SDL_WM_SetCaption(argv[0],0);
// initialize TinyGL:
- unsigned int pitch;
+ //unsigned int pitch;
int mode;
switch( screen->format->BitsPerPixel ) {
case 8:
@@ -320,19 +320,19 @@
fprintf(stderr,"\nUnsupported by maintainer!!!");
return 1;
case 16:
- pitch = screen->pitch;
+ //pitch = screen->pitch;
//fprintf(stderr,"\nUnsupported by maintainer!!!");
mode = ZB_MODE_5R6G5B;
//return 1;
break;
case 24:
- pitch = ( screen->pitch * 2 ) / 3;
+ //pitch = ( screen->pitch * 2 ) / 3;
fprintf(stderr,"\nUnsupported by maintainer!!!");
mode = ZB_MODE_RGB24;
return 1;
break;
case 32:
- pitch = screen->pitch / 2;
+ //pitch = screen->pitch / 2;
mode = ZB_MODE_RGBA;
break;
default:
--- a/SDL_Examples/helloworld.c
+++ b/SDL_Examples/helloworld.c
@@ -123,7 +123,7 @@
SDL_WM_SetCaption(argv[0],0);
// initialize TinyGL:
- unsigned int pitch;
+ //unsigned int pitch;
int mode;
switch( screen->format->BitsPerPixel ) {
case 8:
@@ -131,19 +131,19 @@
fprintf(stderr,"\nUnsupported by maintainer!!!");
return 1;
case 16:
- pitch = screen->pitch;
+
//fprintf(stderr,"\nUnsupported by maintainer!!!");
mode = ZB_MODE_5R6G5B;
//return 1;
break;
case 24:
- pitch = ( screen->pitch * 2 ) / 3;
+
fprintf(stderr,"\nUnsupported by maintainer!!!");
mode = ZB_MODE_RGB24;
return 1;
break;
case 32:
- pitch = screen->pitch / 2;
+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 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA,
+ 0x55,0x55,0x55,0x55,
0xAA,0xAA,0xAA,0xAA,
- ~0xAA,~0xAA,~0xAA,~0xAA
+ 0x55,0x55,0x55,0x55
};
@@ -302,7 +302,6 @@
SDL_WM_SetCaption(argv[0],0);
// initialize TinyGL:
- unsigned int pitch;
int mode;
switch( screen->format->BitsPerPixel ) {
case 8:
@@ -310,19 +309,16 @@
fprintf(stderr,"\nUnsupported by maintainer!!!");
return 1;
case 16:
- pitch = screen->pitch;
//fprintf(stderr,"\nUnsupported by maintainer!!!");
mode = ZB_MODE_5R6G5B;
//return 1;
break;
case 24:
- pitch = ( screen->pitch * 2 ) / 3;
fprintf(stderr,"\nUnsupported by maintainer!!!");
mode = ZB_MODE_RGB24;
return 1;
break;
case 32:
- pitch = screen->pitch / 2;
mode = ZB_MODE_RGBA;
break;
default:
--- /dev/null
+++ b/SDL_Examples/quick.sh
@@ -1,0 +1,14 @@
+#/bin/bash
+#escape character is used here to add a slash
+#This script was used to move these files to include.
+#sed -i 's/\"zbuffer.h/\"include\/zbuffer.h/g' *.c *.h
+#sed -i 's/\"zfeatures.h/\"include\/zfeatures.h/g' *.c *.h
+#sed -i 's/unsigned int/GLuint/g' *.c *.h
+#sed -i 's/float/GLfloat/g' *.c *.h
+#sed -i 's/char/GLbyte/g' *.c *.h
+#sed -i 's/unsigned GLbyte/GLubyte/g' *.c *.h
+#sed -i 's/ int/ GLint/g' *.c *.h
+#sed -i 's/unsigned GLshort/GLushort/g' *.c *.h
+sed -i 's/\~0xAA/0x55/g' *.c
+
+#gcc *.c -o executable.out -lglut -lGL -lm -lGLU
--- a/SDL_Examples/texture.c
+++ b/SDL_Examples/texture.c
@@ -47,9 +47,6 @@
return t;
}
-static GLfloat view_rotx=20.0, view_roty=30.0;
-static GLint gear1, gear2, gear3;
-static GLfloat angle = 0.0;
void draw() {
glEnable(GL_TEXTURE_2D);
@@ -83,9 +80,7 @@
void initScene() {
static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0 };
- static GLfloat red[4] = {1.0, 0.0, 0.0, 0.0 };
- static GLfloat green[4] = {0.0, 1.0, 0.0, 0.0 };
- static GLfloat blue[4] = {0.0, 0.0, 1.0, 0.0 };
+
static GLfloat white[4] = {1.0, 1.0, 1.0, 0.0 };
glLightfv( GL_LIGHT0, GL_POSITION, pos );
@@ -159,7 +154,7 @@
SDL_WM_SetCaption(argv[0],0);
// initialize TinyGL:
- unsigned int pitch;
+
int mode;
switch( screen->format->BitsPerPixel ) {
case 8:
@@ -167,19 +162,19 @@
fprintf(stderr,"\nUnsupported by maintainer!!!");
return 1;
case 16:
- pitch = screen->pitch;
+
//fprintf(stderr,"\nUnsupported by maintainer!!!");
mode = ZB_MODE_5R6G5B;
//return 1;
break;
case 24:
- pitch = ( screen->pitch * 2 ) / 3;
+
fprintf(stderr,"\nUnsupported by maintainer!!!");
mode = ZB_MODE_RGB24;
return 1;
break;
case 32:
- pitch = screen->pitch / 2;
+
mode = ZB_MODE_RGBA;
break;
default:
@@ -193,7 +188,7 @@
glClearColor (0.0, 0.0, 0.0, 0.0);
glViewport (0, 0, winSizeX, winSizeY);
glEnable(GL_DEPTH_TEST);
- GLfloat h = (GLfloat) winSizeY / (GLfloat) winSizeX;
+ //GLfloat h = (GLfloat) winSizeY / (GLfloat) winSizeX;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//glFrustum( -1.0, 1.0, -h, h, 5.0, 60.0 );
@@ -218,17 +213,6 @@
while( SDL_PollEvent( &evt ) ) switch(evt.type) {
case SDL_KEYDOWN:
switch(evt.key.keysym.sym) {
- case SDLK_UP:
- view_rotx += 5.0;
- break;
- case SDLK_DOWN:
- view_rotx -= 5.0;
- break;
- case SDLK_LEFT:
- view_roty += 5.0;
- break;
- case SDLK_RIGHT:
- view_roty -= 5.0;
break;
case SDLK_ESCAPE :
case SDLK_q :