Dear list,
I don’t manage to use a single texture on two separate windows.
I have been reading various threads on this forum and tried various solutions (including threaded buffers (concurrentcircularbuffers)).
I tried to use gl::Context::getCurrent() and context->makeCurrent(); functions without any success on a Linux box (ubuntu 17.10).
Below a very simple example to start with.
The image is only shown on the second window which i understand as being the latest opengl context before the texture is loaded on the GPU.
Any advices most welcome !
thanks by advance,
Vincent
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class TestApp : public App {
public:
WindowRef win1, win2;
gl::TextureRef mtex;
ImageSourceRef img;
void setup(){
win1 = getWindow();
win1->getSignalDraw().connect( std::bind( &TestApp::draw1, this ) );
win2 = createWindow();
win2->getSignalDraw().connect( std::bind( &TestApp::draw2, this ) );
img = loadImage( loadResource ("e08.tga")) ;
mtex = gl::Texture2d::create(img);
}
void draw1() {
gl::clear( Color(0,0,0));
if( mtex ) gl::draw(mtex);
}
void draw2() {
gl::clear( Color(0,0,0));
if (mtex) gl::draw(mtex);
}
};
CINDER_APP(TestApp, RendererGl())