<commit_before>#import <Cocoa/Cocoa.h>
#import <iostream>

#import "vvcocoaglcontext.h"
#import "vvrendercontext.h"

vvCocoaGLContext::vvCocoaGLContext(vvContextOptions* options)
  : _options(options)
{
  init();
}

vvCocoaGLContext::~vvCocoaGLContext()
{
  [_autoreleasePool release];
  _autoreleasePool = 0;
}

bool vvCocoaGLContext::makeCurrent() const
{
  if (_context != NULL)
  {
    [_context makeCurrentContext];
    return true;
  }
  else
  {
    return false;
  }
}

void vvCocoaGLContext::swapBuffers() const
{
  [_context flushBuffer];
}

void vvCocoaGLContext::resize(const int w, const int h)
{
  if (_win != NULL)
  {
    NSRect rect = NSMakeRect(0.0f, 0.0f,
                             static_cast<float>(w),
                             static_cast<float>(h));
    [_win setFrame: rect display: YES];
    [_glView setFrame: rect];
    [_context update];
  }
}

void vvCocoaGLContext::init()
{std::cerr << _options->width << std::endl;
  _autoreleasePool = [[NSAutoreleasePool alloc] init];

  (void)[NSApplication sharedApplication];
  NSRect rect = NSMakeRect(0.0f, 0.0f,
                           static_cast<float>(_options->width),
                           static_cast<float>(_options->height));
  _win = [[NSWindow alloc]
    initWithContentRect:rect
    styleMask: NSTitledWindowMask
    backing: NSBackingStoreBuffered
    defer:NO];

  if (!_win)
  {
    std::cerr << "Couldn't open NSWindow" << std::endl;
  }
  [_win makeKeyAndOrderFront:nil];

  NSRect glRect = NSMakeRect(0.0f, 0.0f,
                             static_cast<float>(_options->width),
                             static_cast<float>(_options->height));

  _glView = [[NSView alloc] initWithFrame:glRect];
  [_win setContentView:_glView];
  createGLContext();
  [_context setView:_glView];<commit_msg>Remove debug output<commit_after>#import <Cocoa/Cocoa.h>
#import <iostream>

#import "vvcocoaglcontext.h"
#import "vvrendercontext.h"

vvCocoaGLContext::vvCocoaGLContext(vvContextOptions* options)
  : _options(options)
{
  init();
}

vvCocoaGLContext::~vvCocoaGLContext()
{
  [_autoreleasePool release];
  _autoreleasePool = 0;
}

bool vvCocoaGLContext::makeCurrent() const
{
  if (_context != NULL)
  {
    [_context makeCurrentContext];
    return true;
  }
  else
  {
    return false;
  }
}

void vvCocoaGLContext::swapBuffers() const
{
  [_context flushBuffer];
}

void vvCocoaGLContext::resize(const int w, const int h)
{
  if (_win != NULL)
  {
    NSRect rect = NSMakeRect(0.0f, 0.0f,
                             static_cast<float>(w),
                             static_cast<float>(h));
    [_win setFrame: rect display: YES];
    [_glView setFrame: rect];
    [_context update];
  }
}

void vvCocoaGLContext::init()
{
  _autoreleasePool = [[NSAutoreleasePool alloc] init];

  (void)[NSApplication sharedApplication];
  NSRect rect = NSMakeRect(0.0f, 0.0f,
                           static_cast<float>(_options->width),
                           static_cast<float>(_options->height));
  _win = [[NSWindow alloc]
    initWithContentRect:rect
    styleMask: NSTitledWindowMask
    backing: NSBackingStoreBuffered
    defer:NO];

  if (!_win)
  {
    std::cerr << "Couldn't open NSWindow" << std::endl;
  }
  [_win makeKeyAndOrderFront:nil];

  NSRect glRect = NSMakeRect(0.0f, 0.0f,
                             static_cast<float>(_options->width),
                             static_cast<float>(_options->height));

  _glView = [[NSView alloc] initWithFrame:glRect];
  [_win setContentView:_glView];
  createGLContext();
  [_context setView:_glView];
{'fraction_non_alphanumeric': 0.12717574396406514, 'fraction_numerical': 0.0072992700729927005, 'mean_word_length': 3.058086560364465, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6063657', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1218, 'n_words': 220}