PDA

View Full Version : translate only one object



Ruggero Visitnin
08-22-2014, 03:13 AM
hi guys,
i'm working on modern opengl and i would know what to do if i have many objects in the scene and i want to translate only one of them.
i was thinking to create a model matrix for every object in the scene and translate only the model matrix of the object that i want to move, but this solution does not work. In fact, even if i change only one model matrix, the result is that all objects in the scene are translated.

here what i was doing:



initFunc()
{
load the OBJ wavefront

for(object loaded)
{
bind a VAO[object loaded]
bind VBO
send vertex attrib to shader
}
}

dislayFunc()
{
//... blah blah

for(object in scene)
{
send to shader the object model_matrix;
send to shader the mvp;
}
// all the other stuff
}


i really can't figure out why is not working or how to do;
any help is appreciated