2 #ifndef _KJY_TEXTURE_H_ 3 #define _KJY_TEXTURE_H_ 7 #include "../OOOGL_Core.hpp" 8 #include "../Core_Utilities.hpp" 9 #include "fbo_interface.hpp" 10 #include "../Utility/Image.hpp" 17 glGenTextures(1, getIdPtr());
20 virtual AttachmentType getAttachmentType()
const override{
return(AttachmentType::ATTACHMENT_TEXTURE);}
22 virtual void copyParametersFrom(
const Texture& other);
24 const GLuint getXdim()
const {
return(x);}
25 const GLuint getYdim()
const {
return(y);}
26 const GLuint getZdim()
const {
return(z);}
28 const GLenum* getTextureExtensionMode()
const {
return(texture_extension_mode); }
29 const GLenum getDepthStencilMode()
const {
return(depth_stencil_mode); }
30 const GLenum getMinFilter()
const {
return(min_filter); }
31 const GLenum getMagFilter()
const {
return(mag_filter); }
32 const GLenum getFormat()
const {
return(texture_format);}
33 const GLenum getInternalFormat()
const {
return(internal_format);}
34 const GLenum getType()
const {
return(texture_type);}
36 void setTextureExtensionMode(GLenum mode) {
for (
int i = 0; i < 3; i++) { texture_extension_mode[i] = mode; } initParams(); }
38 void setTextureExtensionModeTuple(
const GLenum* tuple);
39 void setTextureExtensionMode(GLenum wrapS, GLenum wrapT, GLenum wrapR);
40 void setDepthStencilMode(GLenum mode) {depth_stencil_mode = mode; initParams();}
41 void setMinFilter(GLenum filter) {min_filter = GL_LINEAR; initParams();}
42 void setMagFilter(GLenum filter) {mag_filter = GL_LINEAR; initParams();}
45 static void _destroyGLTexture(
const GLuint*
self){glDeleteTextures(1,
self);}
47 virtual void initParams();
49 GLint x = 0, y = 0, z = 0;
50 GLenum internal_format = 0;
51 GLenum texture_format = 0;
52 GLenum texture_type = 0;
54 GLenum texture_extension_mode[3] = { GL_REPEAT, GL_REPEAT, GL_REPEAT };
55 GLenum depth_stencil_mode = GL_DEPTH_COMPONENT;
56 GLenum min_filter = GL_LINEAR;
57 GLenum mag_filter = GL_LINEAR;
63 SimpleTexture2D(
const Image& image, GLenum internal_format = GL_RGB8, GLenum format = GL_RGB, GLenum type = GL_UNSIGNED_BYTE);
64 SimpleTexture2D(GLuint x, GLuint y, GLenum internal_format = GL_RGB8, GLenum format = GL_RGB, GLenum type = GL_UNSIGNED_BYTE) :
Texture(){
65 makeEmpty2DTexture(x, y, internal_format, format, type);
68 void makeTextureFromImage(
const Image& image, GLenum internal_format = GL_RGB8, GLenum format = GL_RGB, GLenum type = GL_UNSIGNED_BYTE);
69 void copyDataFromImage(
const Image& image,
int x_offset,
int y_offset);
70 void makeEmpty2DTexture(
71 GLuint x, GLuint y, GLenum internal_format = GL_RGB8,
72 GLenum format = GL_RGB, GLenum type = GL_UNSIGNED_BYTE, GLenum min_filter = GL_LINEAR,
73 GLenum mag_filter = GL_LINEAR,
bool skip_zero_fill =
false 76 void fillSolid(
const GLubyte* sample);
78 Image* extractImage()
const;
79 Image* extractImage(
int channels)
const;
91 TextureArray(GLuint x, GLuint y, GLuint z, GLenum internal_format = GL_RGB8, GLenum format = GL_RGB, GLenum type = GL_UNSIGNED_BYTE){
92 makeEmptyTextureArray(x, y, z, internal_format, format, type);
95 void makeEmptyTextureArray(GLuint x, GLuint y, GLuint z, GLenum internal_format = GL_RGB8,
96 GLenum format = GL_RGB, GLenum type = GL_UNSIGNED_BYTE, GLenum min_filter = GL_LINEAR,
97 GLenum mag_filter = GL_LINEAR,
bool skip_zero_fill =
false 100 virtual AttachmentType getAttachmentType()
const override{
return(AttachmentType::ATTACHMENT_RENDERBUFFER);}
102 void loadImageIntoLayer(
const Image& image, GLuint layer, GLint x_offset = 0, GLint y_offset = 0);
Definition: Texture.hpp:14
Definition: Texture.hpp:60
Definition: Texture.hpp:88
Definition: OOOGL_Core.hpp:74
Definition: Core_Utilities.hpp:62
Definition: fbo_interface.hpp:10
Definition: Core_Utilities.cpp:3