Right - so turn on exception catching in developer studio and find out where the exception’s actually getting thrown. If you’re running the demo app, then you probably just need to rebuild everything completely.
First I tried to recompile Juce after modifying the juce_config.h file for opengl support and then recompiled the JuceDemo but that didn’t solve my problem. I then hadVisual Studio tell me where the exception is thrown and it revealed that it was thrown in the juce_openglcomponent.cpp at:
[i]void initialise()
{
jassert (context == 0);
if (context == 0)
context = juce_createOpenGLContext (owner, sharedContext->context); <---- exception thrown here!
}[/i]
Does this provide any useful information?
Thomas
and the exception said what?
[i] context 0x00000000 void *
-
owner 0x031a1c50 {rotation=0.00000000 delta=1.0000000 image=0x03199198 } juce::OpenGLComponent * -
sharedContext 0x00000000 {owner=??? lastTopLevelComp=??? reentrant=??? ...} juce::InternalGLContextHolder * -
this 0x00e6efd8 {owner=0x031a1c50 lastTopLevelComp=0x031925b0 reentrant=true ...} juce::InternalGLContextHolder * const
[/i]
quiting the running demo makes Visual C++ Express 2005 yield:
‘jucedemo.exe’: Loaded ‘C:\Documents and Settings\str_tks\Desktop\Juce\jucedemo\build\win32_vcexpress\Debug\jucedemo.exe’, Symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\ntdll.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\kernel32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\msvfw32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\user32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\gdi32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\winmm.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\advapi32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\rpcrt4.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\shell32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\msvcrt.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\shlwapi.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\comctl32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\dsound.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\ole32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\version.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\wininet.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\crypt32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\msasn1.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\oleaut32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\opengl32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\glu32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\ddraw.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\dciman32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\comdlg32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\imm32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\lpk.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\usp10.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\Digi32.dll’, No symbols loaded.
‘jucedemo.exe’: Unloaded ‘C:\WINDOWS\system32\Digi32.dll’
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\ctwdm32.dll’, No symbols loaded.
‘jucedemo.exe’: Unloaded ‘C:\WINDOWS\system32\ctwdm32.dll’
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\uxtheme.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\Program Files\ExaWare\WindowTool\WindowTool.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\msctf.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\msctfime.ime’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\setupapi.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\apphelp.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\clbcatq.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\comres.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\cscui.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\cscdll.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\mscms.dll’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\winspool.drv’, No symbols loaded.
‘jucedemo.exe’: Loaded ‘C:\WINDOWS\system32\icm32.dll’, No symbols loaded.
First-chance exception at 0x005ce52c in jucedemo.exe: 0xC0000005: Access violation reading location 0x00000010.
jucedemo.exe has triggered a breakpoint
The thread ‘Win32 Thread’ (0x8f6c) has exited with code 0 (0x0).
The program ‘[37136] jucedemo.exe: Native’ has exited with code 0 (0x0).
is that sufficient?
Thomas
i just had a go compiling the demo - i get the same exception… sharedContext is NULL in the initialise() method of InternalGLContextHolder. I’m looking it now , but need to go out soon, so may be a while before i get back to you!
Btw, i’m pretty sure i didn’t get this error when I used the OpenGLComponent in one of my own projects.
[quote=“daniel78”]
Btw, i’m pretty sure i didn’t get this error when I used the OpenGLComponent in one of my own projects.[/quote]
Just revisted my old opengl project, and that now has the same crash 8)
ok, there seems to be a bug if you don’t use the OpenGLComponent constructor that takes OpenGLComponent* share as its only argument.
I’m assuming sharing contexts isn’t a necesity, so i changed the following function in juce_OpenGLComponent.cpp (Around about line 110)
void initialise()
{
if (context == 0)
{
if( sharedContext != 0 )
{
context = juce_createOpenGLContext (owner, sharedContext->context);
}
else
{
context = juce_createOpenGLContext (owner, NULL);
}
}
}
this seems to work. I’m not sure if Jules has a more appropriate fix…
[quote=“daniel78”]ok, there seems to be a bug if you don’t use the OpenGLComponent constructor that takes OpenGLComponent* share as its only argument.
I’m assuming sharing contexts isn’t a necesity, so i changed the following function in juce_OpenGLComponent.cpp (Around about line 110)
void initialise()
{
if (context == 0)
{
if( sharedContext != 0 )
{
context = juce_createOpenGLContext (owner, sharedContext->context);
}
else
{
context = juce_createOpenGLContext (owner, NULL);
}
}
}
this seems to work. I’m not sure if Jules has a more appropriate fix…[/quote]
Hi Daniel,
Thanks for your kind help!
Thomas
Hi,
Hope you still have a little patience left for me 
I have tried to make an opengl canvas in the juceplugin window. I made an cpp file named OpenGL.cpp which had the exact same code as the OpenGLDemo.cpp in the JuceDemo project. Then I tried to call it using createOpenGLDemo(); as I saw it done in the JuceDemo project. Before that seemed to work I had to include the OpenGl.cpp in order to let the compiler know in which file the method exists; this is not done in the JuceDemo project so I can’t figure out how it works there (how does the compiler know where to look for the method when file has not been included)?
When I compile the project now I get the following errors
c:\program files\microsoft platform sdk\include\winnt.h(894) : error C2988: unrecognizable template declaration/definition
c:\program files\microsoft platform sdk\include\winnt.h(894) : error C2059: syntax error : '('
c:\program files\microsoft platform sdk\include\winnt.h(894) : error C2090: function returns array
c:\program files\microsoft platform sdk\include\winnt.h(894) : error C2988: unrecognizable template declaration/definition
c:\program files\microsoft platform sdk\include\winnt.h(894) : error C2059: syntax error : ')'
c:\program files\microsoft platform sdk\include\winnt.h(1454) : error C2143: syntax error : missing ‘;’ before ‘*’
…which I have been dealing with before. With some guys help in this forum I found how out to handle it but in this context the solution doesn’t work so I need some advice here?
thanks
Thomas
I pasted some of my code in if I didn’t make myself clear in the above!
DemoEditorComponent.cpp
//============================================
DemoEditorComponent::DemoEditorComponent (DemoJuceFilter* const ownerFilter)
: AudioFilterEditor (ownerFilter)
{
static ShinyLookAndFeel* shinyLook = 0;
.
.
.
// Add a OpenGl canvas
createOpenGLDemo();
}
OpenGL.cpp[i]/*
// #include <GL/glx.h>
// This code I tried to insert cause that helped when problem occured earlier!
//#include <windows.h>
//#include “…/…/juce_AudioFilterBase.h”
//======================================
class DemoOpenGLCanvas : public OpenGLComponent,
public Timer
{
Code equivalent to code in the Juce project…[/i]
[quote=“daniel78”]ok, there seems to be a bug if you don’t use the OpenGLComponent constructor that takes OpenGLComponent* share as its only argument.
I’m assuming sharing contexts isn’t a necesity, so i changed the following function in juce_OpenGLComponent.cpp (Around about line 110)
void initialise()
{
if (context == 0)
{
if( sharedContext != 0 )
{
context = juce_createOpenGLContext (owner, sharedContext->context);
}
else
{
context = juce_createOpenGLContext (owner, NULL);
}
}
}
this seems to work. I’m not sure if Jules has a more appropriate fix…[/quote]
You’re quite right - sorry, that was a really stupid bug…
[quote=“stoltzo”]Hi,
Hope you still have a little patience left for me ![]()
I have tried to make an opengl canvas in the juceplugin window. I made an cpp file named OpenGL.cpp which had the exact same code as the OpenGLDemo.cpp in the JuceDemo project. Then I tried to call it using createOpenGLDemo(); as I saw it done in the JuceDemo project. Before that seemed to work I had to include the OpenGl.cpp in order to let the compiler know in which file the method exists; this is not done in the JuceDemo project so I can’t figure out how it works there (how does the compiler know where to look for the method when file has not been included)?
When I compile the project now I get the following errors
c:\program files\microsoft platform sdk\include\winnt.h(894) : error C2988: unrecognizable template declaration/definition
c:\program files\microsoft platform sdk\include\winnt.h(894) : error C2059: syntax error : ‘(’
c:\program files\microsoft platform sdk\include\winnt.h(894) : error C2090: function returns array
c:\program files\microsoft platform sdk\include\winnt.h(894) : error C2988: unrecognizable template declaration/definition
c:\program files\microsoft platform sdk\include\winnt.h(894) : error C2059: syntax error : ‘)’
c:\program files\microsoft platform sdk\include\winnt.h(1454) : error C2143: syntax error : missing ‘;’ before ‘*’
..which I have been dealing with before. With some guys help in this forum I found how out to handle it but in this context the solution doesn’t work so I need some advice here?
thanks
Thomas
I pasted some of my code in if I didn’t make myself clear in the above!
DemoEditorComponent.cpp
//============================================
DemoEditorComponent::DemoEditorComponent (DemoJuceFilter* const ownerFilter)
: AudioFilterEditor (ownerFilter)
{
static ShinyLookAndFeel* shinyLook = 0;
.
.
.
// Add a OpenGl canvas
createOpenGLDemo();
}
OpenGL.cpp[i]/*
// #include <GL/glx.h>
// This code I tried to insert cause that helped when problem occured earlier!
//#include <windows.h>
//#include “../../juce_AudioFilterBase.h”
//======================================
class DemoOpenGLCanvas : public OpenGLComponent,
public Timer
{
Code equivalent to code in the Juce project…[/i][/quote]
You should never include a cpp file.. In the demo you’ll notice I just declare the createXXXDemo() functions at the top of the file that uses them.
The errors you’re getting are just the old juce.h-included-before-windows.h problem, aren’t they?
[quote=“jules”][quote=“stoltzo”]
You should never include a cpp file… In the demo you’ll notice I just declare the createXXXDemo() functions at the top of the file that uses them.[/quote]
Ok, I’ve realized that including cpp-files is not such good practice. I was surprised though that the compiler knows where to look - as you do in the JuceDemo - without including a h-file associated with the createOpenGLDemo() class. I guess that including the Component* createOpenGLDemo(); in the jucedemo_header.h file is enough for the compiler to know where to look for the method. Can you please confirm that this is enough?
Yes the errors that I see seems to be similar to that problem. I’m just not lucky when inserting the:
[i]
//#include <windows.h>
//#include “…/…/juce_AudioFilterBase.h”
which worked earlier!
I know that some of my question goes beyond Juce framework so feel free
to let me know if I should ask some of these questions elsewhere!
Thomas
I can now compile without errors.
It seems that nothing happens in the Plugin window though. I imported the OpenGLDemo file from the juce demo and call it in the constructor of the editor class in order to add this component. I have used outputdebugstring in order to test that the timerCallback() method is called - and that seems to be the case that it is running in the background.
I guess I just need to ensure that the opengl demo (rotating cube) is drawn on top of the other childrens. Is this true?
Thanks
Thomas
It’s probably something simple like the component not having been made visible, or not being given the right size/position.
…
