EaglPlatformHandles.h#

Parent directory (EAGL)

Native object handles (display, window, view etc.) for the EAGL (iOS) implementation of PVRNativeApi.

Source Code#

#pragma once

#include "PVRCore/types/Types.h"
#include "PVRCore/Log.h"
#include "OpenGLES/ES2/gl.h"
#include "OpenGLES/ES2/glext.h"
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
class EAGLContext;
#endif
namespace pvr {
namespace platform {
typedef void* NativeDisplay;
typedef void* NativeWindow;

// Objective-C Type Definitions
typedef void VoidUIView;
typedef void VoidUIApplicationDelegate;

typedef VoidUIApplicationDelegate* OSApplication;
typedef void* OSDisplay;
typedef VoidUIView* OSWindow;
typedef void* OSSurface;
typedef void* OSDATA;

struct NativePlatformHandles_
{
    EAGLContext* context;
    VoidUIView* view;

    GLint numDiscardAttachments = 0;
    GLenum discardAttachments[3];
    GLuint framebuffer = 0;
    GLuint renderbuffer = 0;
    GLuint depthBuffer = 0;

    GLuint msaaFrameBuffer = 0;
    GLuint msaaColorBuffer = 0;
    GLuint msaaDepthBuffer = 0;

    NativePlatformHandles_() {}
};

struct NativeDisplayHandle_
{
    NativeDisplay nativeDisplay;
    operator NativeDisplay&() { return nativeDisplay; }
    operator const NativeDisplay&() const { return nativeDisplay; }
};
struct NativeWindowHandle_
{
    NativeWindow nativeWindow;
    operator NativeWindow&() { return nativeWindow; }
    operator const NativeWindow&() const { return nativeWindow; }
};

typedef std::shared_ptr<NativePlatformHandles_> NativePlatformHandles;

typedef std::shared_ptr<NativeDisplayHandle_> NativeDisplayHandle;

} // namespace platform
} // namespace pvr