MotionVisualizer C++ Juce Problem


#1

Hi all,

As you may know the LeapMotion SDK comes with some examples. I run the Motion Visualizer solution on VS 2012 and runs perfectly.

Now I am trying to build it again but by creating a juce project and starting from scratch. The problem I have is in the following line (around 300):

Graphics g(glRenderer);

The error is the following:

c:\users\myuser\documents\juce\first\source\main.cpp(301): error C2664: 'juce::Graphics::Graphics(const juce::Image &)' : cannot convert parameter 1 from 'juce::ScopedPointer<ObjectType>' to 'const juce::Image &' 

1> with

1> [

1> ObjectType=juce::LowLevelGraphicsContext

1> ]

1> Reason: cannot convert from 'juce::ScopedPointer<ObjectType>' to 'const juce::Image' 

1> with 

1> [

1> ObjectType=juce::LowLevelGraphicsContext

1> ]

1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

 

I checked the:

ScopedPointerglRenderer (createOpenGLGraphicsContext (m_openGLContext, getWidth(), getHeight()));

line and I cannot find any mistakes.

I would like to mention that you can create Juce projects on VS2010, obviously VS2012 asks you to update the solution. I dont know if this is the problem or what. Could anyone please guide me or give me some insight?

Thank you


#2

You didn't say what glRenderer actually is, but the error message seems to say it's a scoped pointer, so you may need to dereference it, e.g. Graphics g (*glRenderer). If you look at the Graphics constructor, you'll see that it takes a reference, not a pointer.


#3

As I said, this is an example that runs perfectly with the solution that comes with the LeapMotion SDK. The only thing I did is create a Juce project and edit the main file and copy the same code. I find it weird that it runs from the sdk and not from my juceproject.

I am trying to render an openGL window where I can control the movement with the leapmotion. 

I am attaching the code. Thank you


#4

Well, presumably something was changed since they wrote that. I already told you how to fix it in my previous post, I don't have time to look at your code, I'm afraid.