\hypertarget{graphics__relative_8h}{
\section{D:/Basile/Visual\-Cpp\-Projects/hydro\-MEX3/hydro\-MEX3/o\-GL\_\-graphics/graphics\_\-relative.h File Reference}
\label{graphics__relative_8h}\index{D:/Basile/VisualCppProjects/hydroMEX3/hydroMEX3/oGL_graphics/graphics_relative.h@{D:/Basile/VisualCppProjects/hydroMEX3/hydroMEX3/oGL\_\-graphics/graphics\_\-relative.h}}
}
{\tt \#include $<$windows.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdarg.h$>$}\par
{\tt \#include $<$GL$\backslash$glut.h$>$}\par
{\tt \#include $<$GL$\backslash$gl.h$>$}\par
{\tt \#include $<$GL$\backslash$glu.h$>$}\par
{\tt \#include $<$GL$\backslash$glaux.h$>$}\par
{\tt \#include \char`\"{}../joystick/joystick\_\-PC.h\char`\"{}}\par
{\tt \#include \char`\"{}../hydro\_\-source/Datas.h\char`\"{}}\par
{\tt \#include \char`\"{}Sea.h\char`\"{}}\par
{\tt \#include \char`\"{}solid\_\-objects.h\char`\"{}}\par


Include dependency graph for graphics\_\-relative.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=383pt]{graphics__relative_8h__incl}
\end{center}
\end{figure}


This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=420pt]{graphics__relative_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
LRESULT CALLBACK \hyperlink{graphics__relative_8h_9135ea2a0d6fce68ba3b858226a31a4f}{Wnd\-Proc} (HWND, UINT, WPARAM, LPARAM)
\begin{CompactList}\small\item\em Callback and keyboard management. \item\end{CompactList}\item 
GLvoid \hyperlink{graphics__relative_8h_87bb84d489df61ed7b0c002584fd984f}{Re\-Size\-GLScene} (GLsizei width, GLsizei height)
\item 
int \hyperlink{graphics__relative_8h_a4c387d3f1ebce6d57684b6a10c9b0ae}{Init\-GL} (GLvoid)
\begin{CompactList}\small\item\em Initialize Open\-GL stuff. \item\end{CompactList}\item 
int \hyperlink{graphics__relative_8h_c1bae98baa191778a9ae0375cd06b5b6}{Draw\-GLScene} (\hyperlink{structdatas}{datas} $\ast$d)
\begin{CompactList}\small\item\em Draws the scene (open\-GL). \item\end{CompactList}\item 
GLvoid \hyperlink{graphics__relative_8h_f33a2273205c1491be5916d3091658e0}{Kill\-GLWindow} (GLvoid)
\item 
BOOL \hyperlink{graphics__relative_8h_3dfa55ee6b8056d7438335d2d48977b6}{Create\-GLWindow} (char $\ast$title, int width, int height, int bits, bool fullscreenflag)
\begin{CompactList}\small\item\em Sub-function for window closing stuffs. \item\end{CompactList}\item 
int \hyperlink{graphics__relative_8h_3bb9e166d32f46d151241c84d540f7d5}{draw\_\-graphics\_\-init} (\hyperlink{structdatas}{datas} $\ast$d)
\begin{CompactList}\small\item\em General graphic stuff initialisation. \item\end{CompactList}\item 
bool \hyperlink{graphics__relative_8h_fee90b4ec4217feed41c1a8086ef5f52}{draw\_\-graphics} (\hyperlink{structdatas}{datas} $\ast$d)
\begin{CompactList}\small\item\em General graphic (scene) display and keyboard reading. \item\end{CompactList}\item 
int \hyperlink{graphics__relative_8h_7676cd9244f6e90a0c1a15d51b05d964}{draw\_\-graphics\_\-kill} ()
\begin{CompactList}\small\item\em General graphic (scene/window) closing. \item\end{CompactList}\item 
void \hyperlink{graphics__relative_8h_dac6dff8e0b477523ef130bc4603df35}{pass\_\-joy\_\-parameters} (\hyperlink{structjoy__parameters}{joy\_\-parameters} $\ast$j\-P)
\begin{CompactList}\small\item\em Copy joystick parameters from MATLAB struct. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
\begin{Desc}
\item[Author:]\href{mailto:basile.graf@epfl.ch}{\tt basile.graf@epfl.ch}\end{Desc}
This file contains includes for graphical purposes and declarations for some graphic related functions 

Definition in file \hyperlink{graphics__relative_8h-source}{graphics\_\-relative.h}.

\subsection{Function Documentation}
\hypertarget{graphics__relative_8h_3dfa55ee6b8056d7438335d2d48977b6}{
\index{graphics_relative.h@{graphics\_\-relative.h}!CreateGLWindow@{CreateGLWindow}}
\index{CreateGLWindow@{CreateGLWindow}!graphics_relative.h@{graphics\_\-relative.h}}
\subsubsection[CreateGLWindow]{\setlength{\rightskip}{0pt plus 5cm}BOOL Create\-GLWindow (char $\ast$ {\em title}, int {\em width}, int {\em height}, int {\em bits}, bool {\em fullscreenflag})}}
\label{graphics__relative_8h_3dfa55ee6b8056d7438335d2d48977b6}


Sub-function for window closing stuffs. 



Definition at line 331 of file graphics\_\-main.cpp.

References fullscreen, h\-DC, h\-Instance, h\-RC, h\-Wnd, Init\-GL(), Kill\-GLWindow(), Re\-Size\-GLScene(), and Wnd\-Proc().

Referenced by draw\_\-graphics(), and draw\_\-graphics\_\-init().\hypertarget{graphics__relative_8h_fee90b4ec4217feed41c1a8086ef5f52}{
\index{graphics_relative.h@{graphics\_\-relative.h}!draw_graphics@{draw\_\-graphics}}
\index{draw_graphics@{draw\_\-graphics}!graphics_relative.h@{graphics\_\-relative.h}}
\subsubsection[draw\_\-graphics]{\setlength{\rightskip}{0pt plus 5cm}bool draw\_\-graphics (\hyperlink{structdatas}{datas} $\ast$ {\em d})}}
\label{graphics__relative_8h_fee90b4ec4217feed41c1a8086ef5f52}


General graphic (scene) display and keyboard reading. 

A call to this function refreshes the entire scene. This function is to be used in the main computing loop. \par
 It also reads the keyboard for the different keyboard controls... \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$d}]: pointer to the datas data-structure \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if all went OK \end{Desc}


Definition at line 599 of file graphics\_\-main.cpp.

References active, allow\-Change\-Dir\-R, allow\-Change\-Dir\-X, allow\-Change\-Dir\-Y, allow\-Change\-Dir\-Z, allow\-Change\-Do\-R, allow\-Change\-Do\-X, allow\-Change\-Do\-Y, allow\-Change\-Do\-Z, datas::angle\_\-girouette, Create\-GLWindow(), dir\-R, dir\-X, dir\-Y, dir\-Z, done, do\-R, do\-X, do\-Y, do\-Z, Draw\-GLScene(), dview\-Angle, dview\-Dist, fullscreen, h\-DC, datas::Hslider\_\-x, keys, Kill\-GLWindow(), datas::max\_\-abs\_\-angle\_\-baume, msg, datas::t, datas::tan\-Angle\_\-sail, datas::target\_\-x, datas::target\_\-y, time\_\-before, time\_\-elapsed, view\-Angle1, view\-Angle2, view\-Dist, 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 mex\-Function().\hypertarget{graphics__relative_8h_3bb9e166d32f46d151241c84d540f7d5}{
\index{graphics_relative.h@{graphics\_\-relative.h}!draw_graphics_init@{draw\_\-graphics\_\-init}}
\index{draw_graphics_init@{draw\_\-graphics\_\-init}!graphics_relative.h@{graphics\_\-relative.h}}
\subsubsection[draw\_\-graphics\_\-init]{\setlength{\rightskip}{0pt plus 5cm}int draw\_\-graphics\_\-init (\hyperlink{structdatas}{datas} $\ast$ {\em d})}}
\label{graphics__relative_8h_3bb9e166d32f46d151241c84d540f7d5}


General graphic stuff initialisation. 

Ask for full-screen or not, creates window and try to initialize the joystick. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$d}]: pointer to the datas data-structure \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]1 if window created sucessfully \end{Desc}


Definition at line 568 of file graphics\_\-main.cpp.

References Create\-GLWindow(), fullscreen, joystick\_\-exist, and joystick\_\-init().

Referenced by mex\-Function().\hypertarget{graphics__relative_8h_7676cd9244f6e90a0c1a15d51b05d964}{
\index{graphics_relative.h@{graphics\_\-relative.h}!draw_graphics_kill@{draw\_\-graphics\_\-kill}}
\index{draw_graphics_kill@{draw\_\-graphics\_\-kill}!graphics_relative.h@{graphics\_\-relative.h}}
\subsubsection[draw\_\-graphics\_\-kill]{\setlength{\rightskip}{0pt plus 5cm}int draw\_\-graphics\_\-kill ()}}
\label{graphics__relative_8h_7676cd9244f6e90a0c1a15d51b05d964}


General graphic (scene/window) closing. 

Closes window and joystick \begin{Desc}
\item[Returns:]msg.w\-Param (MS Windows !) \end{Desc}


Definition at line 774 of file graphics\_\-main.cpp.

References done, joystick\_\-close(), Kill\-GLWindow(), and msg.

Referenced by mex\-Function().\hypertarget{graphics__relative_8h_c1bae98baa191778a9ae0375cd06b5b6}{
\index{graphics_relative.h@{graphics\_\-relative.h}!DrawGLScene@{DrawGLScene}}
\index{DrawGLScene@{DrawGLScene}!graphics_relative.h@{graphics\_\-relative.h}}
\subsubsection[DrawGLScene]{\setlength{\rightskip}{0pt plus 5cm}int Draw\-GLScene (\hyperlink{structdatas}{datas} $\ast$ {\em d})}}
\label{graphics__relative_8h_c1bae98baa191778a9ae0375cd06b5b6}


Draws the scene (open\-GL). 

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 \hyperlink{graphics__main_8cpp_fee90b4ec4217feed41c1a8086ef5f52}{draw\_\-graphics()}. 

Definition at line 189 of file graphics\_\-main.cpp.

References angles\_\-update(), Boat\_\-draw(), dir\-R, dir\-X, dir\-Y, dir\-Z, do\-R, do\-X, do\-Y, do\-Z, Draw\_\-sea(), datas::dx, datas::dy, f(), fps, Girouette\_\-draw(), gl\-Print(), HSlider\_\-draw(), datas::Hslider\_\-x, joystick\_\-exist, joystick\_\-get\-XYZR(), Light\-Position, datas::phi, datas::psi, Relative\-Wind\_\-draw(), Sail\_\-create\_\-and\_\-draw(), Target\_\-draw(), datas::target\_\-x, datas::target\_\-y, datas::theta, time\_\-elapsed, view\-Angle1, view\-Angle2, view\-Dist, 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 draw\_\-graphics().\hypertarget{graphics__relative_8h_a4c387d3f1ebce6d57684b6a10c9b0ae}{
\index{graphics_relative.h@{graphics\_\-relative.h}!InitGL@{InitGL}}
\index{InitGL@{InitGL}!graphics_relative.h@{graphics\_\-relative.h}}
\subsubsection[InitGL]{\setlength{\rightskip}{0pt plus 5cm}int Init\-GL (GLvoid)}}
\label{graphics__relative_8h_a4c387d3f1ebce6d57684b6a10c9b0ae}


Initialize Open\-GL stuff. 

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

Definition at line 159 of file graphics\_\-main.cpp.

References Build\-Font(), f(), Light\-Ambient, Light\-Diffuse, and Light\-Position.

Referenced by Create\-GLWindow().\hypertarget{graphics__relative_8h_f33a2273205c1491be5916d3091658e0}{
\index{graphics_relative.h@{graphics\_\-relative.h}!KillGLWindow@{KillGLWindow}}
\index{KillGLWindow@{KillGLWindow}!graphics_relative.h@{graphics\_\-relative.h}}
\subsubsection[KillGLWindow]{\setlength{\rightskip}{0pt plus 5cm}GLvoid Kill\-GLWindow (GLvoid)}}
\label{graphics__relative_8h_f33a2273205c1491be5916d3091658e0}




Definition at line 287 of file graphics\_\-main.cpp.

References fullscreen, h\-DC, h\-Instance, h\-RC, and h\-Wnd.

Referenced by Create\-GLWindow(), draw\_\-graphics(), and draw\_\-graphics\_\-kill().\hypertarget{graphics__relative_8h_dac6dff8e0b477523ef130bc4603df35}{
\index{graphics_relative.h@{graphics\_\-relative.h}!pass_joy_parameters@{pass\_\-joy\_\-parameters}}
\index{pass_joy_parameters@{pass\_\-joy\_\-parameters}!graphics_relative.h@{graphics\_\-relative.h}}
\subsubsection[pass\_\-joy\_\-parameters]{\setlength{\rightskip}{0pt plus 5cm}void pass\_\-joy\_\-parameters (\hyperlink{structjoy__parameters}{joy\_\-parameters} $\ast$ {\em j\-P})}}
\label{graphics__relative_8h_dac6dff8e0b477523ef130bc4603df35}


Copy joystick parameters from MATLAB struct. 

Copy the joystick parameters (do\-X, do\-Y ,do\-Z ,do\-R and dir\-X ,dir\-Y ,di\-Z ,dir\-R) from the MATLAB struct $\ast$j\-P to the local joystick parameters variables. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$j\-P}]: Structure comming from MATLAB or filled with default values defining joystick axes usage and direction. \end{description}
\end{Desc}


Definition at line 788 of file graphics\_\-main.cpp.

References joy\_\-parameters::dir\-R, dir\-R, joy\_\-parameters::dir\-X, dir\-X, joy\_\-parameters::dir\-Y, dir\-Y, joy\_\-parameters::dir\-Z, dir\-Z, joy\_\-parameters::do\-R, do\-R, joy\_\-parameters::do\-X, do\-X, joy\_\-parameters::do\-Y, do\-Y, joy\_\-parameters::do\-Z, and do\-Z.

Referenced by mex\-Function().\hypertarget{graphics__relative_8h_87bb84d489df61ed7b0c002584fd984f}{
\index{graphics_relative.h@{graphics\_\-relative.h}!ReSizeGLScene@{ReSizeGLScene}}
\index{ReSizeGLScene@{ReSizeGLScene}!graphics_relative.h@{graphics\_\-relative.h}}
\subsubsection[ReSizeGLScene]{\setlength{\rightskip}{0pt plus 5cm}GLvoid Re\-Size\-GLScene (GLsizei {\em width}, GLsizei {\em height})}}
\label{graphics__relative_8h_87bb84d489df61ed7b0c002584fd984f}




Definition at line 138 of file graphics\_\-main.cpp.

References f().

Referenced by Create\-GLWindow(), and Wnd\-Proc().\hypertarget{graphics__relative_8h_9135ea2a0d6fce68ba3b858226a31a4f}{
\index{graphics_relative.h@{graphics\_\-relative.h}!WndProc@{WndProc}}
\index{WndProc@{WndProc}!graphics_relative.h@{graphics\_\-relative.h}}
\subsubsection[WndProc]{\setlength{\rightskip}{0pt plus 5cm}LRESULT CALLBACK Wnd\-Proc (HWND, UINT, WPARAM, LPARAM)}}
\label{graphics__relative_8h_9135ea2a0d6fce68ba3b858226a31a4f}


Callback and keyboard management. 



Definition at line 510 of file graphics\_\-main.cpp.

References active, keys, and Re\-Size\-GLScene().

Referenced by Create\-GLWindow().