- use expectations

- improved gibbs sampling
- LayerArray is template class

git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@18 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2014-10-06 17:08:50 +00:00
parent f62f1283f8
commit fc758b853a
122 changed files with 1053 additions and 1149 deletions
@@ -118,7 +118,7 @@ public:
bool createdOk() const noexcept { return getRawContext() != nullptr; }
void* getRawContext() const noexcept { return context; }
GLuint getFrameBufferID() const noexcept { return useMSAA ? msaaBufferHandle : frameBufferHandle; }
GLuint getFrameBufferID() const noexcept { return frameBufferHandle; }
bool makeActive() const noexcept
{
@@ -142,18 +142,6 @@ public:
void swapBuffers()
{
if (useMSAA)
{
glBindFramebuffer (GL_DRAW_FRAMEBUFFER, frameBufferHandle);
glBindFramebuffer (GL_READ_FRAMEBUFFER, msaaBufferHandle);
#if defined (__IPHONE_7_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0
glBlitFramebuffer (0, 0, lastWidth, lastHeight, 0, 0, lastWidth, lastHeight, GL_COLOR_BUFFER_BIT, GL_NEAREST);
#else
glResolveMultisampleFramebufferAPPLE();
#endif
}
glBindRenderbuffer (GL_RENDERBUFFER, colorBufferHandle);
[context presentRenderbuffer: GL_RENDERBUFFER];
@@ -201,7 +189,7 @@ private:
int swapFrames;
bool useDepthBuffer, useMSAA;
bool createContext (EAGLRenderingAPI type, void* contextToShare)
bool createContext (NSUInteger type, void* contextToShare)
{
jassert (context == nil);
context = [EAGLContext alloc];
@@ -245,7 +233,7 @@ private:
glBindFramebuffer (GL_FRAMEBUFFER, msaaBufferHandle);
glBindRenderbuffer (GL_RENDERBUFFER, msaaColorHandle);
glRenderbufferStorageMultisample (GL_RENDERBUFFER, 4, GL_RGBA8, width, height);
glRenderbufferStorageMultisampleAPPLE (GL_RENDERBUFFER, 4, GL_RGBA8_OES, width, height);
glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, msaaColorHandle);
}
@@ -256,7 +244,7 @@ private:
glBindRenderbuffer (GL_RENDERBUFFER, depthBufferHandle);
if (useMSAA)
glRenderbufferStorageMultisample (GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT16, width, height);
glRenderbufferStorageMultisampleAPPLE (GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT16, width, height);
else
glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
@@ -22,7 +22,7 @@
==============================================================================
*/
extern ComponentPeer* createNonRepaintingEmbeddedWindowsPeer (Component&, void* parent);
extern ComponentPeer* createNonRepaintingEmbeddedWindowsPeer (Component*, void* parent);
//==============================================================================
class OpenGLContext::NativeContext
@@ -33,9 +33,7 @@ public:
void* contextToShareWith,
bool /*useMultisampling*/,
OpenGLVersion)
: context (nullptr)
{
dummyComponent = new DummyComponent (*this);
createNativeWindow (component);
PIXELFORMATDESCRIPTOR pfd;
@@ -84,8 +82,8 @@ public:
releaseDC();
}
void initialiseOnRenderThread (OpenGLContext& c) { context = &c; }
void shutdownOnRenderThread() { deactivateCurrentContext(); context = nullptr; }
void initialiseOnRenderThread (OpenGLContext&) {}
void shutdownOnRenderThread() { deactivateCurrentContext(); }
static void deactivateCurrentContext() { wglMakeCurrent (0, 0); }
bool makeActive() const noexcept { return isActive() || wglMakeCurrent (dc, renderContext) != FALSE; }
@@ -116,30 +114,13 @@ public:
void* getRawContext() const noexcept { return renderContext; }
unsigned int getFrameBufferID() const noexcept { return 0; }
void triggerRepaint()
{
if (context != nullptr)
context->triggerRepaint();
}
struct Locker { Locker (NativeContext&) {} };
private:
struct DummyComponent : public Component
{
DummyComponent (NativeContext& c) : context (c) {}
// The windowing code will call this when a paint callback happens
void handleCommandMessage (int) override { context.triggerRepaint(); }
NativeContext& context;
};
ScopedPointer<DummyComponent> dummyComponent;
Component dummyComponent;
ScopedPointer<ComponentPeer> nativeWindow;
HGLRC renderContext;
HDC dc;
OpenGLContext* context;
#define JUCE_DECLARE_WGL_EXTENSION_FUNCTION(name, returnType, params) \
typedef returnType (__stdcall *type_ ## name) params; type_ ## name name;
@@ -161,7 +142,7 @@ private:
void createNativeWindow (Component& component)
{
Component* topComp = component.getTopLevelComponent();
nativeWindow = createNonRepaintingEmbeddedWindowsPeer (*dummyComponent, topComp->getWindowHandle());
nativeWindow = createNonRepaintingEmbeddedWindowsPeer (&dummyComponent, topComp->getWindowHandle());
if (ComponentPeer* peer = topComp->getPeer())
updateWindowPosition (peer->getAreaCoveredBy (component));