//================================================================
// lib2D image library
//
// OpenGL textures
//
// AUTHOR:  Gabor Nagy
// DATE:    2025-Dec-12 18:48:59
//
// Copyright (C) 2014-2026 by Gabor Nagy. All rights reserved.
//================================================================
#ifndef _Ep_GL_Texture_h
#define _Ep_GL_Texture_h


#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
extern "C" {
#endif

#define EpGL_MAX_BUFFERS_FOR_ANIMATED_TEXTURES  2


#ifndef EpGLTexture_DEF
#define EpGLTexture_DEF
typedef struct EpGLTexture_S  EpGLTexture;
#endif


// OpenGL texture object
//
struct EpGLTexture_S
{
	EObjectCore(EObject);

	EpImage*        Image;            // EpImage of the texture for OpenGL, Vulkan etc. (if NULL, it's the same as Texture->Image)
	EpImage*        NormalMapImage;
	EpPixelBuffer*  NormalMapPixelBuffer;

	int             GLIndexForDrawing;
	int             PixelFormats[EpGL_MAX_BUFFERS_FOR_ANIMATED_TEXTURES];  // PixelFormat for the corresponding GLIndices
	unsigned int    GLIndices[EpGL_MAX_BUFFERS_FOR_ANIMATED_TEXTURES];     // GL index values. Multiple ones, so we can do double-buffering for animated textures
	EBool           NeedsSwapping;    // Texture changed. GLIndexForDrawing needs to be toggled

	EBool           Uploaded, FilteringUptodate;
};


#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
}	// Close scope of 'extern "C"' declaration
#endif

#endif	// _Ep_GL_Texture_h
