1 /* 2 * Copyright 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef MAC_NATIVE_H 18 #define MAC_NATIVE_H 19 20 #include <OpenGL/gl.h> 21 22 typedef enum { // Mac equivalence 23 MAC_HAS_DOUBLE_BUFFER = 5, // NSOpenGLPFADoubleBuffer 24 MAC_DRAW_TO_WINDOW = 80, // NSOpenGLPFAWindow 25 MAC_DRAW_TO_PBUFFER = 90, // NSOpenGLPFAPixelBuffer 26 MAC_SAMPLES_PER_PIXEL = 56, // NSOpenGLPFASamples 27 MAC_OPENGL_PROFILE = 99, // NSOpenGLPFAOpenGLProfile 28 MAC_COLOR_SIZE = 8, // NSOpenGLPFAColorSize 29 MAC_ALPHA_SIZE = 11, // NSOpenGLPFAAlphaSize 30 MAC_DEPTH_SIZE = 12, // NSOpenGLPFADepthSize 31 MAC_STENCIL_SIZE = 13 // NSOpenGLPFAStencilSize 32 } MacPixelFormatAttribs; 33 34 typedef enum { 35 MAC_OPENGL_PROFILE_LEGACY = 0x1000, // NSOpenGLProfileVersionLegacy 36 MAC_OPENGL_PROFILE_3_2 = 0x3200, // NSOpenGLProfileVersion3_2Core 37 MAC_OPENGL_PROFILE_4_1 = 0x4100, // NSOpenGLProfileVersion4_1Core 38 } MacOpenGLProfileVersions; 39 40 41 extern "C"{ 42 43 int setupCoreProfileNativeFormats(); 44 45 int getNumPixelFormats(); 46 47 void* finalizePixelFormat( 48 bool coreProfile, int pixelFormatIndex); 49 50 int getPixelFormatAttrib(int i, int attrib); 51 52 void* nsCreateContext(void* finalizedPixelFormat,void* share); 53 void nsWindowMakeCurrent(void* context,void* nativeWin); 54 void nsPBufferMakeCurrent(void* context,void* nativePBuffer,int level); 55 void nsSwapBuffers(); 56 void nsSwapInterval(int *interval); 57 void nsDestroyContext(void* context); 58 void* nsCreatePBuffer(GLenum target,GLenum format,int maxMip,int width,int height); 59 void nsDestroyPBuffer(void* pbuffer); 60 bool nsGetWinDims(void* win,unsigned int* width,unsigned int* height); 61 bool nsCheckColor(void* win,int colorSize); 62 63 } 64 65 #endif 66