Every tile, in order to be identified, must be rendered (for selection) giving its x and y coordinates. In my selection rendering of the map below, 2 variables are pushed in the name stack. Game programmers even use a less complicated geometry structure for each model in selection mode. This means that states like textures, lighting, blending etc can be safely disabled. This rendering is never actually seen on screen, so it should be as light as it can get. ![]() The object can now be selected, when the mouse is over itĪt step 3, a special more simple rendering of the objects under selection should be used.Render the object again, in selection mode.I won’t go through all the details, a very helpful article can be found here. As you can imagine, this can be quite a hard task to do.įortunately, OpenGL provides a good mechanism for picking. ![]() ![]() The 2D coordinates of the mouse pointer on the screen must be translated to the 3D coordinates the user intends to select. When we want to interact with the scene, the opposite procedure must take place. ![]() Up to now, everything we wanted to render was perceived and designed in 3D and then rendered in 2D on the screen. Picking is a technique used to interact with the elements in a game.
0 Comments
Leave a Reply. |