/*
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
 */

#import <Cocoa/Cocoa.h>
#import <OpenGL/gl.h>
#import <OpenGL/OpenGL.h>

#import "GlassView.h"
#import "GlassOffscreen.h"

// 3D version of Glass providing OpenGL context through CAOpenGLLayer
@interface GlassView3D : NSOpenGLView <GlassView>
{
    GlassViewDelegate   *_delegate;
    
    NSUInteger          _drawCounter; // draw counter, so that we only bind/unbind offscreen once
    NSUInteger          _lockCounter; // lock counter, so we only send the Java layer lock meesage once
    
    BOOL                _drawn;
    BOOL                _ready;
    
    CGLContextObj       _context;
    CGLContextObj       _contextToRestore;
    GlassOffscreen      *_offscreen;
    
    BOOL                _synced; // is the GL context VB synced?
    
    NSTrackingArea      *_trackingArea;
    
    GLuint              _texture;
    GLuint              _textureWidth;
    GLuint              _textureHeight;
    
    CGFloat             _backgroundR;
    CGFloat             _backgroundG;
    CGFloat             _backgroundB;
    CGFloat             _backgroundA;
}

- (id)initWithFrame:(NSRect)frame withJview:(jobject)jView withJproperties:(jobject)jproperties;
- (void)setFrameOrigin:(NSPoint)newOrigin;

@end
