I was hoping to make a tower of hanoi game using opengl. Eventually i came up to the problem of processing & transfering data from one buffer object to another.
I have successfully stored my vertices in a buffer object and bound it with a vertex array . And now want to move that to another created buffer object bound to another vertex array. The problem is that when i try to obtain my vertices using glGetBufferSubData my data array shows all of its elements to be zero (I printed it on the console). I have double checked to see weather my buffer object has its data right and so it seems to be. Please help me i am on the end of my rope here.
My code :
struct Stack
{
    unsigned int top;
    VA vao; 
};
void transfer(Stack& s1, Stack& s2)
{
    float data[20];//collects data 
    s1.vao.Bind();
    glGetBufferSubData(GL_ARRAY_BUFFER, 0,  20* sizeof(float), data);`
    for (int i = 0; i < 20; i+=5)//prints data collected
    {
        cout << i+1 << "th loop" << endl;
        for (int j = i; j < i + 5; j++)
        {
            cout << data[j]<<"\t";
        }
        cout << endl;
    }
    s2.vao.Bind();
    glBufferSubData(GL_ARRAY_BUFFER, 0, 20 * sizeof(float), data);
}
 
     
     
    