Commit 18f0aeba authored by hybrid's avatar hybrid

Fixed manual mipmap generation and removed the last glu function.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@889 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 999d5405
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h>
#include "glext.h" #include "glext.h"
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma comment(lib, "OpenGL32.lib") #pragma comment(lib, "OpenGL32.lib")
...@@ -29,7 +28,6 @@ ...@@ -29,7 +28,6 @@
#define GL_GLEXT_LEGACY 1 #define GL_GLEXT_LEGACY 1
#endif #endif
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#if defined(_IRR_OPENGL_USE_EXTPOINTER_) #if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#include "glext.h" #include "glext.h"
#endif #endif
...@@ -53,7 +51,6 @@ ...@@ -53,7 +51,6 @@
#define GLX_GLXEXT_PROTOTYPES 1 #define GLX_GLXEXT_PROTOTYPES 1
#endif #endif
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h> #include <GL/glx.h>
#if defined(_IRR_OPENGL_USE_EXTPOINTER_) #if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#include "glext.h" #include "glext.h"
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
// This file was originally written by William Finlayson. // This file was originally written by William Finlayson. I (Nikolaus
// I (Nikolaus Gebhardt) did some minor modifications and changes to it and integrated // Gebhardt) did some minor modifications and changes to it and integrated it
// it into Irrlicht. Thanks a lot to William for his work on this and that he gave me // into Irrlicht. Thanks a lot to William for his work on this and that he gave
// his permission to add it into Irrlicht using the zlib license. // me his permission to add it into Irrlicht using the zlib license.
// After Irrlicht 0.12, Michael Zoech did some improvements to this renderer, I merged this // After Irrlicht 0.12, Michael Zoech did some improvements to this renderer, I
// into Irrlicht0.14, thanks to him for his work. // merged this into Irrlicht 0.14, thanks to him for his work.
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
......
...@@ -433,36 +433,30 @@ bool COpenGLTexture::hasMipMaps() const ...@@ -433,36 +433,30 @@ bool COpenGLTexture::hasMipMaps() const
//! Regenerates the mip map levels of the texture. Useful after locking and //! Regenerates the mip map levels of the texture. Useful after locking and
//! modifying the texture //! modifying the texture
//! MipMap updates are automatically performed by OpenGL.
void COpenGLTexture::regenerateMipMapLevels() void COpenGLTexture::regenerateMipMapLevels()
{ {
if (AutomaticMipmapUpdate || !HasMipMaps) if (AutomaticMipmapUpdate || !HasMipMaps)
return; return;
void* source = Image->lock(); if ((Image->getDimension().Width==1) && (Image->getDimension().Height==1))
if (gluBuild2DMipmaps(GL_TEXTURE_2D, InternalFormat,
ImageSize.Width, ImageSize.Height,
PixelFormat, PixelType, source))
{
Image->unlock();
return; return;
}
// Manually create mipmaps // Manually create mipmaps
u32 width=ImageSize.Width>>1; u32 width=Image->getDimension().Width;
u32 height=ImageSize.Height>>1; u32 height=Image->getDimension().Height;
u32 i=1; u32 i=0;
u8* target = new u8[Image->getImageDataSizeInBytes()]; u8* target = new u8[Image->getImageDataSizeInBytes()];
while (width>1 || height>1) do
{ {
Image->copyToScaling(target, width, height, Image->getColorFormat(), Image->getPitch());
glTexImage2D(GL_TEXTURE_2D, i, InternalFormat, Image->getDimension().Width,
Image->getDimension().Height, 0, PixelFormat, PixelType, target);
if (width>1) if (width>1)
width>>=1; width>>=1;
if (height>1) if (height>1)
height>>=1; height>>=1;
++i; ++i;
Image->copyToScaling(target, width, height, Image->getColorFormat());
glTexImage2D(GL_TEXTURE_2D, i, InternalFormat, width, height,
0, PixelFormat, PixelType, target);
} }
while (width!=1 || height!=1);
delete [] target; delete [] target;
Image->unlock(); Image->unlock();
} }
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h>
#include "glext.h" #include "glext.h"
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma comment(lib, "OpenGL32.lib") #pragma comment(lib, "OpenGL32.lib")
...@@ -28,10 +27,8 @@ ...@@ -28,10 +27,8 @@
#endif #endif
#if defined(MACOSX) #if defined(MACOSX)
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else #else
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h>
#endif #endif
#if defined(_IRR_OPENGL_USE_EXTPOINTER_) #if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#include "glext.h" #include "glext.h"
......
...@@ -57,7 +57,7 @@ staticlib sharedlib : CXXINCS += -I/usr/X11R6/include ...@@ -57,7 +57,7 @@ staticlib sharedlib : CXXINCS += -I/usr/X11R6/include
#Windows specific options #Windows specific options
sharedlib_win32 staticlib_win32: SYSTEM = Win32-gcc sharedlib_win32 staticlib_win32: SYSTEM = Win32-gcc
sharedlib_win32: LDFLAGS = -lgdi32 -lwinspool -lcomdlg32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lglu32 -lopengl32 sharedlib_win32: LDFLAGS = -lgdi32 -lwinspool -lcomdlg32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lopengl32
sharedlib_win32 staticlib_win32: CPPFLAGS += -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL sharedlib_win32 staticlib_win32: CPPFLAGS += -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL
staticlib_win32: CPPFLAGS += -D_IRR_STATIC_LIB_ staticlib_win32: CPPFLAGS += -D_IRR_STATIC_LIB_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment