File: test_glreadpixels_uint8888.py

package info (click to toggle)
pyopengl 3.1.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,216 kB
  • sloc: python: 80,468; makefile: 4
file content (17 lines) | stat: -rw-r--r-- 708 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import OpenGL.GL as gl
import OpenGL.images as images

def test_createTargetArray():
    size = (640,480)
    array1 = images.createTargetArray( gl.GL_BGRA, size, gl.GL_UNSIGNED_INT_8_8_8_8_REV)
    array2 = images.createTargetArray( gl.GL_RGBA, size, gl.GL_UNSIGNED_BYTE)
    array3 = images.createTargetArray( gl.GL_RGBA, size, gl.GL_UNSIGNED_INT_8_8_8_8_REV)
    assert array1.nbytes == array3.nbytes
    assert array1.nbytes == array2.nbytes
    
    try:
        images.createTargetArray( gl.GL_RGBA, size, gl.GL_UNSIGNED_BYTE_3_3_2 )
    except ValueError as err:
        pass 
    else:
        raise RuntimeError( """Should have failed with insufficient components in the type to hold the format""" )