#include <OpenGLView.h>
Public Member Functions | |
OpenGLView (CDocument *, CDC *, CPaintDC &, CRect &) | |
virtual | ~OpenGLView () |
virtual void | renderScene () |
virtual BOOL | initOpenGL () |
void | setContext () |
void | OnPaint () |
Public Attributes | |
CDC * | device_context_ |
The device context. | |
int | last_mouse_x_ |
This holds the last x mouse position. | |
int | last_mouse_y_ |
This holds the last y mouse position. | |
CDocument * | document |
CPaintDC * | paint_device_context_ |
CRect * | rect_ |
unsigned int | x_dim_ |
unsigned int | y_dim_ |
float | pic_size |
The draw size of the image. | |
RGBAColor * | picture_data_ |
The color data for the OpenGL rendering. | |
CFlowVisApp * | flow_vis_ |
Protected Member Functions | |
virtual BOOL | createViewGLContext () |
BOOL | setupPixelFormat () |
void | swapGLBuffers () |
void | OnMouseMove (UINT flags, CPoint point) |
virtual void | OnDraw (CDC *device_context) |
virtual BOOL | PreCreateWindow (CREATESTRUCT &create_struct) |
CFlowVisDoc * | GetDocument () |
afx_msg int | OnCreate (LPCREATESTRUCT create_struct) |
afx_msg void | OnDestroy () |
afx_msg BOOL | OnEraseBkgnd (CDC *device_context) |
afx_msg void | OnTimer (UINT event_id) |
afx_msg void | OnSize (UINT type, int new_width, int new_height) |
Protected Attributes | |
HGLRC | rendering_context_ |
The rendering context handle. | |
GLfloat * | ambient_light_ |
The ambient light for the lighting of objects. | |
GLfloat * | diffuse_light_ |
The diffuse light for the lighting of objects. | |
GLfloat * | light_position_ |
The light position. | |
double | view_width_height_ratio_ |
OpenGLView::OpenGLView | ( | CDocument * | , | |
CDC * | , | |||
CPaintDC & | , | |||
CRect & | ||||
) |
The default constructor.
OpenGLView::~OpenGLView | ( | ) | [virtual] |
The destructor.
BOOL OpenGLView::createViewGLContext | ( | ) | [protected, virtual] |
Creates the OpenGL context for drawing on the view.
CFlowVisDoc* OpenGLView::GetDocument | ( | ) | [inline, protected] |
Call this function to get a pointer to the view's document.
BOOL OpenGLView::initOpenGL | ( | ) | [virtual] |
This initializes all stuff needed for the OpenGL rendering.
int OpenGLView::OnCreate | ( | LPCREATESTRUCT | create_struct | ) | [protected] |
The MFC framework calls this member function when an application requests that the Windows window be created by calling the Create or CreateEx member function.
create_struct | Points to a CREATESTRUCT structure that contains information about the CWnd object being created. |
void OpenGLView::OnDestroy | ( | ) | [protected] |
The framework calls this member function to inform the CWnd object that it is being destroyed.
void OpenGLView::OnDraw | ( | CDC * | device_context | ) | [protected, virtual] |
This overrided method is resonsible for rendering of an image of the document.
device_context | This is used to render an image of the document. |
BOOL OpenGLView::OnEraseBkgnd | ( | CDC * | device_context | ) | [protected] |
The MFC framework calls this member function when the CWnd object background needs erasing (for example, when resized).
device_context | Specifies the device-context object. |
void OpenGLView::OnMouseMove | ( | UINT | flags, | |
CPoint | point | |||
) | [protected] |
The MFC framework calls this member function when the mouse cursor moves.
flags | Indicates whether various virtual keys are down. | |
point | Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window. |
void OpenGLView::OnPaint | ( | ) |
void OpenGLView::OnSize | ( | UINT | type, | |
int | new_width, | |||
int | new_height | |||
) | [protected] |
The framework calls this member function after the window's size has changed. Here we adjust the viewport after sizing the window.
type | Specifies the type of resizing requested. | |
new_width | Specifies the new width of the client area. | |
new_height | Specifies the new height of the client area. information about the CWnd object being created. |
void OpenGLView::OnTimer | ( | UINT | event_id | ) | [protected] |
The framework calls this member function after each interval specified in the SetTimer member function used to install a timer.
event_id | Specifies the identifier of the timer. |
BOOL OpenGLView::PreCreateWindow | ( | CREATESTRUCT & | create_struct | ) | [protected, virtual] |
Called before the creation of the Windows window attached to this CWnd object.
create_struct | This structure defines the initialization parameters passed to the window procedure of an application. |
void OpenGLView::renderScene | ( | ) | [virtual] |
Renders the scene of the current OpenGL view.
void OpenGLView::setContext | ( | ) |
Sets the rendering context.
BOOL OpenGLView::setupPixelFormat | ( | ) | [protected] |
Sets the format of the pixels to draw.
void OpenGLView::swapGLBuffers | ( | ) | [protected] |
Sets the device context.
GLfloat* OpenGLView::ambient_light_ [protected] |
The ambient light for the lighting of objects.
The device context.
GLfloat* OpenGLView::diffuse_light_ [protected] |
The diffuse light for the lighting of objects.
CDocument* OpenGLView::document |
This holds the last x mouse position.
This holds the last y mouse position.
GLfloat* OpenGLView::light_position_ [protected] |
The light position.
CPaintDC* OpenGLView::paint_device_context_ |
float OpenGLView::pic_size |
The draw size of the image.
The color data for the OpenGL rendering.
CRect* OpenGLView::rect_ |
HGLRC OpenGLView::rendering_context_ [protected] |
The rendering context handle.
double OpenGLView::view_width_height_ratio_ [protected] |
The ratio between the width of the view and the height of the view.
unsigned int OpenGLView::x_dim_ |
unsigned int OpenGLView::y_dim_ |