Graphics context rendered in hardware or software?


This is a fairly general question, as I am quite new to Juce. Is the normal graphics context hardware accelerated or software based? (

I realize there is an OpenGLGraphics context as well, I guess the core of my question is this: 

Is there a hardware accelerated way to draw 2D graphics using convienience methods (like drawLine(), etc in the normal graphics context) AND add post processing shader effects? Or would this all need to be done in raw OpenGL? 



If you turn on the OpenGl context, also the 2D drawing routines are done in OpenGl => huge performance gain.

So I recommend you doing that. And as far as I know there is nothing hindering you from mixing 2D and 3D. So shaders should be OK (not used them myself though).

Maybe you can describe more in detail, what you had in mind with the shader, so someone more knowledgeable can answer.




By "turn on the OpenGL context" do you mean subclassing the component from the OpenGLContext class?


No, I meant: In your main DocumentWindow class create a member variable for the OpgenGlContext. I.e.

class MainAppWindow   : public DocumentWindow


    /** OpenGL context. This is used in order to speed up 2D-drawing. I.e. also
        the GUI elements benefit from it.*/
    OpenGLContext openGLContext;    

The in the constructor simply attach the main window to the context:

    //attach OpenGl context to main window


And that's it. Your application is using OpenGl rendering.


Awesome, thanks!


Thanks, that's exactly the answer I was looking for as far as the 2D drawing routines go. 

As for the shader question, I'd like to be able to do a post-processing effect on the whole screen. This usually involves rendering the scene to a frame buffer object rather than the screen, then running that texture through a shader, then rendering it to the screen. I'm no OpenGL expert, but I'm pretty sure this resembles how I did it last time I was doing this sort of thing. So I suppose ideally you would be able to render the 2D routines straight to an FBO. It would be great if anyone had an example of this sort of thing in Juce!


You should have a look in demo applications provided with JUCE (JUCE Demo and OpenGLAppExample), you will find examples of all the stuff you need