Juce Demo OpenGL


#1

Hi Jules,

Just wanted to let you know that the current modules tip OpenGL demo do not work
on an 2007 iMac on 10.7 (NVIDIA GeForce 7300 GT 128 MB)

I got
JuceDemo[499:1207] invalid pixel format
JuceDemo[499:1207] invalid context

Let me know if you want me to test some stuff.


#2

Oh. That’s odd, it’s not doing anything very fancy. Can you see the stack trace for the point at which it’s failing?


#3

juce_mac_OpenGLComponent.mm line 149
[NSOpenGLPixelFormat alloc] initWithAttributes: attribs]

returns nil

after some test, it looks like NSOpenGLPFAAcelerated is not supported on my hardware

HTH


#4

Ok… well, I guess I could leave that flag out anyway, since I’m sure it’ll be accelerated by default where possible.


#5

Works fine now.

By the way, don’t know if this is the case for you as well but if I change the Juce Demo to using the OpenGL renderer,
I get everything a bit blurry

[attachment=0]Screen Shot 2011-12-20 at 15.04.19.png[/attachment]


#6

Weird… That must be a heck of a croaky old driver you’re using! I’m afraid I’ve really got no idea why it’d come out blurry like that, it looks like the whole thing is offset by half a pixel, but I’ve no idea where that might be happening!


#7

Well I’m on 10.7.2 so I doubt I can be more up to date regarding the driver.

Might be a difference between nvidia and ati.
What graphic card are you using ?


#8

I’ve got a Radeon HD 6750M. But it shouldn’t matter - they should all deal with coordinates correctly, I really don’t know what’d cause the blurriness.


#9

DirectX is known to offset by half pixel:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb219690(v=vs.85).aspx

That doesnt explain why it would happen on OpenGL…


#10

I’m on windows7 x64 with the latest nvidia drivers, am getting an assertion here:

OpenGLShaderProgram::Attribute::Attribute (const OpenGLShaderProgram& program, const char* name)
    : attributeID (glGetAttribLocation (program.programID, name))
{
    jassert (attributeID >= 0);
}

and a crash right after that in the nvogl32.dll (i tried catching where exactly but as far as i gone is the paintEntireComponent() call)


#11

Oh god, not another driver that just crashes… Pathetic! Got a stack trace for that assertion?


#12

I also get an assertion here:

OpenGLShaderProgram::Attribute::Attribute (const OpenGLShaderProgram& program, const char* name)
    : attributeID (glGetAttribLocation (program.programID, name))
{
    jassert (attributeID >= 0);
}

Current driver:

  • NVIDIA GeForce 285.62 WHQL (Release Date: 2011.10.24)

#13

Wow, looks like that GLSL compiler is doing an impressive job of optimising away some unused attributes. Thanks, I’ll try to figure out a workaround.


#14

I did a clean checkout today morning (i’m curious about this OpenGL stuff so that’s why i’m testing it). Anyway today is a crash but it look different. When invoking the OpenGL demo from the JuceDemo list a crash:

>	JuceDemo.exe!juce::OpenGLHelpers::drawQuad3D(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, const juce::Colour & colour)  Line 225	C++
 	JuceDemo.exe!juce::OpenGLFrameBuffer::draw3D(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, const juce::Colour & colour)  Line 365 + 0x5d bytes	C++
 	JuceDemo.exe!DemoOpenGLCanvas::renderOpenGL()  Line 121	C++
 	JuceDemo.exe!juce::OpenGLComponent::OpenGLCachedComponentImage::timerCallback()  Line 302	C++
 	JuceDemo.exe!juce::Timer::TimerThread::callTimers()  Line 132	C++
 	JuceDemo.exe!juce::Timer::TimerThread::handleMessage(const juce::Message & __formal)  Line 146	C++
 	JuceDemo.exe!juce::MessageManager::deliverMessage(juce::Message * const message)  Line 123	C++
 	JuceDemo.exe!juce::MessageManager::dispatchNextMessageOnSystemQueue(const bool returnIfNoPendingMessages)  Line 111	C++
 	JuceDemo.exe!juce::MessageManager::runDispatchLoopUntil(int millisecondsToRunFor)  Line 151 + 0x10 bytes	C++
 	JuceDemo.exe!juce::MessageManager::runDispatchLoop()  Line 132	C++
 	JuceDemo.exe!juce::JUCEApplication::main(const juce::String & commandLine)  Line 217	C++
 	JuceDemo.exe!WinMain(void * __formal, void * __formal, void * __formal, void * __formal)  Line 160 + 0x54 bytes	C++
 	JuceDemo.exe!__tmainCRTStartup()  Line 275 + 0x2c bytes	C
 	JuceDemo.exe!WinMainCRTStartup()  Line 189	C

And when attempting to switch to the OpenGL renderer a less informative stack trace:

 	ntdll.dll!76f015ee() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]	
 	ntdll.dll!76f015ee() 	
 	ntdll.dll!76ef015e() 	
 	user32.dll!762178c2() 	
>	JuceDemo.exe!_ismbblead(unsigned int tst)  Line 172 + 0xf bytes	C++

and a crash in the MS C code:

extern "C" int (__cdecl _ismbblead) (unsigned int tst)
{
        return x_ismbbtype_l(NULL,tst,0,_M1);
}

forgot to add i’m on windows7, vs2010, Intel based graphics card.


#15

Were you trying to run the GL demo with the GL renderer turned on? That’s not a good combination, and I’ve not fully checked the demo to stop it getting into situations like that yet.


#16

No no, i’m trying either the renderer or the demo. Both crash like i wrote above, i never got the renderer to run so i can’t get the demo to run with the renderer running.


#17

I’ve just checked in a fix (I hope!) for the first problem, so have another go…


#18

did a clean git pull (i always delete the whole juce dir and get the whole tree again), and nothing changed still the same two crashes in exactly same places with the same call stack


#19

Then I’m afraid I have absolutely no idea!


#20

Crashing over here as well on Windows 7 x64 running a nVidia 9400M.
Looks like some sort of issue specific to Windows and nVidia cards. That seems to be the common denominator between all of us.
Works fine under Mac OS X using exactly the same hardware.

 	kernel32.dll!7703efbb() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
 	nvoglv32.dll!048ad5ef() 	
 	nvoglv32.dll!0453b8c5() 	
>	JuceDemo.exe!juce::StateHelpers::ShaderQuadQueue::draw()  Line 1196	C++
 	JuceDemo.exe!juce::StateHelpers::ShaderQuadQueue::flush()  Line 1172	C++
 	JuceDemo.exe!juce::StateHelpers::ActiveTextures::setTexturesEnabled<juce::StateHelpers::ShaderQuadQueue>(juce::StateHelpers::ShaderQuadQueue & quadQueue={...}, const int textureIndexMask=1)  Line 925	C++
 	JuceDemo.exe!juce::StateHelpers::ActiveTextures::setSingleTextureMode<juce::StateHelpers::ShaderQuadQueue>(juce::StateHelpers::ShaderQuadQueue & quadQueue={...})  Line 955	C++
 	JuceDemo.exe!juce::OpenGLGraphicsContext::GLState::setShaderForTiledImageFill(const juce::OpenGLTextureFromImage & image={...}, const juce::AffineTransform & transform={...}, const int maskTextureID=0, const juce::Rectangle<int> * const maskArea=0x00000000, const bool clampTiledImages=true)  Line 1733	C++
 	JuceDemo.exe!juce::ClipRegion_RectangleList_Shaders::ShaderFillOperation::ShaderFillOperation(const juce::ClipRegion_RectangleList_Shaders & clip={...}, const juce::FillType & fill={...}, const bool replaceContents=false, const bool clampTiledImages=true)  Line 2802	C++
 	JuceDemo.exe!juce::ClipRegion_RectangleList_Shaders::drawImage(const juce::Image & image={...}, const juce::AffineTransform & transform={...}, float alpha=1.0000000, const juce::Rectangle<int> & clipArea={...}, juce::EdgeTable * et=0x0044c8a4)  Line 2748 + 0x14 bytes	C++
 	JuceDemo.exe!juce::OpenGLGraphicsContext::SavedState::drawImage(const juce::Image & image={...}, const juce::AffineTransform & trans={...})  Line 3121	C++
 	JuceDemo.exe!juce::OpenGLGraphicsContext::drawImage(const juce::Image & im={...}, const juce::AffineTransform & t={...})  Line 3245 + 0x26 bytes	C++
 	JuceDemo.exe!juce::Graphics::drawImageTransformed(const juce::Image & imageToDraw={...}, const juce::AffineTransform & transform={...}, const bool fillAlphaChannelWithCurrentBrush=false)  Line 722	C++
 	JuceDemo.exe!juce::Graphics::drawImage(const juce::Image & imageToDraw={...}, int dx=0, int dy=0, int dw=256, int dh=256, int sx=0, int sy=0, int sw=140, int sh=86, const bool fillAlphaChannelWithCurrentBrush=false)  Line 700 + 0xfc bytes	C++
 	JuceDemo.exe!juce::Graphics::drawImageWithin(const juce::Image & imageToDraw={...}, const int destX=0, const int destY=0, const int destW=256, const int destH=256, const juce::RectanglePlacement & placementWithinTarget={...}, const bool fillAlphaChannelWithCurrentBrush=false)  Line 684	C++
 	JuceDemo.exe!DemoOpenGLCanvas::createLogoImage()  Line 186 + 0x57 bytes	C++
 	JuceDemo.exe!DemoOpenGLCanvas::newOpenGLContextCreated()  Line 69 + 0x9 bytes	C++
 	JuceDemo.exe!juce::OpenGLComponent::updateContext()  Line 461	C++
 	JuceDemo.exe!juce::OpenGLComponent::OpenGLCachedComponentImage::paint(juce::Graphics & __formal={...})  Line 256	C++
 	JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g={...})  Line 1866	C++
 	JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g={...})  Line 1932	C++
 	JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g={...}, const bool ignoreAlphaLevel=false)  Line 1974	C++
 	JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g={...})  Line 1868	C++
 	JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g={...})  Line 1932	C++
 	JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g={...}, const bool ignoreAlphaLevel=false)  Line 1974	C++
 	JuceDemo.exe!juce::Component::paintWithinParentContext(juce::Graphics & g={...})  Line 1868	C++
 	JuceDemo.exe!juce::Component::paintComponentAndChildren(juce::Graphics & g={...})  Line 1932	C++
 	JuceDemo.exe!juce::Component::paintEntireComponent(juce::Graphics & g={...}, const bool ignoreAlphaLevel=true)  Line 1974	C++
 	JuceDemo.exe!juce::ComponentPeer::handlePaint(juce::LowLevelGraphicsContext & contextToPaintTo={...})  Line 137	C++
 	JuceDemo.exe!juce::HWNDComponentPeer::handlePaintMessage()  Line 1367	C++
 	JuceDemo.exe!juce::HWNDComponentPeer::peerWindowProc(HWND__ * h=0x0019041a, unsigned int message=15, unsigned int wParam=0, long lParam=0)  Line 2127	C++
 	JuceDemo.exe!juce::HWNDComponentPeer::windowProc(HWND__ * h=0x0019041a, unsigned int message=15, unsigned int wParam=0, long lParam=0)  Line 2079 + 0x18 bytes	C++
 	user32.dll!76a062fa() 	
 	user32.dll!76a07316() 	
 	user32.dll!76a06ce9() 	
 	user32.dll!76a06de8() 	
 	user32.dll!76a06e44() 	
 	user32.dll!76a06e44() 	
 	ntdll.dll!77bd011a() 	
 	user32.dll!76a1131c() 	
 	user32.dll!76a11332() 	
 	user32.dll!76a0790d() 	
 	user32.dll!76a0788a() 	
 	JuceDemo.exe!juce::MessageManager::dispatchNextMessageOnSystemQueue(const bool returnIfNoPendingMessages=false)  Line 136	C++
 	JuceDemo.exe!juce::MessageManager::runDispatchLoopUntil(int millisecondsToRunFor=-1)  Line 151 + 0x10 bytes	C++
 	JuceDemo.exe!juce::MessageManager::runDispatchLoop()  Line 132	C++
 	JuceDemo.exe!juce::JUCEApplication::main(const juce::String & commandLine={...})  Line 217	C++
 	JuceDemo.exe!WinMain(void * __formal=0x00d60000, void * __formal=0x00d60000, void * __formal=0x00d60000, void * __formal=0x00d60000)  Line 160 + 0x54 bytes	C++
 	JuceDemo.exe!__tmainCRTStartup()  Line 275 + 0x2c bytes	C
 	JuceDemo.exe!WinMainCRTStartup()  Line 189	C
 	kernel32.dll!7702339a() 	
 	ntdll.dll!77bf9ed2() 	
 	ntdll.dll!77bf9ea5()