Hello,
I am trying to get started with JUCE and OpenGL, however I run into some problems. I can't get an OpenGLTexture object initialized at program initialization, since there is no active context at that time. The docs say that the context should not be made active by the user, however I want to allocate my resources before the first call to render. If there's lots of memory to be allocated or transferred to GPU, that's not something you want to do inside the first actual render call. This will make things very sluggish when working with several dynamic Components using GL rendering, which is a requirement here. I need to be able to allocate my GPU-side resources as soon as I know I'll need them.
Calling makeActive() myself just before initializing the texture with loadARGB does not work, it still fails with OpenGLContext::getCurrentContext() != nullptr assertion in juce_OpenGLTexture.cpp:53. What is the intended way to go about this? Is there some high-level documentation on the OpenGL abstraction in JUCE? Anyways here's my relevant code:
// initialize glContext as class-member of Main, default constructor // set up glContext.setComponentPaintingEnabled(false); glContext.setContinuousRepainting(true); glContext.setPixelFormat(OpenGLPixelFormat()); glContext.attachTo(*this); glContext.setRenderer(&analysisRenderer); glContext.makeActive(); // use pTexture = new OpenGLTexture; PixelARGB aPixel[1]; aPixel[0].setARGB(255, 255, 255, 255); pTexture->loadARGB(aPixel, 1, 1);
I know that you are aware of the fact that the OpenGL implementation right now has conceptional problems which will be resolved (hopefully!) very soon after JUCE4 appears. However I need to get going on this project and need stuff to work as of now. Since you said the new OpenGL abstraction is already more or less finished and used by ROLI, is there a git branch where I could already make use of the changed interfaces? Might even be helpful for you, since I've been in the graphics domain for quite some years I might provide feedback as a pre-release tester in case you are interested. I could imagine that helps smoothing things out before the actual release.
Thanks for your support!