diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 35: Create mipmaps using glGenerateMipmaps. This gets rid of glu.h once and for all!

Message ID 20110721123632.17019.11075.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Alexandros Frantzis July 21, 2011, 12:36 p.m. UTC
------------------------------------------------------------
revno: 35
committer: Alexandros Frantzis <alf82@freemail.gr>
timestamp: Fri 2010-07-09 17:15:21 +0300
message:
  Create mipmaps using glGenerateMipmaps. This gets rid of glu.h once and for all!
modified:
  oglsdl.h
  texture.cpp


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'oglsdl.h'
--- oglsdl.h	2010-07-07 12:33:49 +0000
+++ oglsdl.h	2010-07-09 14:15:21 +0000
@@ -6,7 +6,6 @@ 
 #define GL_GLEXT_PROTOTYPES
 #include <GL/gl.h>
 #include <GL/glext.h>
-#include <GL/glu.h>
 
 
 #endif

=== modified file 'texture.cpp'
--- texture.cpp	2010-07-08 10:39:44 +0000
+++ texture.cpp	2010-07-09 14:15:21 +0000
@@ -48,13 +48,13 @@ 
         glTexImage2D(GL_TEXTURE_2D, 0, nOfColors, surface->w, surface->h, 0,
                      texture_format, GL_UNSIGNED_BYTE, surface->pixels);
 
-        // Create MipMapped Texture
+        // Create trilinear filtered mipmapped texture
         glBindTexture(GL_TEXTURE_2D, pTexture[2]);
-        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
-        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
-
-        gluBuild2DMipmaps(GL_TEXTURE_2D, 3, surface->w, surface->h,
-                          texture_format, GL_UNSIGNED_BYTE, surface->pixels);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+        glTexImage2D(GL_TEXTURE_2D, 0, nOfColors, surface->w, surface->h, 0,
+                     texture_format, GL_UNSIGNED_BYTE, surface->pixels);
+        glGenerateMipmap(GL_TEXTURE_2D);
     }
     else {
         fprintf(stderr, "SDL could not load image.bmp: %s\n", SDL_GetError());