31 #include "asyncFetcher.h"
35 #include <eq/client/system.h>
41 AsyncFetcher::AsyncFetcher()
47 AsyncFetcher::~AsyncFetcher()
52 const GLEWContext* AsyncFetcher::glewGetContext()
const
54 return _sharedWindow->glewGetContext();
63 const int32_t drawable =
79 LBWARN <<
"OS Window initialization failed: " << std::endl;
86 LBERROR <<
"Failed to create shared context window for "
93 LBINFO <<
"Async fetcher initialization finished" << std::endl;
97 void AsyncFetcher::setup( Window* window )
99 _sharedWindow = initSharedContextWindow( window );
103 void AsyncFetcher::stop()
111 _sharedWindow->configExit();
112 delete _sharedWindow;
120 void AsyncFetcher::run()
122 LBASSERT( _sharedWindow );
126 _sharedWindow->makeCurrent();
128 lunchbox::Bufferb textureData( 64*64*4 );
129 LBINFO <<
"async fetcher initialized" << std::endl;
132 lunchbox::sleep( 1000 );
133 for( uint8_t* i = 0; running; ++i )
137 tx->
init( GL_RGBA8, 64, 64 );
141 for(
int y = 0; y < 64; ++y )
143 for(
int x = 0; x < 64; ++x )
145 const GLbyte rnd = rng.get< uint8_t >() % 127;
146 const GLbyte val = (x / 8) % 2 == (y / 8) % 2 ? rnd : 0;
147 textureData[ j++ ] = val;
148 textureData[ j++ ] = val;
149 textureData[ j++ ] = val;
150 textureData[ j++ ] = val;
153 tx->
upload( 64, 64, textureData.getData( ));
154 EQ_GL_CALL( glFinish( ));
160 lunchbox::sleep( rng.get< uint32_t >() % 5000u );
163 const void* keyToDelete = 0;
164 while( _inQueue.tryPop( keyToDelete ))
168 LBWARN <<
"Deleting eq texture " << keyToDelete << std::endl;
169 objects.deleteEqTexture( keyToDelete );
void upload(const int32_t width, const int32_t height, const void *ptr)
Copy the specified buffer to the texture at 0,0.
virtual void makeCurrent(const bool cache=true) const =0
Make the system window rendering context and drawable current.
A Window represents an on-screen or off-screen drawable.
const P * getPipe() const
A facility class to manage OpenGL objects across shared contexts.
A Pipe represents a graphics card (GPU) on a Node.
void deleteAll()
Delete all managed objects and associated GL objects.
Structure to associate OpenGL texture ids with an external key.
The interface definition for system-specific windowing code.
virtual void makeCurrent(const bool cache=true) const
Make the window's drawable and context current.
void setIAttribute(const IAttribute attr, const int32_t value)
Set a window attribute.
A wrapper around OpenGL textures.
int32_t getIAttribute(const IAttribute attr) const
Window, pbuffer, FBO or OFF.
WindowSystem getWindowSystem() const
Return the window system used by this pipe.
util::ObjectManager< const void * > ObjectManager
The OpenGL object manager used in the client library.
virtual bool configInit()=0
Initialize this system window.
void init(const unsigned internalFormat, const int32_t width, const int32_t height)
Initialize an OpenGL texture.