- Main Page
- Namespaces
- Data Structures
- Files

- Search for |

- File List
- Globals

# HydroSDL/oGL_graphics/graphics_relative.h File Reference

`#include "SDL.h"`
`#include "SDL_OpenGL.h"`
`#include "SDL_ttf/SDL_ttf.h"`
`#include "../main.h"`
`#include "../hydro_source/Datas.h"`
`#include "Sea.h"`
`#include "solid_objects.h"`
`#include "../joystick_SDL/joystick_SDL.h"`
`#include "../hydro_source/hydro_includes.h"`

Include dependency graph for graphics_relative.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions
GLuint * | get_texture ()
bool | getCallibatingPhase ()
| Callibrating phase?
void | resize_window (int height, int width)
| Window resize callback.
void | setup_opengl (int width, int height)
| Setup for openGL.
void | setup_SDL (int width, int height)
| Setup for openGL.
void | process_events (void)
| Process events.
void | handle_key_down (SDL_keysym *keysym)
| On key-down event.
void | do_on_keystate (datas *d)
| On key-down state.
void | setup_font ()
| On screen display font setup.
void | close_font ()
| On screen display font close.
int | DrawGLScene (datas *d)
| Draws the scene (openGL).
void | pass_joy_parameters (joy_parameters *jP)
| Copy joystick parameters from MATLAB struct (obsolete (?)).

## Detailed Description

Author:
  basile.graf@epfl.ch

This file contains includes for graphical purposes and declarations for some graphic related functions

Definition in file graphics_relative.h.

## Function Documentation

void close_font | ( |  | ) |

On screen display font close.

Closes the ttf font

Definition at line 440 of file graphics_main.cpp.

References font.

Referenced by quit_tutorial().

void do_on_keystate | ( | datas * | d | ) |

On key-down state.

Does what has to be done on keyboard key-down state (long time pressed key)

Definition at line 806 of file graphics_main.cpp.

References datas::angle_girouette, dviewAngle, dviewDist, datas::Hslider_x, datas::max_abs_angle_baume, datas::t, datas::tanAngle_sail, datas::target_x, datas::target_y, time_before, time_elapsed, viewAngle1, viewAngle2, viewDist, datas::Vslider_x, datas::Wave_amp, datas::Wave_amp0, datas::Wave_amp1, datas::Wave_amp2, datas::Wind, datas::Wind_angle, datas::Wind_x, and datas::Wind_y.

Referenced by main().

int DrawGLScene | ( | datas * | d | ) |

Draws the scene (openGL).

Draws the scene by appling all necessary geometrical (spacial) transformations and by calling the different element drawing functions (for the boat, the sea, the instruments...). This is not the highest function for drwaing the current scene, see draw_graphics().

Definition at line 529 of file graphics_main.cpp.

References angles_update(), Boat_draw(), callibratingPhase, dirR, dirX, dirY, dirZ, doR, doX, doY, doZ, draw_panorama(), Draw_sea(), datas::dx, datas::dy, f(), font, fontBIG, fps, Girouette_draw(), glDisable2D(), glEnable2D(), HSlider_draw(), datas::Hslider_x, is_there_a_joystick(), joystick_getXYZR(), LightPosition, onBoardView, datas::phi, datas::psi, RelativeWind_draw(), Sail_create_and_draw(), screen, SDL_GL_PrintText(), Target_draw(), datas::target_x, datas::target_y, text_color, text_position, datas::theta, time_elapsed, viewAngle1, viewAngle2, viewDist, VSlider_draw(), datas::Vslider_x, wave_z_compute(), datas::Wind, datas::Wind_x, datas::Wind_y, datas::x, datas::y, and datas::z.

Referenced by main().

GLuint* get_texture | ( |  | ) |

Definition at line 76 of file graphics_main.cpp.

References texture.

Referenced by Sail_create_and_draw().

bool getCallibatingPhase | ( |  | ) |

Callibrating phase?

Returns true if the program is in the joystick callibrating phase

Definition at line 81 of file graphics_main.cpp.

References callibratingPhase.

Referenced by main().

void handle_key_down | ( | SDL_keysym * | keysym | ) |

On key-down event.

Does what has to be done on keyboard key-down event (on time hit)

Definition at line 760 of file graphics_main.cpp.

References callibratingPhase, dirR, dirX, dirY, dirZ, doR, doX, doY, doZ, onBoardView, and quit_tutorial().

Referenced by process_events().

void pass_joy_parameters | ( | joy_parameters * | jP | ) |

Copy joystick parameters from MATLAB struct (obsolete (?)).

Copy the joystick parameters (doX, doY ,doZ ,doR and dirX ,dirY ,diZ ,dirR) from the MATLAB struct *jP to the local joystick parameters variables.

Parameters:

  | *jP | : Structure comming from MATLAB or filled with default values defining joystick axes usage and direction.

Definition at line 881 of file graphics_main.cpp.

References joy_parameters::dirR, dirR, joy_parameters::dirX, dirX, joy_parameters::dirY, dirY, joy_parameters::dirZ, dirZ, joy_parameters::doR, doR, joy_parameters::doX, doX, joy_parameters::doY, doY, joy_parameters::doZ, and doZ.

Referenced by main().

void process_events | ( | void |  | ) |

Process events.

Treats events like keyboard event,...

Definition at line 733 of file graphics_main.cpp.

References handle_key_down(), quit_tutorial(), and resize_window().

Referenced by main().

void resize_window | ( | int | height,
|  | int | width |
| ) |  |  |

Window resize callback.

This function is called when the user modifies the window size

Parameters:

  | height | : height in pixels
  | width | : width in pixels

Definition at line 337 of file graphics_main.cpp.

References bpp, flags, load_textures(), quit_tutorial(), screen, and setup_opengl().

Referenced by process_events().

void setup_font | ( |  | ) |

On screen display font setup.

On screen display is done using the SDL_ttf library. This function does the setups for SDL_ttf and load the ttf font from file

Definition at line 423 of file graphics_main.cpp.

References font, and fontBIG.

Referenced by main().

void setup_opengl | ( | int | width,
|  | int | height |
| ) |  |  |

Setup for openGL.

Does all the setup things neede by openGL

Parameters:

  | height | : height in pixels
  | width | : width in pixels

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 256 of file graphics_main.cpp.

References f(), LightAmbient, LightDiffuse, and LightPosition.

Referenced by main(), and resize_window().

void setup_SDL | ( | int | width,
|  | int | height |
| ) |  |  |

Setup for openGL.

Does all the setup things neede by SDL

Parameters:

  | height | : height in pixels
  | width | : width in pixels

Definition at line 356 of file graphics_main.cpp.

References bpp, flags, load_textures(), quit_tutorial(), and screen.

Referenced by main().