Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

vrj::GlWindowWin32 Class Reference

#include <GlWindowWin32.h>

Inheritance diagram for vrj::GlWindowWin32:

Inheritance graph
[legend]
Collaboration diagram for vrj::GlWindowWin32:

Collaboration graph
[legend]
List of all members.

Public Methods

 GlWindowWin32 ()
virtual ~GlWindowWin32 ()
virtual int open ()
 Opens the OpenGL window. More...

virtual int close ()
 Closes the OpenGL window. More...

virtual bool makeCurrent ()
 Sets the current OpenGL context to this window. More...

virtual void swapBuffers ()
 Performs an OpenGL swap buffers command. More...

virtual void checkEvents ()
 Checks for window events. More...

void configWindow (vrj::Display *disp)
 Configures the window. More...


Public Attributes

HWND mWinHandle
 Window handle. More...

HGLRC mRenderContext
 Permenant Rendering context. More...

HDC mDeviceContext
 Private GDI Device context. More...

std::string window_name
int mPipe
std::string mXDisplayName
 Name of the x display to use. More...

PIXELFORMATDESCRIPTOR * mMatch
 Points the the found pixel format. More...


Protected Methods

LRESULT handleEvent (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
bool setPixelFormat (HDC hDC)
 Sets the pixel format for the given display context. More...

void sizeChanged (long width, long height)
virtual void processEvent (UINT message, UINT wParam, LONG lParam)
 Sample from the window. More...

void becomeEventWindowDevice ()
 Do the stuff needed to become an event window. More...

void removeEventWindowDevice ()
 do the stuff to make this not a gadgeteer device. More...


Static Protected Methods

bool registerWindowClass ()
LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 Global Window event handler. More...

void addWindow (HWND handle, GlWindowWin32 *glWin)
 Adds a window to the map. More...

void removeWindow (HWND handle)
 Removes a window from the map. More...

GlWindowWin32 * getGlWin (HWND handle)
 Gets the glWin we are dealing with. More...


Static Protected Attributes

WNDCLASS mWinClass
 The window class to register. More...

bool mWinRegisteredClass = false
 Window registration. More...

std::map< HWND, GlWindowWin32 * > mGlWinMap

Constructor & Destructor Documentation

vrj::GlWindowWin32::GlWindowWin32  
 

Definition at line 51 of file GlWindowWin32.cpp.

Referenced by WndProc.

00052    : mMatch(NULL), mWinHandle(NULL), mRenderContext(NULL),
00053       mDeviceContext(NULL)
00054 {
00055 }

vrj::GlWindowWin32::~GlWindowWin32   [virtual]
 

Definition at line 56 of file GlWindowWin32.cpp.

References close.

00057 {
00058    this->close();
00059 }


Member Function Documentation

int vrj::GlWindowWin32::open   [virtual]
 

Opens the OpenGL window.

Precondition:
this has been configured.
Postcondition:
Window created. Create message sets the visual.
Returns:
true if the window opened correctly.

Reimplemented from vrj::GlWindow.

Definition at line 65 of file GlWindowWin32.cpp.

References becomeEventWindowDevice, GL_WINDOW_WIN32_CLASSNAME, vrj::GlWindow::mAreEventSource, mDeviceContext, mRenderContext, mWinHandle, vrj::GlWindow::origin_x, vrj::GlWindow::origin_y, setPixelFormat, vrjDBG_DRAW_MGR, vrj::GlWindow::window_height, vrj::GlWindow::window_is_open, and vrj::GlWindow::window_width.

00066 {
00067    if ( false == GlWindowWin32::registerWindowClass() )
00068    {
00069       return 0;
00070    }
00071 
00072    if ( window_is_open )
00073    {
00074       return 1;
00075    }
00076 
00077    HMODULE hMod = GetModuleHandle(NULL);
00078    DWORD style;
00079    int root_height;
00080 
00081    // OpenGL requires WS_CLIPCHILDREN and WS_CLIPSIBLINGS.
00082    style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
00083 
00084    // If we want a border, create an overlapped window.  This will have
00085    // a titlebar and a border.
00086    if ( border )
00087    {
00088       vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_HVERB_LVL) << "attempting to give window a border"
00089          << std::endl << vprDEBUG_FLUSH;
00090       style |= WS_OVERLAPPEDWINDOW;
00091    }
00092    // Otherwise, come as close as possible to having no border by using
00093    // the thin-line border.
00094    else
00095    {
00096       vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_HVERB_LVL) << "attempting to make window borderless"
00097          << std::endl << vprDEBUG_FLUSH;
00098       style |= WS_OVERLAPPED | WS_POPUP | WS_VISIBLE;
00099    }
00100 
00101    root_height = GetSystemMetrics(SM_CYSCREEN);
00102 
00103    // Create the main application window
00104    mWinHandle = CreateWindow(GL_WINDOW_WIN32_CLASSNAME,
00105                              GL_WINDOW_WIN32_CLASSNAME, style,
00106                              origin_x, root_height - origin_y - window_height,
00107                              window_width, window_height, NULL, NULL, hMod,
00108                              NULL);
00109 
00110    // If window was not created, quit
00111    if ( NULL == mWinHandle )
00112    {
00113       return 0;
00114    }
00115 
00116    // Attach a pointer to the device for use from the WNDPROC
00117    SetWindowLong( mWinHandle, GWL_USERDATA, (LPARAM)this );
00118 
00119    // We have a valid window, so... Create the context
00120    //case WM_CREATE:
00121    mDeviceContext = GetDC(mWinHandle);            // Store the device context
00122    if ( false == setPixelFormat(mDeviceContext) ) // Select the pixel format
00123    {
00124       return 0;
00125    }
00126 
00127    // Create the rendering context and make it current
00128    mRenderContext = wglCreateContext(mDeviceContext);
00129    vprASSERT(mRenderContext != NULL);
00130    wglMakeCurrent(mDeviceContext, mRenderContext);
00131 
00132    // Register the window with the window list
00133    GlWindowWin32::addWindow(mWinHandle,this);
00134 
00135    // Display the window
00136    ShowWindow(mWinHandle, SW_SHOW);
00137    UpdateWindow(mWinHandle);             // Tell the window to paint
00138    window_is_open = true;
00139 
00140    // ----------- Event window device starting -------------- //
00141    // Are we going to act like as an event source?
00142    if (true == mAreEventSource)
00143    {
00144       this->becomeEventWindowDevice();
00145    }
00146 
00147    return 1;
00148 }

int vrj::GlWindowWin32::close   [virtual]
 

Closes the OpenGL window.

Returns:
true if the window closed correctly.
Note:
Must be called by the same thread that called open.

Reimplemented from vrj::GlWindow.

Definition at line 189 of file GlWindowWin32.cpp.

References mWinHandle, removeEventWindowDevice, and vrj::GlWindow::window_is_open.

Referenced by ~GlWindowWin32.

00190 {
00191    //vprASSERT( !mXfuncLock.test() && "Attempting to close a display window that is locked" );
00192    // Assert that we have not impllemented correct shutdown for the case that we
00193    // are an event window as well
00194    //vprASSERT(!mAreEventSource  && "Need to implement win32 window close with gadget::EventWindow");
00195 
00196    // if not open, then don't bother.
00197    if ( !window_is_open )
00198    {
00199       return false;
00200    }
00201 
00202    if (mAreEventSource)
00203    {
00204       this->removeEventWindowDevice();
00205    }
00206 
00207    // Remove window from window list
00208    GlWindowWin32::removeWindow(mWinHandle);
00209 
00210    window_is_open = false;
00211 
00212    // destroy the win32 window
00213    return(1 == DestroyWindow(mWinHandle));
00214 }

bool vrj::GlWindowWin32::makeCurrent   [virtual]
 

Sets the current OpenGL context to this window.

Postcondition:
this.context is active context.

Reimplemented from vrj::GlWindow.

Definition at line 220 of file GlWindowWin32.cpp.

References mDeviceContext, and mRenderContext.

00221 {
00222    vprASSERT((mDeviceContext != NULL) && (mRenderContext != NULL));
00223    wglMakeCurrent(mDeviceContext, mRenderContext);  // Make our context current
00224    return true;
00225 }

void vrj::GlWindowWin32::swapBuffers   [virtual]
 

Performs an OpenGL swap buffers command.

Reimplemented from vrj::GlWindow.

Definition at line 229 of file GlWindowWin32.cpp.

References mDeviceContext.

00230 {
00231    vprASSERT(mDeviceContext != NULL);
00232    SwapBuffers(mDeviceContext);
00233 }

void vrj::GlWindowWin32::checkEvents   [virtual]
 

Checks for window events.

Postcondition:
All win32 events have ben dispatched and dealt with.

Reimplemented from vrj::GlWindow.

Definition at line 235 of file GlWindowWin32.cpp.

References vrj::GlWindow::mAreEventSource.

00236 {
00237    if (true == mAreEventSource)
00238    {
00240       gadget::EventWindowWin32::sample();
00241       // if event source, use its event processor
00242       // it will pass all events up to this->processEvent()
00243       // when done, so that we can see the messages.
00244    }
00245    else
00246    {
00247       // not an event source, so pump our own events
00248       MSG win_message;
00249       while (PeekMessage( &win_message, NULL, 0, 0, PM_REMOVE ))
00250       {
00251          // Test if quit
00252          if (win_message.message == WM_QUIT)
00253          {
00254             break;
00255          }
00256 
00257          TranslateMessage( &win_message );     // Translate the accelerator keys
00258          DispatchMessage( &win_message );      // Send to the WinProc
00259       }
00260    }
00261 }

void vrj::GlWindowWin32::configWindow vrj::Display   disp [virtual]
 

Configures the window.

Postcondition:
this is configured based on the data in display.

Reimplemented from vrj::GlWindow.

Definition at line 268 of file GlWindowWin32.cpp.

References becomeEventWindowDevice, vrj::GlWindow::configWindow, vrj::Display::getConfigElement, vrj::Display::getName, vrj::Display::getPipe, vrj::GlWindow::mAreEventSource, mPipe, mXDisplayName, removeEventWindowDevice, vrjDBG_DRAW_MGR, and window_name.

00269 {
00270    const char neg_one_STRING[] = "-1";
00271    vprASSERT( disp != NULL );
00272    vrj::GlWindow::configWindow( disp );
00273 
00274     // Get the vector of display chunks
00275    jccl::ConfigElementPtr disp_sys_elt = DisplayManager::instance()->getDisplaySystemElement();
00276    jccl::ConfigElementPtr display_elt = disp->getConfigElement();
00277 
00278    window_name = disp->getName();
00279    mPipe = disp->getPipe();
00280    vprASSERT( mPipe >= 0 );
00281 
00282    mXDisplayName = disp_sys_elt->getProperty<std::string>("x11_pipes", mPipe);
00283    if (mXDisplayName == neg_one_STRING)    // Use display env
00284    {
00285        const std::string DISPLAY_str("DISPLAY");    // DISPLAY_str[] = "DISPLAY";
00286        const char* d = getenv(DISPLAY_str.c_str());
00287        if (NULL != d)
00288        {
00289           mXDisplayName = std::string( d );
00290        }
00291    }
00292    vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_VERB_LVL)
00293       << "glxWindow::config: display name is: "
00294       << mXDisplayName << std::endl << vprDEBUG_FLUSH;
00295 
00296    bool was_i_a_keyboard = mAreEventSource;
00297    mAreEventSource = display_elt->getProperty<bool>("act_as_event_source");
00298 
00299    // If i'm being configured to NOT be an event source, and I was one already.
00300    if (false == mAreEventSource && true == was_i_a_keyboard)
00301    {
00302       this->removeEventWindowDevice();
00303    }
00304 
00305    // If i'm being configured to be an event source, and I wasn't one already.
00306    else if (true == mAreEventSource && false == was_i_a_keyboard)
00307    {
00308       // Configure event window device portion.
00309       jccl::ConfigElementPtr event_win_chunk =
00310          display_elt->getProperty<jccl::ConfigElementPtr>("event_window_device");
00311 
00312       // Set the name of the chunk to the same as the parent chunk (so we can point at it)
00313       //event_win_chunk->setProperty("name", display_elt->getName();
00314 
00315       gadget::EventWindowWin32::config(event_win_chunk);
00316 
00317       // Custom configuration
00318       gadget::EventWindowWin32::mWidth = GlWindowWin32::window_width;
00319       gadget::EventWindowWin32::mHeight = GlWindowWin32::window_height;
00320 
00321       mWeOwnTheWindow = false;      // Event window device does not own window
00322 
00323       // if the window is already open, then make it an event window device
00324       // otherwise, this will be called once the window opens.
00325       if (window_is_open)
00326       {
00327          this->becomeEventWindowDevice();
00328       }
00329    }
00330 }

LRESULT vrj::GlWindowWin32::handleEvent HWND    hWnd,
UINT    message,
WPARAM    wParam,
LPARAM    lParam
[protected]
 

Definition at line 334 of file GlWindowWin32.cpp.

References mDeviceContext, mRenderContext, setPixelFormat, and sizeChanged.

00336 {
00337    switch ( message )
00338    {
00339       // ---- Window creation, setup for OpenGL ---- //
00340       case WM_CREATE:
00341          vprASSERT(false);                               // Should never get called because
00342                                                          //we are not registered when this gets called
00343 
00344          mDeviceContext = GetDC(hWnd);                   // Store the device context
00345          if ( false == setPixelFormat(mDeviceContext) )  // Select the pixel format
00346          {
00347             return 0;
00348          }
00349 
00350          // Create the rendering context and make it current
00351          mRenderContext = wglCreateContext(mDeviceContext);
00352          wglMakeCurrent(mDeviceContext, mRenderContext);
00353          break;
00354 
00355          // ---- Window is being destroyed, cleanup ---- //
00356       case WM_DESTROY:
00357 
00358          // Deselect the current rendering context and delete it
00359          wglMakeCurrent(mDeviceContext, NULL);
00360          wglDeleteContext(mRenderContext);
00361 
00362          // Tell the application to terminate after the window
00363          // is gone.
00364          PostQuitMessage(0);
00365          break;
00366 
00367          // --- Window is resized. --- //
00368       case WM_SIZE:
00369          // Call our function which modifies the clipping
00370          // volume and viewport
00371          sizeChanged(LOWORD(lParam), HIWORD(lParam));
00372          break;
00373 
00374 
00375          // The painting function.  This message sent by Windows
00376          // whenever the screen needs updating.
00377       case WM_PAINT:
00378          {
00379             PAINTSTRUCT   ps;           // Paint structure
00380             BeginPaint(hWnd, &ps);  // Validate the drawing of the window
00381             EndPaint(hWnd, &ps);
00382          }
00383          break;
00384 
00385       default:   // Passes it on if unproccessed
00386          return(DefWindowProc(hWnd, message, wParam, lParam));
00387 
00388    }
00389 
00390    return(0L);
00391 }

bool vrj::GlWindowWin32::setPixelFormat HDC    hDC [protected]
 

Sets the pixel format for the given display context.

Returns:
success

Definition at line 394 of file GlWindowWin32.cpp.

References vrj::Display::getGlFrameBufferConfig, vrj::Display::getName, vrj::GlWindow::in_stereo, vrj::Display::isStereoRequested, mMatch, vrj::GlWindow::mVrjDisplay, vrjDBG_DISP_MGR, and vrjDBG_DRAW_MGR.

Referenced by handleEvent, and open.

00395 {
00396    int pixel_format;
00397    PIXELFORMATDESCRIPTOR pfd;
00398    mMatch = NULL;
00399 
00400    memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
00401    pfd.nSize = (sizeof(PIXELFORMATDESCRIPTOR));
00402    pfd.nVersion = 1;
00403 
00404    /* Defaults. */
00405    pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER;
00406 
00407    if ( mVrjDisplay->isStereoRequested() )
00408    {
00409       in_stereo = true;
00410       pfd.dwFlags |= PFD_STEREO;
00411    }
00412    else
00413    {
00414       in_stereo = false;
00415    }
00416 
00417    int red_size(8), green_size(8), blue_size(8), alpha_size(8), db_size(32);
00418    jccl::ConfigElementPtr gl_fb_chunk = mVrjDisplay->getGlFrameBufferConfig();
00419 
00420    if ( gl_fb_chunk.get() != NULL )
00421    {
00422       red_size   = gl_fb_chunk->getProperty<int>("red_size");
00423       green_size = gl_fb_chunk->getProperty<int>("green_size");
00424       blue_size  = gl_fb_chunk->getProperty<int>("blue_size");
00425       alpha_size = gl_fb_chunk->getProperty<int>("alpha_size");
00426       db_size    = gl_fb_chunk->getProperty<int>("depth_buffer_size");
00427 
00428       if ( red_size < 0 )
00429       {
00430          vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_WARNING_LVL)
00431             << "WARNING: Red channel size was negative, set to: " << red_size
00432             << ".  Setting to 1.\n" << vprDEBUG_FLUSH;
00433          red_size = 1;
00434       }
00435 
00436       if ( green_size < 0 )
00437       {
00438          vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_WARNING_LVL)
00439             << "WARNING: Green channel size was negative, set to: "
00440             << green_size << ".  Setting to 1.\n" << vprDEBUG_FLUSH;
00441          green_size = 1;
00442       }
00443 
00444       if ( blue_size < 0 )
00445       {
00446          vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_WARNING_LVL)
00447             << "WARNING: Blue channel size was negative, set to: " << blue_size
00448             << ".  Setting to 1.\n" << vprDEBUG_FLUSH;
00449          blue_size = 1;
00450       }
00451 
00452       if ( alpha_size < 0 )
00453       {
00454          vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_WARNING_LVL)
00455             << "WARNING: Alpha channel size was negative, set to: "
00456             << alpha_size << ".  Setting to 1.\n" << vprDEBUG_FLUSH;
00457          alpha_size = 1;
00458       }
00459 
00460       if ( db_size < 0 )
00461       {
00462          vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_WARNING_LVL)
00463             << "WARNING: Depth buffer size was negative, set to: " << db_size
00464             << ".  Setting to 1.\n" << vprDEBUG_FLUSH;
00465          db_size = 1;
00466       }
00467    }
00468 
00469    vprDEBUG(vrjDBG_DISP_MGR, vprDBG_CONFIG_LVL)
00470       << "Frame buffer visual settings for " << mVrjDisplay->getName()
00471       << ": R:" << red_size << " G:" << green_size << " B:" << blue_size
00472       << " A:" << alpha_size << " DB:" << db_size << std::endl
00473       << vprDEBUG_FLUSH;
00474 
00475    pfd.iPixelType = PFD_TYPE_RGBA;
00476    pfd.cColorBits = 32;
00477    pfd.cRedBits = red_size;
00478    pfd.cGreenBits = green_size;
00479    pfd.cBlueBits = blue_size;
00480    pfd.cAlphaBits = alpha_size;
00481    pfd.cDepthBits = db_size;
00482    pfd.cStencilBits = 0;
00483    pfd.cAccumBits = 0;
00484    pfd.cAuxBuffers = 0;
00485 
00486    // Let Win32 choose one for us
00487    pixel_format = ChoosePixelFormat(hDC, &pfd);
00488    if ( pixel_format > 0 )
00489    {
00490       mMatch = (PIXELFORMATDESCRIPTOR *) malloc(sizeof(PIXELFORMATDESCRIPTOR));
00491       DescribePixelFormat(hDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),
00492                           mMatch);
00493 
00494       /* ChoosePixelFormat is dumb in that it will return a pixel
00495          format that doesn't have stereo even if it was requested
00496          so we need to make sure that if stereo was selected, we
00497          got it. */
00498       if ( mVrjDisplay->isStereoRequested() )
00499       {
00500          if ( !(mMatch->dwFlags & PFD_STEREO) )
00501          {
00502             free(mMatch);
00503             return NULL;
00504          }
00505       }
00506    }
00507 
00508    // Set the pixel format for the device context
00509    SetPixelFormat(hDC, pixel_format, &pfd);
00510    return true;
00511 }

void vrj::GlWindowWin32::sizeChanged long    width,
long    height
[protected]
 

Definition at line 514 of file GlWindowWin32.cpp.

References vrj::GlWindow::window_height, and vrj::GlWindow::window_width.

Referenced by handleEvent.

00515 {
00516    window_width = width;
00517    window_height = height;
00518 
00519    if ( window_width == 0 )        // Make sure we don't have window of 1 size (divide by zero would follow)
00520    {
00521       window_width = 1;
00522    }
00523 
00524    if ( window_height == 0 )
00525    {
00526       window_height = 1;
00527    }
00528 
00529    // XXX: Should reset viewport here
00530 }

bool vrj::GlWindowWin32::registerWindowClass   [static, protected]
 

Definition at line 561 of file GlWindowWin32.cpp.

References GL_WINDOW_WIN32_CLASSNAME, mWinClass, and mWinRegisteredClass.

00562 {
00563    if ( mWinRegisteredClass )
00564    {
00565       return true;
00566    }
00567 
00568    char lpszAppName[1024];
00569    GetModuleFileName(NULL,lpszAppName,sizeof(lpszAppName));
00570 
00571    mWinRegisteredClass = true;     // We have registered now
00572 
00573    HINSTANCE hInstance = GetModuleHandle(NULL);
00574 
00575    // Register Window style
00576    mWinClass.style       = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
00577    mWinClass.lpfnWndProc = (WNDPROC)GlWindowWin32::WndProc;
00578    mWinClass.cbClsExtra  = 0;
00579    mWinClass.cbWndExtra  = 0;
00580    mWinClass.hInstance   = hInstance;            // Get handle to the module that created current process
00581    mWinClass.hIcon       = LoadIcon(NULL, IDI_WINLOGO);;
00582    mWinClass.hCursor     = LoadCursor(NULL, IDC_ARROW);
00583 
00584    // No need for background brush for OpenGL window
00585    mWinClass.hbrBackground  = NULL;
00586 
00587    mWinClass.lpszMenuName   = NULL;
00588    mWinClass.lpszClassName  = GL_WINDOW_WIN32_CLASSNAME;
00589 
00590    // Register the window class
00591    if ( RegisterClass(&mWinClass) == 0 )
00592    {
00593       return false;
00594    }
00595    else
00596    {
00597       return true;
00598    }
00599 }

LRESULT CALLBACK vrj::GlWindowWin32::WndProc HWND    hWnd,
UINT    message,
WPARAM    wParam,
LPARAM    lParam
[static, protected]
 

Global Window event handler.

Definition at line 537 of file GlWindowWin32.cpp.

References getGlWin, and GlWindowWin32.

00539 {
00540    GlWindowWin32* glWin = getGlWin(hWnd);
00541 
00542    if ( glWin != NULL )       // Message for one of ours
00543    {
00544       glWin->processEvent( message, wParam, lParam );
00545       return glWin->handleEvent(hWnd, message, wParam, lParam);
00546    }
00547    else
00548    {
00549       return DefWindowProc(hWnd, message, wParam, lParam);
00550    }
00551 }

void vrj::GlWindowWin32::addWindow HWND    handle,
GlWindowWin32 *    glWin
[static, protected]
 

Adds a window to the map.

Definition at line 604 of file GlWindowWin32.cpp.

References mGlWinMap.

00605 {
00606    vprASSERT(glWin != NULL);
00607 
00608    if ( mGlWinMap.find(handle) == mGlWinMap.end() )     // Not already there
00609    {
00610       mGlWinMap[handle] = glWin;
00611    }
00612    //else
00613    // vprASSERT(false);
00614 }

void vrj::GlWindowWin32::removeWindow HWND    handle [static, protected]
 

Removes a window from the map.

Definition at line 616 of file GlWindowWin32.cpp.

References mGlWinMap.

00617 {
00618    mGlWinMap.erase(handle);     // Erase the entry in the list
00619 }

GlWindowWin32 * vrj::GlWindowWin32::getGlWin HWND    handle [static, protected]
 

Gets the glWin we are dealing with.

Definition at line 621 of file GlWindowWin32.cpp.

References mGlWinMap.

Referenced by WndProc.

00622 {
00623    std::map<HWND, GlWindowWin32*>::iterator glWinIter;
00624 
00625    glWinIter = mGlWinMap.find(handle);
00626    if ( glWinIter == mGlWinMap.end() )     // Not found
00627    {
00628       return NULL;
00629    }
00630    else
00631    {
00632       return(*glWinIter).second;                 // Return the found window
00633    }
00634 }

void vrj::GlWindowWin32::processEvent UINT    message,
UINT    wParam,
LONG    lParam
[protected, virtual]
 

Sample from the window.

Called from seperate process (event window device update).

Definition at line 263 of file GlWindowWin32.cpp.

00264 {
00265 
00266 }

void vrj::GlWindowWin32::becomeEventWindowDevice   [protected]
 

Do the stuff needed to become an event window.

Precondition:
can be called any time

Definition at line 151 of file GlWindowWin32.cpp.

References mWinHandle.

Referenced by configWindow, and open.

00152 {
00153    // Set the parameters that we will need to get events
00154    gadget::EventWindowWin32::m_hWnd = mWinHandle;
00155 
00156    // Start up the device
00157    /*   Do it in out check event function
00158    gadget::EventWindowWin32::startSampling();
00159    */
00160 
00161    gadget::Input* dev_ptr = dynamic_cast<gadget::Input*>(this);
00162    vprASSERT( dev_ptr != NULL );
00163 
00164    // @todo Possibly not the best way to add this to input manager
00165    // - What happens when the event window is removed at run-time???
00166    // - What happens when this is called again?
00167    vrj::Kernel::instance()->getInputManager()->addDevice( dev_ptr );
00168 }

void vrj::GlWindowWin32::removeEventWindowDevice   [protected]
 

do the stuff to make this not a gadgeteer device.

Precondition:
can be called any time

Definition at line 170 of file GlWindowWin32.cpp.

Referenced by close, and configWindow.

00171 {
00172    gadget::EventWindowWin32::m_hWnd = 0;
00173 
00174    gadget::Input* dev_ptr = dynamic_cast<gadget::Input*>(this);
00175    vprASSERT( dev_ptr != NULL );
00176 
00177    // @todo Possibly not the best way to add this to input manager
00178    // - What happens when the event window is removed at run-time???
00179    // - What happens when this is called again?
00180 
00181    // @todo reenable this when InputManager::removeDevice(Input*) is public
00182    //vrj::Kernel::instance()->getInputManager()->removeDevice( dev_ptr );
00183 }


Member Data Documentation

WNDCLASS vrj::GlWindowWin32::mWinClass [static, protected]
 

The window class to register.

Definition at line 557 of file GlWindowWin32.cpp.

Referenced by registerWindowClass.

bool vrj::GlWindowWin32::mWinRegisteredClass = false [static, protected]
 

Window registration.

Definition at line 556 of file GlWindowWin32.cpp.

Referenced by registerWindowClass.

std::map< HWND, GlWindowWin32 * > vrj::GlWindowWin32::mGlWinMap [static, protected]
 

Definition at line 558 of file GlWindowWin32.cpp.

Referenced by addWindow, getGlWin, and removeWindow.

HWND vrj::GlWindowWin32::mWinHandle
 

Window handle.

Definition at line 147 of file GlWindowWin32.h.

Referenced by becomeEventWindowDevice, close, and open.

HGLRC vrj::GlWindowWin32::mRenderContext
 

Permenant Rendering context.

Definition at line 148 of file GlWindowWin32.h.

Referenced by handleEvent, makeCurrent, and open.

HDC vrj::GlWindowWin32::mDeviceContext
 

Private GDI Device context.

Definition at line 149 of file GlWindowWin32.h.

Referenced by handleEvent, makeCurrent, open, and swapBuffers.

std::string vrj::GlWindowWin32::window_name
 

Definition at line 151 of file GlWindowWin32.h.

Referenced by configWindow.

int vrj::GlWindowWin32::mPipe
 

Definition at line 152 of file GlWindowWin32.h.

Referenced by configWindow.

std::string vrj::GlWindowWin32::mXDisplayName
 

Name of the x display to use.

Definition at line 153 of file GlWindowWin32.h.

Referenced by configWindow.

PIXELFORMATDESCRIPTOR* vrj::GlWindowWin32::mMatch
 

Points the the found pixel format.

Definition at line 155 of file GlWindowWin32.h.

Referenced by setPixelFormat.


The documentation for this class was generated from the following files:
Generated on Sun May 2 15:11:12 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002