2010-09-07 07:25:40 +02:00
|
|
|
// ==============================================================
|
|
|
|
// This file is part of Glest Shared Library (www.glest.org)
|
|
|
|
//
|
2011-12-14 08:40:48 +01:00
|
|
|
// Copyright (C) 2001-2008 Martiño Figueroa
|
2010-09-07 07:25:40 +02:00
|
|
|
//
|
|
|
|
// You can redistribute this code and/or modify it under
|
|
|
|
// the terms of the GNU General Public License as published
|
|
|
|
// by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version
|
|
|
|
// ==============================================================
|
|
|
|
|
|
|
|
#ifndef _SHARED_GRAPHICS_GL_TEXTUREGL_H_
|
|
|
|
#define _SHARED_GRAPHICS_GL_TEXTUREGL_H_
|
|
|
|
|
|
|
|
#include "texture.h"
|
|
|
|
#include "opengl.h"
|
|
|
|
#include "leak_dumper.h"
|
|
|
|
|
|
|
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class TextureGl
|
|
|
|
// =====================================================
|
|
|
|
|
2010-10-27 17:04:47 +02:00
|
|
|
class TextureGl {
|
2010-09-07 07:25:40 +02:00
|
|
|
protected:
|
2010-10-28 08:59:43 +02:00
|
|
|
GLuint handle;
|
2010-11-01 17:44:05 +01:00
|
|
|
GLuint renderBufferId;
|
|
|
|
GLuint frameBufferId;
|
2010-09-07 07:25:40 +02:00
|
|
|
|
2011-04-28 09:48:19 +02:00
|
|
|
static bool enableATIHacks;
|
|
|
|
|
2011-02-08 06:54:05 +01:00
|
|
|
void initRenderBuffer();
|
|
|
|
void initFrameBuffer();
|
|
|
|
void attachRenderBuffer();
|
|
|
|
|
2010-09-07 07:25:40 +02:00
|
|
|
public:
|
2010-10-28 08:59:43 +02:00
|
|
|
TextureGl();
|
2010-11-01 17:44:05 +01:00
|
|
|
virtual ~TextureGl();
|
|
|
|
|
2011-04-28 09:48:19 +02:00
|
|
|
static void setEnableATIHacks(bool value) { enableATIHacks = value; }
|
|
|
|
static bool getEnableATIHacks() { return enableATIHacks; }
|
|
|
|
|
2010-11-01 17:44:05 +01:00
|
|
|
GLuint getHandle() const {return handle;}
|
|
|
|
GLuint getRenderBufferHandle() const {return renderBufferId;}
|
|
|
|
GLuint getFrameBufferHandle() const {return frameBufferId;}
|
|
|
|
|
2011-02-08 06:54:05 +01:00
|
|
|
bool supports_FBO_RBO();
|
|
|
|
void setup_FBO_RBO();
|
2010-11-01 17:44:05 +01:00
|
|
|
void attachFrameBufferToTexture();
|
|
|
|
void dettachFrameBufferFromTexture();
|
2011-04-24 07:39:13 +02:00
|
|
|
void dettachRenderBufferFromTexture();
|
2011-02-08 06:54:05 +01:00
|
|
|
bool checkFrameBufferStatus();
|
2010-11-01 17:44:05 +01:00
|
|
|
void teardown_FBO_RBO();
|
|
|
|
|
|
|
|
virtual int getTextureWidth() const = 0;
|
|
|
|
virtual int getTextureHeight() const = 0;
|
2010-10-27 17:04:47 +02:00
|
|
|
|
2013-12-23 07:53:26 +01:00
|
|
|
void OutputTextureDebugInfo(Texture::Format format, int components, const string path,std::size_t rawSize,GLenum texType);
|
2010-09-07 07:25:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class Texture1DGl
|
|
|
|
// =====================================================
|
|
|
|
|
2010-10-28 08:59:43 +02:00
|
|
|
class Texture1DGl: public Texture1D, public TextureGl {
|
2010-09-07 07:25:40 +02:00
|
|
|
public:
|
2010-10-28 08:59:43 +02:00
|
|
|
Texture1DGl();
|
|
|
|
virtual ~Texture1DGl();
|
|
|
|
|
2010-09-07 07:25:40 +02:00
|
|
|
virtual void init(Filter filter, int maxAnisotropy= 1);
|
2010-10-29 18:27:22 +02:00
|
|
|
virtual void end(bool deletePixelBuffer=true);
|
2010-11-01 17:44:05 +01:00
|
|
|
|
|
|
|
virtual int getTextureWidth() const { return Texture1D::getTextureWidth();}
|
|
|
|
virtual int getTextureHeight() const { return Texture1D::getTextureHeight();}
|
2010-09-07 07:25:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class Texture2DGl
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
class Texture2DGl: public Texture2D, public TextureGl{
|
|
|
|
public:
|
2010-10-28 08:59:43 +02:00
|
|
|
Texture2DGl();
|
|
|
|
virtual ~Texture2DGl();
|
|
|
|
|
2010-09-07 07:25:40 +02:00
|
|
|
virtual void init(Filter filter, int maxAnisotropy= 1);
|
2010-10-29 18:27:22 +02:00
|
|
|
virtual void end(bool deletePixelBuffer=true);
|
2010-11-01 17:44:05 +01:00
|
|
|
|
|
|
|
virtual int getTextureWidth() const { return Texture2D::getTextureWidth();}
|
|
|
|
virtual int getTextureHeight() const { return Texture2D::getTextureHeight();}
|
2010-09-07 07:25:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class Texture3DGl
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
class Texture3DGl: public Texture3D, public TextureGl{
|
|
|
|
public:
|
2010-10-28 08:59:43 +02:00
|
|
|
|
|
|
|
Texture3DGl();
|
|
|
|
virtual ~Texture3DGl();
|
|
|
|
|
2010-09-07 07:25:40 +02:00
|
|
|
virtual void init(Filter filter, int maxAnisotropy= 1);
|
2010-10-29 18:27:22 +02:00
|
|
|
virtual void end(bool deletePixelBuffer=true);
|
2010-11-01 17:44:05 +01:00
|
|
|
|
|
|
|
virtual int getTextureWidth() const { return Texture3D::getTextureWidth();}
|
|
|
|
virtual int getTextureHeight() const { return Texture3D::getTextureHeight();}
|
2010-09-07 07:25:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class TextureCubeGl
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
class TextureCubeGl: public TextureCube, public TextureGl{
|
|
|
|
public:
|
2010-10-28 08:59:43 +02:00
|
|
|
|
|
|
|
TextureCubeGl();
|
|
|
|
virtual ~TextureCubeGl();
|
|
|
|
|
2010-09-07 07:25:40 +02:00
|
|
|
virtual void init(Filter filter, int maxAnisotropy= 1);
|
2010-10-29 18:27:22 +02:00
|
|
|
virtual void end(bool deletePixelBuffer=true);
|
2010-11-01 17:44:05 +01:00
|
|
|
|
|
|
|
virtual int getTextureWidth() const { return TextureCube::getTextureWidth();}
|
|
|
|
virtual int getTextureHeight() const { return TextureCube::getTextureHeight();}
|
|
|
|
|
2010-09-07 07:25:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}}}//end namespace
|
|
|
|
|
|
|
|
#endif
|