No project description provided
Project description
glnext
Example
import glnext
from glnext_compiler import glsl
from PIL import Image
instance = glnext.instance()
renderer = instance.renderer((512, 512))
pipeline = renderer.pipeline(
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.update(
vertex_buffer=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.render()
data = renderer.output[0].read()
Image.frombuffer('RGB', (512, 512), data, 'raw', 'BGRX', 0, -1).show()
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.3.0.tar.gz
(28.1 kB
view hashes)
Built Distribution
Close
Hashes for glnext-0.3.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 599ba4424dff8dcd6ceb9fdf56f0a38467755fc92ef97176b8c821f1c74b29a8 |
|
MD5 | 91c6a429945da2b24899e92bbf14425d |
|
BLAKE2b-256 | 2ad811d232fafc703375ba190700c74d672c14950594f5912d4c82671055d478 |