-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEMO provide a running version of code in bug report in #34
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#! /usr/bin/env python | ||
"""Tests bug report #32 from github""" | ||
import os | ||
if not os.environ.get( 'PYOPENGL_PLATFORM' ): | ||
os.environ['PYOPENGL_PLATFORM'] = 'osmesa' | ||
from math import pi, sin, cos | ||
import OpenGL | ||
OpenGL.USE_ACCELERATE = False | ||
from OpenGL.GL import * | ||
from OpenGL.GL.ARB.fragment_program import glGenProgramsARB | ||
from OpenGL.GLU import * | ||
from OpenGL.osmesa import * | ||
width = height = 300 | ||
|
||
shared_win = None | ||
# Current OSMesa does not seem to support RGB, only RGBA, | ||
# note also the use of the OSMESA_* constants here, they | ||
# seem to match the GL constants, but can't be too careful. | ||
# Also see ./osdemo.py for a working sample of offscreen | ||
# rendering using OSMesa. | ||
ctx = OSMesaCreateContext(OSMESA_RGBA, shared_win) | ||
buf = arrays.GLubyteArray.zeros((height, width, 4)) | ||
mesap = arrays.ArrayDatatype.dataPointer(buf) | ||
assert(OSMesaMakeCurrent(ctx, GLuint(mesap), GL_UNSIGNED_BYTE, width, height)) |