Quellcode durchsuchen

removed glu includes

Thomas Buck vor 10 Jahren
Ursprung
Commit
4ba21cd02a
7 geänderte Dateien mit 30 neuen und 53 gelöschten Zeilen
  1. 0
    2
      src/Console.cpp
  2. 0
    2
      src/Emitter.cpp
  3. 0
    2
      src/Game.cpp
  4. 0
    2
      src/Menu.cpp
  5. 28
    30
      src/Render.cpp
  6. 2
    13
      src/Texture.cpp
  7. 0
    2
      src/Window.cpp

+ 0
- 2
src/Console.cpp Datei anzeigen

7
 
7
 
8
 #ifdef __APPLE__
8
 #ifdef __APPLE__
9
 #include <OpenGL/gl.h>
9
 #include <OpenGL/gl.h>
10
-#include <OpenGL/glu.h>
11
 #else
10
 #else
12
 #include <GL/gl.h>
11
 #include <GL/gl.h>
13
-#include <GL/glu.h>
14
 #endif
12
 #endif
15
 
13
 
16
 #include "config.h"
14
 #include "config.h"

+ 0
- 2
src/Emitter.cpp Datei anzeigen

11
 
11
 
12
 #ifdef __APPLE__
12
 #ifdef __APPLE__
13
 #include <OpenGL/gl.h>
13
 #include <OpenGL/gl.h>
14
-#include <OpenGL/glu.h>
15
 #else
14
 #else
16
 #include <GL/gl.h>
15
 #include <GL/gl.h>
17
-#include <GL/glu.h>
18
 #endif
16
 #endif
19
 
17
 
20
 #include "Emitter.h"
18
 #include "Emitter.h"

+ 0
- 2
src/Game.cpp Datei anzeigen

7
 
7
 
8
 #ifdef __APPLE__
8
 #ifdef __APPLE__
9
 #include <OpenGL/gl.h>
9
 #include <OpenGL/gl.h>
10
-#include <OpenGL/glu.h>
11
 #else
10
 #else
12
 #include <GL/gl.h>
11
 #include <GL/gl.h>
13
-#include <GL/glu.h>
14
 #endif
12
 #endif
15
 
13
 
16
 #include <algorithm>
14
 #include <algorithm>

+ 0
- 2
src/Menu.cpp Datei anzeigen

7
 
7
 
8
 #ifdef __APPLE__
8
 #ifdef __APPLE__
9
 #include <OpenGL/gl.h>
9
 #include <OpenGL/gl.h>
10
-#include <OpenGL/glu.h>
11
 #else
10
 #else
12
 #include <GL/gl.h>
11
 #include <GL/gl.h>
13
-#include <GL/glu.h>
14
 #endif
12
 #endif
15
 
13
 
16
 #include "config.h"
14
 #include "config.h"

+ 28
- 30
src/Render.cpp Datei anzeigen

10
 
10
 
11
 #ifdef __APPLE__
11
 #ifdef __APPLE__
12
 #include <OpenGL/gl.h>
12
 #include <OpenGL/gl.h>
13
-#include <OpenGL/glu.h>
14
 #else
13
 #else
15
 #include <GL/gl.h>
14
 #include <GL/gl.h>
16
-#include <GL/glu.h>
17
 #endif
15
 #endif
18
 
16
 
19
 #include <stdlib.h>
17
 #include <stdlib.h>
439
 
437
 
440
 // Replaced the deprecated gluLookAt with slightly modified code from here:
438
 // Replaced the deprecated gluLookAt with slightly modified code from here:
441
 // http://www.khronos.org/message_boards/showthread.php/4991
439
 // http://www.khronos.org/message_boards/showthread.php/4991
442
-void CrossProd(float x1, float y1, float z1, float x2, float y2, float z2, float res[3])
443
-{
444
-    res[0] = y1*z2 - y2*z1;
445
-    res[1] = x2*z1 - x1*z2;
446
-    res[2] = x1*y2 - x2*y1;
447
-}
448
-void deprecated_gluLookAt(float eyeX, float eyeY, float eyeZ, float lookAtX, float lookAtY, float lookAtZ, float upX, float upY, float upZ)
449
-{
440
+void gluLookAt(float eyeX, float eyeY, float eyeZ,
441
+                            float lookAtX, float lookAtY, float lookAtZ,
442
+                            float upX, float upY, float upZ) {
450
     float f[3];
443
     float f[3];
444
+
451
     // calculating the viewing vector
445
     // calculating the viewing vector
452
     f[0] = lookAtX - eyeX;
446
     f[0] = lookAtX - eyeX;
453
     f[1] = lookAtY - eyeY;
447
     f[1] = lookAtY - eyeY;
454
     f[2] = lookAtZ - eyeZ;
448
     f[2] = lookAtZ - eyeZ;
455
     float fMag, upMag;
449
     float fMag, upMag;
456
-    fMag = sqrtf(f[0]*f[0] + f[1]*f[1] + f[2]*f[2]);
457
-    upMag = sqrtf(upX*upX + upY*upY + upZ*upZ);
450
+    fMag = sqrtf(f[0] * f[0] + f[1] * f[1] + f[2] * f[2]);
451
+    upMag = sqrtf(upX * upX + upY * upY + upZ * upZ);
452
+
458
     // normalizing the viewing vector
453
     // normalizing the viewing vector
459
-    f[0] = f[0]/fMag;
460
-    f[1] = f[1]/fMag;
461
-    f[2] = f[2]/fMag;
462
-    // normalising the up vector. no need for this here if you have your
463
-    // up vector already normalised, which is mostly the case.
464
-    upX = upX/upMag;
465
-    upY = upY/upMag;
466
-    upZ = upZ/upMag;
467
-    float s[3], u[3];
468
-    CrossProd(f[0], f[1], f[2], upX, upY, upZ, s);
469
-    CrossProd(s[0], s[1], s[2], f[0], f[1], f[2], u);
470
-    float M[]=
471
-    {
454
+    f[0] = f[0] / fMag;
455
+    f[1] = f[1] / fMag;
456
+    f[2] = f[2] / fMag;
457
+
458
+    float s[3] = {
459
+        f[1] * upZ - upY * f[2],
460
+        upX * f[2] - f[0] * upZ,
461
+        f[0] * upY - upX * f[1]
462
+    };
463
+
464
+    float u[3] = {
465
+        s[1] * f[2] - f[1] * s[2],
466
+        f[0] * s[2] - s[0] * f[2],
467
+        s[0] * f[1] - f[0] * s[1]
468
+    };
469
+
470
+    float m[16] = {
472
         s[0], u[0], -f[0], 0,
471
         s[0], u[0], -f[0], 0,
473
         s[1], u[1], -f[1], 0,
472
         s[1], u[1], -f[1], 0,
474
         s[2], u[2], -f[2], 0,
473
         s[2], u[2], -f[2], 0,
475
-        0, 0, 0, 1
474
+           0,    0,     0, 1
476
     };
475
     };
477
-    glMultMatrixf(M);
478
-    glTranslatef (-eyeX, -eyeY, -eyeZ);
476
+    glMultMatrixf(m);
477
+    glTranslatef(-eyeX, -eyeY, -eyeZ);
479
 }
478
 }
480
 
479
 
481
 void Render::Display()
480
 void Render::Display()
566
     gOpenRaider->mGame->mCamera->getPosition(camPos);
565
     gOpenRaider->mGame->mCamera->getPosition(camPos);
567
     gOpenRaider->mGame->mCamera->getTarget(atPos);
566
     gOpenRaider->mGame->mCamera->getTarget(atPos);
568
     // Mongoose 2002.08.13, Quick fix to render OpenRaider upside down
567
     // Mongoose 2002.08.13, Quick fix to render OpenRaider upside down
569
-    // gluLookAt(camPos[0], camPos[1], camPos[2], atPos[0], atPos[1], atPos[2], 0.0, -1.0, 0.0);
570
 
568
 
571
-    deprecated_gluLookAt(camPos[0], camPos[1], camPos[2], atPos[0], atPos[1], atPos[2], 0.0f, -1.0f, 0.0f);
569
+    gluLookAt(camPos[0], camPos[1], camPos[2], atPos[0], atPos[1], atPos[2], 0.0f, -1.0f, 0.0f);
572
 
570
 
573
     // Update view volume for vising
571
     // Update view volume for vising
574
     updateViewVolume();
572
     updateViewVolume();

+ 2
- 13
src/Texture.cpp Datei anzeigen

14
 
14
 
15
 #ifdef __APPLE__
15
 #ifdef __APPLE__
16
 #include <OpenGL/gl.h>
16
 #include <OpenGL/gl.h>
17
-#include <OpenGL/glu.h>
18
 #else
17
 #else
19
 #include <GL/gl.h>
18
 #include <GL/gl.h>
20
-#include <GL/glu.h>
21
 #endif
19
 #endif
22
 
20
 
23
 #include "utils/tga.h"
21
 #include "utils/tga.h"
189
     }
187
     }
190
 }
188
 }
191
 
189
 
192
-// http://mmmovania.blogspot.de/2011/01/opengl-30-and-above-deprecated-func-and.html
193
-// http://www.g-truc.net/post-0256.html
194
-GLint deprecated_gluBuild2DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data) {
195
-    glTexParameteri(target, GL_GENERATE_MIPMAP, GL_TRUE);
196
-    glTexImage2D(target, 0, internalFormat, width, height, 0, format, type, data);
197
-    return 0;
198
-}
199
-
200
 int Texture::loadBufferSlot(unsigned char *image,
190
 int Texture::loadBufferSlot(unsigned char *image,
201
         unsigned int width, unsigned int height,
191
         unsigned int width, unsigned int height,
202
         ColorMode mode, unsigned int bpp,
192
         ColorMode mode, unsigned int bpp,
267
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
257
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
268
                 GL_LINEAR_MIPMAP_LINEAR);
258
                 GL_LINEAR_MIPMAP_LINEAR);
269
 
259
 
270
-        //gluBuild2DMipmaps(GL_TEXTURE_2D, bytes, width, height, glcMode, GL_UNSIGNED_BYTE, image);
271
-        // gluBuild2DMipmaps is deprecated. Replacement by xythobuz
272
-        deprecated_gluBuild2DMipmaps(GL_TEXTURE_2D, bytes, width, height, glcMode, GL_UNSIGNED_BYTE, image);
260
+        glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
261
+        glTexImage2D(GL_TEXTURE_2D, 0, bytes, width, height, 0, glcMode, GL_UNSIGNED_BYTE, image);
273
     } else {
262
     } else {
274
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
263
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
275
 
264
 

+ 0
- 2
src/Window.cpp Datei anzeigen

12
 
12
 
13
 #ifdef __APPLE__
13
 #ifdef __APPLE__
14
 #include <OpenGL/gl.h>
14
 #include <OpenGL/gl.h>
15
-#include <OpenGL/glu.h>
16
 #else
15
 #else
17
 #include <GL/gl.h>
16
 #include <GL/gl.h>
18
-#include <GL/glu.h>
19
 #endif
17
 #endif
20
 
18
 
21
 #include "math/math.h"
19
 #include "math/math.h"

Laden…
Abbrechen
Speichern