Rotation of a specific 3d object / GLSL

Hey Guys,

I am trying to do my first simple house opengl project and add the rotation functionality to the door. I did construct the door as a cube. My house includes couples of cubes and I only want rotate the door. I am trying to do this via shader but got stuck in a problem.

I could pass the whole vertex arrays to vertex shader and therefore rotate the whole house. But, it is not exactly what I am looking for. In fact, I am required to rotate the door. I am trying to find a way to separate the door cube vertex arrays in shader itself and apply rotation on the specific set of vertex arrays and not the whole.

long for some cool advice

Vertex shaders only know about a vertex not the whole object - remember what a gpu is - it is a set of parallel process each of which can execute completely independant of the others. So to rotate some vertices and not others, each vertex will have to identify what it belongs to - you can do this but it is a waste of gpu memory. Instead have 2 element (index) buffers and a common vertex buffer. One index buffer only indexes triangles for the door - the other indexs the door and house. Then bind different index buffers depending on what you want to render.