I have 9 quads from triangles, for example:

I use VBOto store data about them - their position and texture coordinates.
My question is: is it possible for square 5 to have a different texture than the rest of the squares using only one VBOand shader?:

Green represents texture 1 and yellow texture 2.
So far I have received:
GLfloat vertices[] = {
0.0f, 0.0f,
...
0.0f, 0.0f,
...
};
I create VBOusing this array vertices[], and then I bind my first texture m_texture1(I also have access to the second - m_texture2) and the shader call:
glBindTexture(GL_TEXTURE_2D, m_texture1);
glUseProgram(program);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_vboId);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (void*)(sizeof(GLfloat)*108));
glDrawArrays(GL_TRIANGLES, 0, 108);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glUseProgram(0);
My vertex shader:
layout (location = 0) in vec4 position;
layout (location = 1) in vec2 texcoord;
out vec2 Texcoord;
void main()
{
gl_Position = position;
Texcoord = texcoord;
}
And the fragment shader:
in vec2 Texcoord;
out vec4 outputColor;
uniform sampler2D tex;
void main()
{
outputColor = texture(tex, Texcoord) * vec4(1.0,1.0,1.0,1.0);
}
So, basically I only use one texture here, because I have no idea how to use the second.