No project description provided
Project description
glnext
Example
import glnext
from glnext_compiler import glsl
from PIL import Image
instance = glnext.instance()
framebuffer = instance.framebuffer((512, 512))
pipeline = framebuffer.render(
vertex_shader=glsl('''
#version 450
#pragma shader_stage(vertex)
layout (location = 0) in vec2 in_vert;
layout (location = 1) in vec3 in_color;
layout (location = 0) out vec3 out_color;
void main() {
gl_Position = vec4(in_vert, 0.0, 1.0);
out_color = in_color;
}
'''),
fragment_shader=glsl('''
#version 450
#pragma shader_stage(fragment)
layout (location = 0) in vec3 in_color;
layout (location = 0) out vec4 out_color;
void main() {
out_color = vec4(in_color, 1.0);
}
'''),
vertex_format='2f 3f',
vertex_count=3,
)
pipeline['vertex_buffer'].write(glnext.pack([
-0.5, -0.5, 0.0, 0.0, 1.0,
0.5, -0.5, 0.0, 1.0, 0.0,
0.0, 0.5, 1.0, 0.0, 0.0,
]))
instance.run()
data = framebuffer.output[0].read()
Image.frombuffer('RGBA', (512, 512), data, 'raw', 'RGBA', 0, -1).show()
Install
pip install glnext
Windows
With up2date drivers the vulkan runtime binaries should already be on your system. Install the vulkan-sdk if needed.
Linux
Install the vulkan-sdk.
apt-get install libx11-dev
Without GPU
This project is compatible with swiftshader. The CI also runs on pure CPU. (Dockerfile)
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
glnext-0.7.0.tar.gz
(115.0 kB
view hashes)
Built Distributions
Close
Hashes for glnext-0.7.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18f67e14aea01bf98d4c59807ce633beb5f6e025bcb80d88efe2d02d1b74a8c7 |
|
MD5 | 3e9ed651c9ee288258b6e4fbea85192f |
|
BLAKE2b-256 | 0a223e7ddc7241ada57e36a246f432e75ee2b84c69580056585973d86219bed6 |
Close
Hashes for glnext-0.7.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35ffd5b8a0fe79fd668585c1bc754235ae7fde6b2ba6135aa88eab66a4960690 |
|
MD5 | 9b94ec0e5f85c95d89071cb50376c928 |
|
BLAKE2b-256 | 200e4ee0396fa94aa02a2121d10c5a02fd10e3b17194fd716ab636e13284f577 |