From c236e75cf55d736f2ce6a4e4864c6f5a2023eb52 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 21 Mar 2017 16:07:31 +0000 Subject: [PATCH] Adde some missing JUCE_API annotations --- .../components/juce_ModalComponentManager.h | 2 +- .../opengl/juce_OpenGLShaderProgram.cpp | 3 +-- .../opengl/juce_OpenGLShaderProgram.h | 11 +++++++---- .../utils/juce_OpenGLAppComponent.cpp | 2 +- .../juce_opengl/utils/juce_OpenGLAppComponent.h | 16 +++++++++++----- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/modules/juce_gui_basics/components/juce_ModalComponentManager.h b/modules/juce_gui_basics/components/juce_ModalComponentManager.h index b06018760b..79508b4319 100644 --- a/modules/juce_gui_basics/components/juce_ModalComponentManager.h +++ b/modules/juce_gui_basics/components/juce_ModalComponentManager.h @@ -49,7 +49,7 @@ public: For some quick ways of creating callback objects, see the ModalCallbackFunction class. @see ModalCallbackFunction */ - class Callback + class JUCE_API Callback { public: /** */ diff --git a/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.cpp b/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.cpp index fc4950681e..45a097dd7f 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.cpp @@ -22,8 +22,7 @@ ============================================================================== */ -OpenGLShaderProgram::OpenGLShaderProgram (const OpenGLContext& c) noexcept - : context (c), programID (0) +OpenGLShaderProgram::OpenGLShaderProgram (const OpenGLContext& c) noexcept : context (c) { } diff --git a/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.h b/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.h index 7f6bb71a5a..030a39defc 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.h +++ b/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.h @@ -31,7 +31,10 @@ class JUCE_API OpenGLShaderProgram { public: + /** Creates a shader for use in a particular GL context. */ OpenGLShaderProgram (const OpenGLContext&) noexcept; + + /** Destructor. */ ~OpenGLShaderProgram() noexcept; /** Returns the version of GLSL that the current context supports. @@ -124,7 +127,7 @@ public: Be careful not to call the set() functions unless the appropriate program is loaded into the current context. */ - struct Uniform + struct JUCE_API Uniform { /** Initialises a uniform. The program must have been successfully linked when this @@ -169,13 +172,13 @@ public: After a program has been linked, you can create Attribute objects to let you set the attributes that your vertex shaders use. */ - struct Attribute + struct JUCE_API Attribute { /** Initialises an attribute. The program must have been successfully linked when this constructor is called. */ - Attribute (const OpenGLShaderProgram& program, const char* attributeName); + Attribute (const OpenGLShaderProgram&, const char* attributeName); /** The attribute's ID number. If the uniform couldn't be found, this value will be < 0. @@ -188,7 +191,7 @@ public: private: const OpenGLContext& context; - mutable GLuint programID; + mutable GLuint programID = 0; String errorLog; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenGLShaderProgram) diff --git a/modules/juce_opengl/utils/juce_OpenGLAppComponent.cpp b/modules/juce_opengl/utils/juce_OpenGLAppComponent.cpp index 81739ecfed..66325402ad 100644 --- a/modules/juce_opengl/utils/juce_OpenGLAppComponent.cpp +++ b/modules/juce_opengl/utils/juce_OpenGLAppComponent.cpp @@ -22,7 +22,7 @@ ============================================================================== */ -OpenGLAppComponent::OpenGLAppComponent() : frameCounter (0) +OpenGLAppComponent::OpenGLAppComponent() { setOpaque (true); openGLContext.setRenderer (this); diff --git a/modules/juce_opengl/utils/juce_OpenGLAppComponent.h b/modules/juce_opengl/utils/juce_OpenGLAppComponent.h index df6e47e8db..fa2e7fc7c5 100644 --- a/modules/juce_opengl/utils/juce_OpenGLAppComponent.h +++ b/modules/juce_opengl/utils/juce_OpenGLAppComponent.h @@ -33,11 +33,13 @@ paint() and mouse-handling. The base class provides some simple abstractions to take care of continuously repainting itself. */ -class OpenGLAppComponent : public Component, - private OpenGLRenderer +class JUCE_API OpenGLAppComponent : public Component, + private OpenGLRenderer { public: OpenGLAppComponent(); + + /** Destructor. */ ~OpenGLAppComponent(); /** Returns the number of times that the render method has been called since @@ -45,6 +47,9 @@ public: */ int getFrameCounter() const noexcept { return frameCounter; } + /** This must be called from your subclass's destructor, to shut down + the GL system and stop it calling render() before your class is destroyed. + */ void shutdownOpenGL(); /** Implement this method to set up any GL objects that you need for rendering. @@ -57,16 +62,17 @@ public: */ virtual void shutdown() = 0; - /** + /** Called to render your openGL. + @see OpenGLRenderer::render() */ virtual void render() = 0; + /** The GL context */ OpenGLContext openGLContext; private: //============================================================================== - - int frameCounter; + int frameCounter = 0; void newOpenGLContextCreated() override; void renderOpenGL() override;