create a class with below functions without using global varibles ..
#include "include/r_cluster_background.h"
#include "include/r_cluster_shader.h"
#include "include/r_cluster_wayland.h"

/**********************************************************************************************************************
 * Macro definitions
 *********************************************************************************************************************/

/**********************************************************************************************************************
 * Local Typedef definitions
 *********************************************************************************************************************/

/**********************************************************************************************************************
 * Exported global variables
 *********************************************************************************************************************/

/**********************************************************************************************************************
 * Global variables and functions
 *********************************************************************************************************************/
const char *backgroundVertexShaderSource = R"(
#version 300 es
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 texCoord;
out vec2 fragTexCoord;

void main()
{
    gl_Position = vec4(position.x, position.y, position.z, 1.0);
    fragTexCoord = vec2(texCoord.x, texCoord.y);
}
)";

const char *backgroundFragmentShaderSource = R"(
#version 300 es
precision mediump float;
in vec2 fragTexCoord;
out vec4 fragColor;
uniform sampler2D texture1;

void main()
{
    fragColor = texture(texture1, fragTexCoord);
}
)";

GLuint bg_VAO, bg_VBO, bg_EBO;
GLuint bg_texture;
GLuint bg_shaderprogram = 0;
GLuint bg_vertexshader = 0;
GLuint bg_fragmentshader = 0;

extern struct wl_surface *parent_surface;
extern struct wl_surface *child_surface;

extern EGLDisplay egldisplay;
extern EGLContext eglcontext;
extern EGLSurface eglsurface;

GLfloat bg_vertices[] = {
    // Position   Color                   Texture Co-ordinates
    -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, // Top-Left
    1.0f, -1.0f, 0.0f, 1.0f, 1.0f,  // Top-Right
    1.0f, 1.0f, 0.0f, 1.0f, 0.0f,   // Bottom-right
    -1.0f, 1.0f, 0.0f, 0.0f, 0.0f,  // Bottom-Left

};

GLuint bg_indices[] = {
    0, 1, 2,
    2, 3, 0
    // 3, 2, 1
};
/**********************************************************************************************************************
 * Function Name:
 * Description  :
 * Arguments    :
 * Return Value :
 *********************************************************************************************************************/
void R_Cluster_Background_Init(void)
{
    bg_vertexshader = compileShader(backgroundVertexShaderSource, GL_VERTEX_SHADER);
    bg_fragmentshader = compileShader(backgroundFragmentShaderSource, GL_FRAGMENT_SHADER);

    bg_shaderprogram = linkShader(bg_vertexshader, bg_fragmentshader);

    glUseProgram(bg_shaderprogram);

    glGenVertexArrays(1, &bg_VAO);
    glGenBuffers(1, &bg_VBO);
    glGenBuffers(1, &bg_EBO);

    glBindVertexArray(bg_VAO);

    glBindBuffer(GL_ARRAY_BUFFER, bg_VBO);
    glBufferData(GL_ARRAY_BUFFER, sizeof(bg_vertices), bg_vertices, GL_STATIC_DRAW);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bg_EBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(bg_indices), bg_indices, GL_STATIC_DRAW);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid *)0);
    glEnableVertexAttribArray(0);

    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid *)(3 * sizeof(GLfloat)));
    glEnableVertexAttribArray(1);

    glGenTextures(1, &bg_texture);
    loadTexture("res/Background.png", bg_texture);
}
/**********************************************************************************************************************
 * Function Name:
 * Description  :
 * Arguments    :
 * Return Value :
 *********************************************************************************************************************/

void R_Render_Background(void)
{
    eglMakeCurrent(egldisplay, eglsurface, eglsurface, eglcontext);
    glViewport(0, 0, CLUSTER_WIDTH, CLUSTER_HEIGHT);
    glUseProgram(bg_shaderprogram);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, bg_texture);
    glUniform1i(glGetUniformLocation(bg_shaderprogram, "texture1"), 0);

    glBindVertexArray(bg_VAO);

    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
    glBindVertexArray(0);
}

/**********************************************************************************************************************
 * Function Name:
 * Description  :
 * Arguments    :
 * Return Value :
 *********************************************************************************************************************/

void R_Cluster_Background_deinit(void)
{
    glDeleteVertexArrays(1, &bg_VAO);
    glDeleteBuffers(1, &bg_VBO);
    glDeleteBuffers(1, &bg_EBO);
    glDeleteTextures(1, &bg_texture);
}

/**********************************************************************************************************************
 * Private (static) variables and functions
 *********************************************************************************************************************/

/**********************************************************************************************************************
 * End of function main
 *********************************************************************************************************************/