-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TESTSUITE More test suites added to the check suite
- Loading branch information
Showing
7 changed files
with
160 additions
and
92 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
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 |
---|---|---|
@@ -1,96 +1,116 @@ | ||
"""Test simple functions (i.e. no pointers involved)""" | ||
|
||
from __future__ import print_function | ||
#import OpenGL | ||
#OpenGL.USE_ACCELERATE = False | ||
|
||
# import OpenGL | ||
# OpenGL.USE_ACCELERATE = False | ||
from OpenGL.GL import * | ||
from OpenGL.GLU import * | ||
from OpenGL.GLUT import * | ||
from OpenGL.GL import GLdouble | ||
from OpenGL.arrays import arraydatatype | ||
handler = arraydatatype.ArrayDatatype.getHandler( GLdouble * 16 ) | ||
handler.registerReturn( ) | ||
import time,traceback | ||
|
||
handler = arraydatatype.ArrayDatatype.getHandler(GLdouble * 16) | ||
handler.registerReturn() | ||
import time, traceback, os | ||
|
||
start = time.time() | ||
window = None | ||
|
||
|
||
def display(): | ||
try: | ||
glutSetWindow(window); | ||
glClearColor (0.0, 0.0, (time.time()%1.0)/1.0, 0.0) | ||
glClear (GL_COLOR_BUFFER_BIT) | ||
glMatrixMode(GL_PROJECTION); | ||
glutSetWindow(window) | ||
glClearColor(0.0, 0.0, (time.time() % 1.0) / 1.0, 0.0) | ||
glClear(GL_COLOR_BUFFER_BIT) | ||
glMatrixMode(GL_PROJECTION) | ||
# For some reason the GL_PROJECTION_MATRIX is overflowing with a single push! | ||
# glPushMatrix() | ||
matrix = glGetDoublev( GL_PROJECTION_MATRIX) | ||
matrix = glGetDoublev(GL_PROJECTION_MATRIX) | ||
print('matrix', type(matrix), matrix[:][:]) | ||
glutSwapBuffers() | ||
except Exception: | ||
traceback.print_exc() | ||
sys.exit(0) | ||
size = (250,250) | ||
def reshape( *args ): | ||
global size | ||
|
||
|
||
size = (250, 250) | ||
|
||
|
||
def reshape(*args): | ||
global size | ||
size = args | ||
glViewport( *( (0,0)+args) ) | ||
glViewport(*((0, 0) + args)) | ||
display() | ||
def ontimer( *args ): | ||
print('timer', args, '@time', time.time()-start) | ||
glutTimerFunc( 1000, ontimer, 24 ) | ||
|
||
|
||
def ontimer(*args): | ||
print('timer', args, '@time', time.time() - start) | ||
glutTimerFunc(1000, ontimer, 24) | ||
|
||
|
||
def idle(): | ||
delta = time.time()-start | ||
if delta < 10: | ||
global size | ||
x,y = size | ||
delta = time.time() - start | ||
if delta < 2: | ||
global size | ||
x, y = size | ||
if delta < 5: | ||
change = +1 | ||
else: | ||
change = -1 | ||
x = x-change | ||
y = y+change | ||
x = x - change | ||
y = y + change | ||
if x < 1: | ||
x = 1 | ||
if y < 1: | ||
y = 1 | ||
glutReshapeWindow( x, y ) | ||
size = (x,y) | ||
glutReshapeWindow(x, y) | ||
size = (x, y) | ||
glutSetWindow(window) | ||
glutPostRedisplay() | ||
else: | ||
glutDestroyWindow( window ) | ||
glutDestroyWindow(window) | ||
print('window destroyed') | ||
sys.stdout.write('OK') | ||
sys.stdout.flush() | ||
try: | ||
if fgDeinitialize: fgDeinitialize(False) | ||
if fgDeinitialize: | ||
fgDeinitialize(False) | ||
except NameError: | ||
pass # Older PyOpenGL, you may see a seg-fault here... | ||
import sys | ||
sys.exit( 0 ) | ||
def printFunction( name ): | ||
def onevent( *args ): | ||
print('%s -> %s'%(name, ", ".join( [str(a) for a in args ]))) | ||
pass # Older PyOpenGL, you may see a seg-fault here... | ||
os._exit(0) | ||
|
||
|
||
def printFunction(name): | ||
def onevent(*args): | ||
print('%s -> %s' % (name, ", ".join([str(a) for a in args]))) | ||
|
||
return onevent | ||
|
||
|
||
if __name__ == "__main__": | ||
import sys | ||
|
||
newArgv = glutInit(sys.argv) | ||
print('newArguments', newArgv) | ||
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB ) | ||
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB) | ||
glutInitWindowSize(250, 250) | ||
glutInitWindowPosition(100, 100) | ||
window = glutCreateWindow("hello") | ||
print('window', repr(window)) | ||
glutDisplayFunc(display) | ||
glutReshapeFunc(reshape) | ||
glutMouseFunc(printFunction( 'Mouse' )) | ||
glutEntryFunc(printFunction( 'Entry' )) | ||
glutKeyboardFunc( printFunction( 'Keyboard' )) | ||
glutKeyboardUpFunc( printFunction( 'KeyboardUp' )) | ||
glutMotionFunc( printFunction( 'Motion' )) | ||
glutPassiveMotionFunc( printFunction( 'PassiveMotion' )) | ||
glutVisibilityFunc( printFunction( 'Visibility' )) | ||
glutWindowStatusFunc( printFunction( 'WindowStatus' )) | ||
glutSpecialFunc( printFunction( 'Special' )) | ||
glutSpecialUpFunc( printFunction( 'SpecialUp' )) | ||
glutTimerFunc( 1000, ontimer, 23 ) | ||
glutIdleFunc( idle ) | ||
glutMouseFunc(printFunction('Mouse')) | ||
glutEntryFunc(printFunction('Entry')) | ||
glutKeyboardFunc(printFunction('Keyboard')) | ||
glutKeyboardUpFunc(printFunction('KeyboardUp')) | ||
glutMotionFunc(printFunction('Motion')) | ||
glutPassiveMotionFunc(printFunction('PassiveMotion')) | ||
glutVisibilityFunc(printFunction('Visibility')) | ||
glutWindowStatusFunc(printFunction('WindowStatus')) | ||
glutSpecialFunc(printFunction('Special')) | ||
glutSpecialUpFunc(printFunction('SpecialUp')) | ||
glutTimerFunc(1000, ontimer, 23) | ||
|
||
glutIdleFunc(idle) | ||
glutMainLoop() |
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
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 |
---|---|---|
@@ -1,33 +1,37 @@ | ||
#!/usr/bin/python | ||
from __future__ import print_function | ||
import sys | ||
import sys, os | ||
import pygame | ||
from pygame.locals import * | ||
from OpenGL.GL import * | ||
from OpenGL.GLU import * | ||
import psutil | ||
|
||
|
||
def main(): | ||
pygame.init() | ||
pygame.display.set_mode((800,600), pygame.OPENGL| | ||
pygame.DOUBLEBUF) | ||
pygame.display.set_mode((800, 600), pygame.OPENGL | pygame.DOUBLEBUF) | ||
glClearColor(1.0, 0.0, 0.0, 1.0) | ||
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) | ||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) | ||
|
||
done = False | ||
|
||
while not done: | ||
for i in range(0,50000): | ||
mem = 0 | ||
for i in range(0, 500): | ||
if i == 10: | ||
mem = psutil.Process(os.getpid()).memory_percent() | ||
if i > 400: | ||
new_mem = psutil.Process(os.getpid()).memory_percent() | ||
assert new_mem == mem | ||
break | ||
|
||
modelview_matrix = glGetFloatv(GL_MODELVIEW_MATRIX) | ||
assert modelview_matrix is not None | ||
if not i % 500: | ||
sys.stdout.write('.') | ||
print() | ||
pygame.display.flip() | ||
break | ||
sys.stdout.write('OK\n') | ||
sys.stdout.flush() | ||
|
||
eventlist = pygame.event.get() | ||
for event in eventlist: | ||
if event.type == QUIT or event.type == KEYDOWN and event.key == K_ESCAPE: | ||
done = True | ||
|
||
if __name__ == '__main__': | ||
main() |
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 |
---|---|---|
@@ -1,35 +1,40 @@ | ||
from __future__ import print_function | ||
import sys | ||
from OpenGL.GL import * | ||
from OpenGL.GLUT import * | ||
from OpenGL.extensions import alternate | ||
from OpenGL.GL.ARB.draw_instanced import * | ||
from OpenGL.GL.EXT.draw_instanced import * | ||
|
||
|
||
def detect(): | ||
glutInit([]) | ||
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH) | ||
glutInitWindowSize(200,200) | ||
glutInitWindowSize(200, 200) | ||
|
||
glutCreateWindow("Detection") | ||
|
||
functions = ( | ||
glDrawArraysInstanced, | ||
glDrawArraysInstancedARB, | ||
glDrawArraysInstanced, | ||
glDrawArraysInstancedARB, | ||
glDrawArraysInstancedEXT, | ||
#glDrawArraysInstancedNV, is GLES only | ||
# glDrawArraysInstancedNV, is GLES only | ||
) | ||
|
||
for function in functions: | ||
print(function.__name__, bool(function)) | ||
any = alternate( *functions ) | ||
|
||
any = alternate(*functions) | ||
|
||
print(any, bool(any)) | ||
sys.stdout.write('OK\n') | ||
sys.stdout.flush() | ||
try: | ||
if fgDeinitialize: fgDeinitialize(False) | ||
if fgDeinitialize: | ||
fgDeinitialize(False) | ||
except NameError: | ||
pass # Older PyOpenGL, you may see a seg-fault here... | ||
pass # Older PyOpenGL, you may see a seg-fault here... | ||
|
||
|
||
if __name__ == "__main__": | ||
detect() |
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 |
---|---|---|
@@ -1,43 +1,51 @@ | ||
import pygame, sys | ||
from pygame.locals import * | ||
import OpenGL | ||
|
||
OpenGL.USE_ACCELERATE = False | ||
from OpenGL.GL import * | ||
from OpenGL.GL.EXT.framebuffer_object import * | ||
from OpenGL import error | ||
|
||
def draw (): | ||
glClearColor(0.0,0.0,0.0,0.0) | ||
|
||
def draw(): | ||
glClearColor(0.0, 0.0, 0.0, 0.0) | ||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) | ||
#draw stuff here | ||
# draw stuff here | ||
pygame.display.flip() | ||
|
||
|
||
def main(): | ||
pygame.init() | ||
pygame.display.set_mode((512,512),OPENGL | DOUBLEBUF) | ||
pygame.display.set_mode((512, 512), OPENGL | DOUBLEBUF) | ||
|
||
#setup a texture | ||
tex = glGenTextures(1); | ||
glBindTexture(GL_TEXTURE_2D, tex); | ||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, | ||
GL_UNSIGNED_BYTE, None); | ||
glBindTexture(GL_TEXTURE_2D, 0); | ||
# setup a texture | ||
tex = glGenTextures(1) | ||
glBindTexture(GL_TEXTURE_2D, tex) | ||
glTexImage2D( | ||
GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, None | ||
) | ||
glBindTexture(GL_TEXTURE_2D, 0) | ||
|
||
#setup teh fbo | ||
# setup teh fbo | ||
fbo = glGenFramebuffersEXT(1) | ||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo) | ||
glBindTexture(GL_TEXTURE_2D, tex) | ||
|
||
#this call produces an error! | ||
# this call produces an error! | ||
|
||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, | ||
GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_2D, tex, 0) | ||
glFramebufferTexture2DEXT( | ||
GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex, 0 | ||
) | ||
|
||
while 1: | ||
event=pygame.event.poll () | ||
event = pygame.event.poll() | ||
if event.type is QUIT: | ||
sys.exit(0) | ||
draw() | ||
print('OK') | ||
break | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.