Sha256: 8ac8fe854de50db63d0a945a0939cf8fb64a60ca5e03ec9e88b7611822052a78

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

// -*- objc -*-
#include "../opengl.h"


#import <AppKit/AppKit.h>
#include "rays/rays.h"
#include "rays/exception.h"


namespace Rays
{


	static NSOpenGLContext*
	get_opengl_offscreen_context ()
	{
		static NSOpenGLContext* context = nil;
		if (!context)
		{
			NSOpenGLPixelFormatAttribute attribs[] =
			{
				//NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
				//NSOpenGLPFAAccelerated, NSOpenGLPFANoRecovery,
				//NSOpenGLPFADoubleBuffer,
				NSOpenGLPFAAllowOfflineRenderers,
				NSOpenGLPFAColorSize, 32,
				NSOpenGLPFADepthSize, 32,
				//NSOpenGLPFAMultisample,
				//NSOpenGLPFASampleBuffers, 1,
				//NSOpenGLPFASamples, 4,
				0
			};
			NSOpenGLPixelFormat* pf = [[[NSOpenGLPixelFormat alloc]
				initWithAttributes: attribs] autorelease];
			context = [[NSOpenGLContext alloc] initWithFormat: pf shareContext: nil];
		}
		return context;
	}


	void
	OpenGL_init ()
	{
		activate_offscreen_context();
	}

	void
	OpenGL_fin ()
	{
	}


	Context
	get_offscreen_context ()
	{
		return get_opengl_offscreen_context();
	}

	void
	activate_offscreen_context ()
	{
		[get_opengl_offscreen_context() makeCurrentContext];
	}


}// Rays

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rays-0.3.2 src/osx/opengl.mm
rays-0.3.1 src/osx/opengl.mm
rays-0.3 src/osx/opengl.mm
rays-0.2.1 src/osx/opengl.mm