| | 35 | == User Interface == |
| | 36 | |
| | 37 | The View class handles OpenGL rendering. To use the View class a graphical user interface needs to create an opengl context and instruct View to draw periodically. Five functions that are part of the View class API are needed. |
| | 38 | |
| | 39 | * make_opengl_context_current() - this is a window-system specific opengl call. It should create the OpenGL context when called the first time. |
| | 40 | * swap_opengl_buffers() - this is a window-system specific opengl call that causes the rendered off-screen buffer to be shown on the screen. |
| | 41 | * draw_if_needed() - called 60 times per second using a window system timer event. |
| | 42 | * draw() - called on a window system exposure event, for example when the graphics window is deiconified. |
| | 43 | * resize() - called when the user resizes the graphics window, for example using the mouse. |
| | 44 | |
| | 45 | The first two functions are provided by the window toolkit and passed to the View constructor as arguments. The last three functions are methods of View called by the GUI code. The user interface mouse modes code uses additional member of the View class, namely the Camera (v.camera), the window size (v.window_size), the pixel size in Angstroms (v.pixel_size()), and the session (v.session) for accessing the list of opened models. |
| | 46 | |