22 #ifndef BACKENDS_GRAPHICS_OPENGL_TEXTURE_H 23 #define BACKENDS_GRAPHICS_OPENGL_TEXTURE_H 25 #include "graphics/opengl/system_headers.h" 26 #include "graphics/opengl/context.h" 28 #include "graphics/pixelformat.h" 29 #include "graphics/surface.h" 31 #include "common/rect.h" 41 kWrapModeMirroredRepeat
58 GLTexture(GLenum glIntFormat, GLenum glFormat, GLenum glType);
105 bool setSize(uint width, uint height);
150 const GLenum _glIntFormat;
151 const GLenum _glFormat;
152 const GLenum _glType;
154 uint _width, _height;
155 uint _logicalWidth, _logicalHeight;
156 GLfloat _texCoords[4*2];
179 virtual void recreate() = 0;
194 virtual void allocate(uint width, uint height) = 0;
216 void copyRectToTexture(uint x, uint y, uint w, uint h,
const void *src, uint srcPitch);
223 void fill(uint32 color);
226 void flagDirty() { _allDirty =
true; }
227 virtual bool isDirty()
const {
return _allDirty || !_dirtyArea.isEmpty(); }
253 virtual void setPalette(uint start, uint colors,
const byte *palData) {}
255 virtual void setScaler(uint scalerIndex,
int scaleFactor) {}
260 virtual void updateGLTexture() = 0;
267 void clearDirty() { _allDirty =
false; _dirtyArea =
Common::Rect(); }
295 void recreate()
override;
299 void allocate(uint width, uint height)
override;
301 uint
getWidth()
const override {
return _userPixelData.w; }
302 uint
getHeight()
const override {
return _userPixelData.h; }
312 void updateGLTexture()
override;
331 void allocate(uint width, uint height)
override;
332 void setMask(
const byte *mask)
override;
336 bool hasPalette()
const override {
return (_palette !=
nullptr); }
338 void setColorKey(uint colorKey)
override;
339 void setPalette(uint start, uint colors,
const byte *palData)
override;
344 void updateGLTexture()
override;
359 void updateGLTexture()
override;
367 void updateGLTexture()
override;
374 ~ScaledTexture()
override;
376 void allocate(uint width, uint height)
override;
378 uint
getWidth()
const override {
return _rgbData.w; }
379 uint
getHeight()
const override {
return _rgbData.h; }
382 bool hasPalette()
const override {
return (_palette !=
nullptr); }
387 void updateGLTexture()
override;
389 void setScaler(uint scalerIndex,
int scaleFactor)
override;
410 void recreate()
override;
414 void allocate(uint width, uint height)
override;
416 bool isDirty()
const override {
return _paletteDirty || Surface::isDirty(); }
418 uint
getWidth()
const override {
return _userPixelData.w; }
419 uint
getHeight()
const override {
return _userPixelData.h; }
425 void setColorKey(uint colorKey)
override;
426 void setPalette(uint start, uint colors,
const byte *palData)
override;
431 void updateGLTexture()
override;
434 static bool isSupportedByContext() {
435 return OpenGLContext.shadersSupported
436 && OpenGLContext.multitextureSupported
437 && OpenGLContext.framebufferObjectSupported;
448 GLfloat _clut8Vertices[4*2];
453 byte _palette[4 * 256];
456 #endif // !USE_FORCED_GLES void updateArea(const Common::Rect &area, const Graphics::Surface &src)
Definition: texture.h:326
const GLTexture & getGLTexture() const override
Definition: texture.h:313
Definition: texture.h:362
void setWrapMode(WrapMode wrapMode)
virtual void setColorKey(uint colorKey)
Definition: texture.h:252
virtual bool hasPalette() const
Definition: texture.h:243
GLuint getGLTexture() const
Definition: texture.h:148
Definition: texture.h:354
bool isLinearFilteringEnabled() const
Definition: texture.h:71
virtual void setMask(const byte *mask)
Definition: texture.h:201
const GLfloat * getTexCoords() const
Definition: texture.h:140
uint getWidth() const
Definition: texture.h:120
bool hasPalette() const override
Definition: texture.h:336
Definition: texture.h:403
Graphics::PixelFormat getFormat() const override
Definition: texture.h:334
Definition: framebuffer.h:203
bool setSize(uint width, uint height)
bool hasPalette() const override
Definition: texture.h:423
uint getLogicalHeight() const
Definition: texture.h:135
Definition: renderbuffer.h:27
Definition: texture.h:280
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:168
Graphics::PixelFormat getFormat() const override
Definition: texture.h:307
void enableLinearFiltering(bool enable)
Definition: texture.h:166
Definition: scalerplugin.h:28
GLTexture(GLenum glIntFormat, GLenum glFormat, GLenum glType)
uint getHeight() const
Definition: texture.h:125
uint getLogicalWidth() const
Definition: texture.h:130