No project description provided
Project description
zengl
Examples
import zengl
from PIL import Image
ctx = zengl.instance(zengl.context(headless=True))
size = (1280, 720)
image = ctx.image(size, 'rgba8unorm', samples=1)
triangle = ctx.renderer(
vertex_shader='''
#version 330
out vec3 v_color;
vec2 positions[3] = vec2[](
vec2(0.0, 0.8),
vec2(-0.6, -0.8),
vec2(0.6, -0.8)
);
vec3 colors[3] = vec3[](
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0)
);
void main() {
gl_Position = vec4(positions[gl_VertexID], 0.0, 1.0);
v_color = colors[gl_VertexID];
}
''',
fragment_shader='''
#version 330
in vec3 v_color;
layout (location = 0) out vec4 out_color;
void main() {
out_color = vec4(v_color, 1.0);
}
''',
framebuffer=[image],
topology='triangles',
vertex_count=3,
)
image.clear(1.0, 1.0, 1.0, 1.0)
triangle.render()
Image.frombuffer('RGBA', size, image.read(), 'raw', 'RGBA', 0, -1).save('hello.png')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zengl-0.2.4.tar.gz
(24.2 kB
view details)
File details
Details for the file zengl-0.2.4.tar.gz
.
File metadata
- Download URL: zengl-0.2.4.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11951f243d2576c3fc72cb7fbbf15b51414d4e65c801e31107621c49f2ef789f |
|
MD5 | 34c9d02d0b3dfcc7055b72f46f5c17fa |
|
BLAKE2b-256 | 955a571f6e56f64ed62382e91a3bb5242fdc78ae4e42e4c3720ac3d7740b5145 |