Parent Directory
|
Revision Log
Revision 1157 - (view) (download) (as text)
| 1 : | eile | 1044 | |
| 2 : | /* Copyright (c) 2007, Stefan Eilemann <[email protected]> | ||
| 3 : | All rights reserved. */ | ||
| 4 : | |||
| 5 : | #include "window.h" | ||
| 6 : | #include "pipe.h" | ||
| 7 : | |||
| 8 : | eile | 1147 | using namespace std; |
| 9 : | |||
| 10 : | eile | 1044 | namespace eqPly |
| 11 : | { | ||
| 12 : | |||
| 13 : | bool Window::configInit( const uint32_t initID ) | ||
| 14 : | { | ||
| 15 : | if( !eq::Window::configInit( initID )) | ||
| 16 : | return false; | ||
| 17 : | |||
| 18 : | eq::Pipe* pipe = getPipe(); | ||
| 19 : | Window* firstWindow = static_cast< Window* >( pipe->getWindow( 0 )); | ||
| 20 : | |||
| 21 : | eile | 1134 | EQASSERT( !_objects ); |
| 22 : | |||
| 23 : | if( firstWindow == this ) | ||
| 24 : | { | ||
| 25 : | eile | 1044 | _objects = new ObjectManager; |
| 26 : | eile | 1134 | _loadLogo(); |
| 27 : | } | ||
| 28 : | else | ||
| 29 : | { | ||
| 30 : | _objects = firstWindow->_objects; | ||
| 31 : | _logoTexture = firstWindow->_logoTexture; | ||
| 32 : | _logoSize = firstWindow->_logoSize; | ||
| 33 : | } | ||
| 34 : | eile | 1044 | |
| 35 : | eile | 1134 | EQASSERT( _objects ); |
| 36 : | |||
| 37 : | eile | 1044 | return true; |
| 38 : | } | ||
| 39 : | eile | 1134 | |
| 40 : | eile | 1044 | bool Window::configExit() |
| 41 : | { | ||
| 42 : | if( _objects.isValid() && _objects->getRefCount() == 1 ) | ||
| 43 : | _objects->deleteAll(); | ||
| 44 : | |||
| 45 : | _objects = 0; | ||
| 46 : | return eq::Window::configExit(); | ||
| 47 : | } | ||
| 48 : | eile | 1134 | |
| 49 : | eile | 1147 | static const char* _logoTextureName = "eqPly_logo"; |
| 50 : | |||
| 51 : | eile | 1134 | void Window::_loadLogo() |
| 52 : | { | ||
| 53 : | eile | 1147 | EQASSERT( !_objects->getTexture( _logoTextureName )); |
| 54 : | eile | 1134 | |
| 55 : | eq::Image image; | ||
| 56 : | if( !image.readImage( "logo.rgb", eq::Frame::BUFFER_COLOR ) && | ||
| 57 : | !image.readImage( "examples/eqPly/logo.rgb", eq::Frame::BUFFER_COLOR )) | ||
| 58 : | { | ||
| 59 : | EQWARN << "Can't load overlay logo 'logo.rgb'" << endl; | ||
| 60 : | return; | ||
| 61 : | } | ||
| 62 : | |||
| 63 : | eile | 1147 | _logoTexture = _objects->newTexture( _logoTextureName ); |
| 64 : | eile | 1134 | EQASSERT( _logoTexture ); |
| 65 : | |||
| 66 : | const eq::PixelViewport& pvp = image.getPixelViewport(); | ||
| 67 : | _logoSize.x = pvp.w; | ||
| 68 : | _logoSize.y = pvp.h; | ||
| 69 : | |||
| 70 : | eile | 1157 | glBindTexture( GL_TEXTURE_RECTANGLE_ARB, _logoTexture ); |
| 71 : | glTexImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, | ||
| 72 : | eile | 1134 | image.getFormat( eq::Frame::BUFFER_COLOR ), |
| 73 : | _logoSize.x, _logoSize.y, 0, | ||
| 74 : | image.getFormat( eq::Frame::BUFFER_COLOR ), | ||
| 75 : | image.getType( eq::Frame::BUFFER_COLOR ), | ||
| 76 : | image.getPixelData( eq::Frame::BUFFER_COLOR )); | ||
| 77 : | |||
| 78 : | EQINFO << "Created logo texture of size " << _logoSize << endl; | ||
| 79 : | eile | 1044 | } |
| 80 : | eile | 1134 | |
| 81 : | } |
| Back to Equalizer website | ViewVC Help |
| Powered by ViewVC 1.0.3 |