Cube resize when mouse over

Hi Team,

I am relatively new to OPENGL and need to accomplish task of resize (say 2 times from original size) cube(3D) once mouse over it. And after mouse is not on the cube it has to back normal size.

Do yu know how to do that ?
Maybe there is some good material to read? like tutorials…

Thanks for your help!

Maybe there is some good material to read? like tutorials… [/QUOTE]

I’d suggest you to start from . It has some great explanations of transformations and coordinate systems. All examples are on GitHub, so you can try them yourself.

thanks for link, but I need explicitly some tutorials or ideas how to select cube, which is seems to be more advanced thing

What you need to do does not really involve OpenGL at all. The technique is called ray picking.

First you need to get the position of the mouse in your windows coordinate system (freeglut, glfw etc. functions). Than you calculate a ray. This ray depends on your projection matrix. If you have got the correct ray you just perform a simple collision test between your object and the ray. If there is a collision, just pass a scaling factor of 2 to your vertex shader.
But watch out: If you don’t use the same scaling factor during your collision tests, the object shrinks back to normal size if you leave the area of the unscaled cube. Adjust you code depending on what you want to achieve.

For a start on ray casting:

There are other techniques that also do the trick, like color picking, but I think thats a little bit to much, since it involves a lot of knowledge about OpenGL.