GlyphArrangement problem in OpenGL Thread


Hi Jules, hi community,

I have a weird behaviour in newOpenGLContextCreated() callback.

I’m trying to fill textures based in glyphs generated by GlyphArrangement object within this newOpenGLContextCreated() callback. This is the code:

[code]GLvoid OpenGLComponent::newOpenGLContextCreated(GLvoid) // Build Our Bitmap Font
OpenGLTexture texture[NUM_GLIPHS];
base = glGenLists(NUM_GLIPHS); // Storage For 96 Characters

Font f;

GlyphArrangement arr;
for (unsigned char i = 32; i < 32 + NUM_GLIPHS; ++i)
	arr.addLineOfText(f, String((char*)&i, 1), 0.0f, 0.0f );
	float w = arr.getBoundingBox (0, -1, true).getWidth(),
		  h = arr.getBoundingBox (0, -1, true).getHeight();
	int   w1 = nextPowerOfTwo((int)w), h1 = nextPowerOfTwo((int)h);
	Image image(Image::ARGB, w1, h1, true );
	Graphics g (image);
	g.setOrigin(0, (int)h1);
	arr.draw (g);

	glNewList(base + i - 32, GL_COMPILE);		
	texture[i-32].draw2D( 0.0f    , 0.0f,
					0.0f + w1, 0.0f,
					0.0f + w1, 0.0f + h1,
					0.0f    , 0.0f + h1,
					Colours::darksalmon );


That i iteration almost never ends, hanging it in the arr.draw(g) call.
The Stack shows the following:
[list][color=#0000BF] 77810da8 Desconocido
[Los marcos siguientes pueden no ser correctos o faltar, no se han cargado símbolos para ntdll.dll]
751e1129 Desconocido
751e10b4 Desconocido
juce::WaitableEvent::wait C++

juce::ReadWriteLock::enterWrite C++
juce::ScopedWriteLock::ScopedWriteLock C++
juce::RenderingHelpers::GlyphCache<juce::RenderingHelpers::CachedGlyphEdgeTablejuce::RenderingHelpers::SoftwareRendererSavedState,juce::RenderingHelpers::SoftwareRendererSavedState>::drawGlyph C++
juce::LowLevelGraphicsSoftwareRenderer::drawGlyph C++
juce::drawGlyphWithFont C++
juce::PositionedGlyph::draw C++
juce::GlyphArrangement::draw C++
OpenGLComponent::BuildFont C++
OpenGLComponent::newOpenGLContextCreated C++
juce::OpenGLContext::CachedImage::initialiseOnThread C++
juce::OpenGLContext::CachedImage::run C++
juce::Thread::threadEntryPoint C++
juce::juce_threadEntryPoint C++
juce::threadEntryProc C++
_callthreadstartex C
_threadstartex C
75738543 Desconocido
7782ac69 Desconocido
7782ac3c Desconocido[/color][/list]

Is there any incompatibility? Shouldn’t I draw in a Graphics context by GlyphArrangement within the OpenGL Thread?

Thank you,