summaryrefslogtreecommitdiffstats
path: root/src/jogl/native/macosx/MacOSXCustomCGLCode.c
blob: 75896c3a2127899c7baee6cf32f877bf48d7f118 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdlib.h>

#include <assert.h>

#include <machine/types.h>
#include "macosx-window-system.h"

void CGLQueryPixelFormat(CGLPixelFormatObj fmt, int* iattrs, int niattrs, int* ivalues) {
  // FIXME: think about how specifying this might affect the API
  int virtualScreen = 0;

  int i;
  GLint value;
  for (i = 0; i < niattrs && iattrs[i]>0; i++) {
    CGLPixelFormatAttribute attr = (CGLPixelFormatAttribute) iattrs[i];
    if ( kCGLNoError == CGLDescribePixelFormat(fmt, virtualScreen, attr, &value) ) {
        ivalues[i] = value;
    } else {
        ivalues[i] = 0;
    }
  }
}