Demo | HackLAB https://www.geeks3d.com/hacklab 3D Programming, Prototyping and Gamedev with GeeXLab Sun, 03 Dec 2023 14:09:44 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 Shadertoy Demopack v23.12.3 https://www.geeks3d.com/hacklab/20231203/shadertoy-demopack-v23-12-3/ https://www.geeks3d.com/hacklab/20231203/shadertoy-demopack-v23-12-3/#respond Sun, 03 Dec 2023 14:09:44 +0000 https://www.geeks3d.com/hacklab/?p=1733 Downloads Shadertoy demopack Download GeeXLab Downloads Feedback thread / Forum (EN) A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your PC. The Shadertoy demopack is a selection of the coolest demos available on shadertoy website. New shadertoy demos are in the following folders: – gl-shadertoy-singlepass/ – gl-shadertoy-multipass/   Unzip the pack where you want, and drag and drop any … Continue reading Shadertoy Demopack v23.12.3 »

The post Shadertoy Demopack v23.12.3 first appeared on HackLAB.]]>


Downloads


A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your PC. The Shadertoy demopack is a selection of the coolest demos available on shadertoy website.

New shadertoy demos are in the following folders:
gl-shadertoy-singlepass/
gl-shadertoy-multipass/

 
Unzip the pack where you want, and drag and drop any demo (main.xml or demo.xml) into GeeXLab.

If you want to benchmark and log scores, you can do it via command line:

GeeXLab /width=1920 /height=1080 /fullscreen /demofile="absolute_path_to_the_demo.xml" /demofile_abs_path=1 /no_menubar /benchmark_duration_ms=10000 /benchmark_log_score

Many demos, if not all, are shipped with live-coding ready pixel shader. That means you can edit the shader file (shader_img.glsl in single pass demos or ps-gl32-buf_A.glsl, ps-gl32-buf_B.glsl, … in multipass demos) in your favorite text editor and any change is instantly visible.

 
New demos:

2023.10.28
+ added gl-shadertoy-multipass/screen-space-horizon-gi/
+ added gl-shadertoy-singlepass/straight-flagstone-tiles/
+ added gl-shadertoy-singlepass/elevator-to-infinity/
+ added gl-shadertoy-multipass/inside-the-mandelbulb-2/
+ added gl-shadertoy-multipass/raytraced-rolling-ball/
+ added gl-shadertoy-multipass/extruded-bauhaus-truchet-pattern/
+ added gl-shadertoy-singlepass/shader-art-coding-introduction/
+ added gl-shadertoy-singlepass/quick-hack-on-the-train/
+ added gl-shadertoy-singlepass/cyber-fuji-2020/
+ added gl-shadertoy-singlepass/shader-metaball-intro/
+ added gl-shadertoy-singlepass/painting-with-code-demo/
+ added gl-shadertoy-singlepass/gaussian-splatting-3/
+ added gl-shadertoy-singlepass/cook-torrance/
+ added gl-shadertoy-singlepass/enter-the-matrix/
+ added gl-shadertoy-singlepass/paint-148-chars/
+ added gl-shadertoy-singlepass/big-brain/
+ added gl-shadertoy-multipass/madtracing-ball-physics/
+ added gl-shadertoy-multipass/a-study-of-glass-2/

Some screenshots:

Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

The post Shadertoy Demopack v23.12.3 first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20231203/shadertoy-demopack-v23-12-3/feed/ 0
Shadertoy Demopack v23.3.28 https://www.geeks3d.com/hacklab/20230328/shadertoy-demopack-v23-3-28/ https://www.geeks3d.com/hacklab/20230328/shadertoy-demopack-v23-3-28/#respond Tue, 28 Mar 2023 08:32:12 +0000 https://www.geeks3d.com/hacklab/?p=1704 Downloads Shadertoy demopack Download GeeXLab Downloads Feedback thread / Forum (EN) A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your PC. The Shadertoy demopack is a selection of the coolest demos available on shadertoy website. New shadertoy demos are in the following folders: – gl-shadertoy-singlepass/ – gl-shadertoy-multipass/   Unzip the pack where you want, and drag and drop any … Continue reading Shadertoy Demopack v23.3.28 »

The post Shadertoy Demopack v23.3.28 first appeared on HackLAB.]]>


Downloads


A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your PC. The Shadertoy demopack is a selection of the coolest demos available on shadertoy website.

New shadertoy demos are in the following folders:
gl-shadertoy-singlepass/
gl-shadertoy-multipass/

 
Unzip the pack where you want, and drag and drop any demo (main.xml or demo.xml) into GeeXLab.

If you want to benchmark and log scores, you can do it via command line:

GeeXLab /width=1920 /height=1080 /fullscreen /demofile="absolute_path_to_the_demo.xml" /demofile_abs_path=1 /no_menubar /benchmark_duration_ms=10000 /benchmark_log_score

Many demos, if not all, are shipped with live-coding ready pixel shader. That means you can edit the shader file (shader_img.glsl in single pass demos) in your favorite text editor and any change is instantly visible.

 
New demos:

v2023.03.23
+ added gl-shadertoy-singlepass/hex-tile-transition-effect/
+ added gl-shadertoy-singlepass/synthwave-canyon/
+ added gl-shadertoy-singlepass/cable-nest/
+ added gl-shadertoy-singlepass/electric-eel-universe/
+ added gl-shadertoy-multipass/moominhouse/
+ added gl-shadertoy-multipass/apollonian-construction/
+ added gl-shadertoy-singlepass/meander-belts/
+ added gl-shadertoy-multipass/refractive-polyhedron/
+ added gl-shadertoy-multipass/pseudo-realtime-path-tracing/1
+ added gl-shadertoy-multipass/frooty/
+ added gl-shadertoy-singlepass/cavernic/
+ added gl-shadertoy-singlepass/desire_crystal/
+ added gl-shadertoy-singlepass/inercia2022-energetic-flyby/
+ added gl-shadertoy-singlepass/cubes-are-dancing/
+ added gl-shadertoy-singlepass/geometric-altar/
+ added gl-shadertoy-singlepass/inercia2022-glowing-fibers/
+ added gl-shadertoy-singlepass/inercia2022-royaliptic/
+ added gl-shadertoy-singlepass/inercia2022-intended-one/
+ added gl-shadertoy-singlepass/twitter-blue-check/
+ added gl-shadertoy-singlepass/walk-like-an-egyptian/
+ added gl-shadertoy-singlepass/high-voltage-tendencies/
+ added gl-shadertoy-singlepass/fractal-doodling/
+ added gl-shadertoy-singlepass/wednesday-messing-around/
+ added gl-shadertoy-singlepass/anti-aliased-texture-sampling/
+ added gl-shadertoy-singlepass/back-to-fractal-city/

Some screenshots:

Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

The post Shadertoy Demopack v23.3.28 first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20230328/shadertoy-demopack-v23-3-28/feed/ 0
(Demo) Knob and Toggle Widgets (Dear ImGui) https://www.geeks3d.com/hacklab/20230327/demo-knob-and-toggle-widgets-dear-imgui/ https://www.geeks3d.com/hacklab/20230327/demo-knob-and-toggle-widgets-dear-imgui/#respond Mon, 27 Mar 2023 15:40:12 +0000 https://www.geeks3d.com/hacklab/?p=1700 Downloads OpenGL 2.1 Demopack Demo: geexlab-demopack-gl21/d29-imgui/imgui-knob-toggle/ GeeXLab Downloads Forum thread (EN) Discord   Here is a small demo that shows how to use two new widgets added in the gh_imgui library (Lua and Python). This demo requires GeeXLab 0.50+ and is available in the OpenGL 2.1 demopack in the geexlab-demopack-gl21/d29-imgui/imgui-knob-toggle/ folder.   Here is a code snippet in Lua that shows how to use the … Continue reading (Demo) Knob and Toggle Widgets (Dear ImGui) »

The post (Demo) Knob and Toggle Widgets (Dear ImGui) first appeared on HackLAB.]]>



Downloads

 
Here is a small demo that shows how to use two new widgets added in the gh_imgui library (Lua and Python).

This demo requires GeeXLab 0.50+ and is available in the OpenGL 2.1 demopack in the geexlab-demopack-gl21/d29-imgui/imgui-knob-toggle/ folder.

GeeXLab demo - Dear ImGui - Knob and toggle widgets

 
Here is a code snippet in Lua that shows how to use the toggle widget:

GeeXLab demo - Dear ImGui - toggle widget

ImGuiToggleFlags_None                   = 0
ImGuiToggleFlags_Animated               = 1  
ImGuiToggleFlags_BorderedFrame          = 8  
ImGuiToggleFlags_BorderedKnob           = 16 
ImGuiToggleFlags_ShadowedFrame          = 32 
ImGuiToggleFlags_ShadowedKnob           = 64 
ImGuiToggleFlags_A11y                   = 256

size_x = 40
size_y = 20
toggle_flags = ImGuiToggleFlags_Animated
animation_duration = 0.1
frame_rounding = 1.0 
knob_rounding = 1.0 
label = "Horizontal drag"
DragHorizontal = gh_imgui.toggle(label, DragHorizontal, 
                                 size_x, size_y, toggle_flags, animation_duration, 
                                 frame_rounding, knob_rounding)

The original knob library in C/C++ for Dear ImGui is available HERE.

 
And a code snippet in Lua showing the use of the knob widget:
GeeXLab demo - Dear ImGui - Knob widget

ImGuiKnobVariant_Tick = 1
ImGuiKnobVariant_Dot = 2
ImGuiKnobVariant_Wiper = 4
ImGuiKnobVariant_WiperOnly = 8
ImGuiKnobVariant_WiperDot = 16
ImGuiKnobVariant_Stepped = 32
ImGuiKnobVariant_Space = 64 

ImGuiKnobFlags_NoTitle = 1
ImGuiKnobFlags_NoInput = 2
ImGuiKnobFlags_ValueTooltip = 4
ImGuiKnobFlags_DragHorizontal = 8
-- this is special flag fopr GeeXLab only.
ImGuiKnobFlags_ReadOnlyInput = 16 
-- this is special flag fopr GeeXLab only.
ImGuiKnobFlags_DisableMouse = 32 

knob_flags = 0 
v_min = 0.0
v_max = 100.0
speed = 0.5
format = "%.1f"
size = 100
steps = 0
ret = 0
value = 0

label = "Tick"
knob_type = ImGuiKnobVariant_Tick
value, ret = gh_imgui.knob(label, knob_value01, v_min, v_max, speed, format, knob_type, size, knob_flags, steps)
if (ret == 1) then
  -- value has changed
  knob_value01 = value
end

The original toggle library in C/C++ for Dear ImGui is available HERE.

The post (Demo) Knob and Toggle Widgets (Dear ImGui) first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20230327/demo-knob-and-toggle-widgets-dear-imgui/feed/ 0
Flower Tweet Shader https://www.geeks3d.com/hacklab/20230111/flower-tweet-shader/ https://www.geeks3d.com/hacklab/20230111/flower-tweet-shader/#respond Wed, 11 Jan 2023 16:23:31 +0000 https://www.geeks3d.com/hacklab/?p=1685 Downloads OpenGL 3.2 Demopack Demo: geexlab-demopack-gl32/d30-twigl/twigl06.xml GeeXLab Downloads   Today, a new tweet shader made by yonatan using twigl.app (online editor for coding one tweet pixel shaders). This shader is very cool and I ported it to GeeXLab. for(float i,g,e,R,S;i++<1e2;o.rgb+=hsv(.4-.02/R,(e=max(e*R*1e4,.7)),.03/exp(e))){S=1.;vec3 p=vec3((FC.xy/r-.5)*g,g-.3)-i/2e5;p.yz*=rotate2D(.3);for(p=vec3(log(R=length(p))-t,e=asin(-p.z/R)-.1/R,atan(p.x,p.y)*3.);S<1e2;S+=S)e+=pow(abs(dot(sin(p.yxz*S),cos(p*S))),.2)/S;g+=e*R*.1;} pic.twitter.com/rKA0dGDCdr — yonatan (@zozuar) January 10, 2023   Original pixel shader: for(float i,g,e,R,S;i++

The post Flower Tweet Shader first appeared on HackLAB.]]>



Downloads

 
Today, a new tweet shader made by yonatan using twigl.app (online editor for coding one tweet pixel shaders). This shader is very cool and I ported it to GeeXLab.

 
Original pixel shader:

for(float i,g,e,R,S;i++<1e2;o.rgb+=hsv(.4-.02/R,(e=max(e*R*1e4,.7)),.03/exp(e))){S=1.;
vec3 p=vec3((FC.xy/r-.5)*g,g-.3)-i/2e5;p.yz*=rotate2D(.3);
for(p=vec3(log(R=length(p))-t,e=asin(-p.z/R)-.1/R,atan(p.x,p.y)*3.);
S<1e2;S+=S)e+=pow(abs(dot(sin(p.yxz*S),cos(p*S))),.2)/S;g+=e*R*.1;}

Here is the same pixel shader in the GeeXLab demo:

#version 150
uniform float time;
uniform float frame;
uniform vec2 resolution;
in vec4 v_texcoord;
out vec4 FragColor;

#define PI 3.14159265
#define FC gl_FragCoord

vec3 hsv(float h, float s, float v)
{
  vec4 t = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
  vec3 p = abs(fract(vec3(h) + t.xyz) * 6.0 - vec3(t.w));
  return v * mix(vec3(t.x), clamp(p - vec3(t.x), 0.0, 1.0), s);
}

mat2 rotate2D(float r)
{
  return mat2(cos(r), sin(r), -sin(r), cos(r));
}

void main()
{
  vec2 r = resolution;
  float t = time;
  float f = frame;
  vec4 o = vec4(0.0);
  vec3 p = vec3(0.0);
  float i=0,g=0,e=0,R=0,S=0;
  for(; i++<1e2; o.rgb += hsv(.4-.02/R,(e=max(e*R*1e4,.7)),.03/exp(e)))
  {
    S=1.;
    vec3 p=vec3((FC.xy/r-.5)*g,g-.3)-i/2e5;
    p.yz*=rotate2D(.3);
    for(p=vec3(log(R=length(p))-t,e=asin(-p.z/R)-.1/R,atan(p.x,p.y)*3.);S<1e2;S+=S)
      e+=pow(abs(dot(sin(p.yxz*S),cos(p*S))),.2)/S;
    
    g+=e*R*.1;
  }

  FragColor = o;
}

The GeeXLab demo (just drop geexlab-demopack-gl32/d30-twigl/twigl06.xml in GeeXLab):
GeeXLab - Twigl flower shader

The shader is ready for live coding. Just edit the shader (d30-twigl/shaders/ps06.glsl) in your favorite text editor and save it to see the result in real time.

On a GeForce RTX 2070, this demo runs at 190 FPS (resolution: 800x800).

The post Flower Tweet Shader first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20230111/flower-tweet-shader/feed/ 0
Graffiti Shader https://www.geeks3d.com/hacklab/20220819/graffiti-shader/ https://www.geeks3d.com/hacklab/20220819/graffiti-shader/#respond Fri, 19 Aug 2022 14:01:39 +0000 https://www.geeks3d.com/hacklab/?p=1672 Downloads OpenGL 2.1 Demopack Demo: geexlab-demopack-gl21/d66-graffiti-shader/main.xml GeeXLab Downloads Forum thread for feedbacks / bug-report How to run the demo? Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (main.xml) in GeeXLab. This demo requires OpenGL 2.1+.   I found this cool effect in this shadertoy demo. I put the graffiti effect in a simple GeeXLab demo. That’s all! … Continue reading Graffiti Shader »

The post Graffiti Shader first appeared on HackLAB.]]>



Downloads

How to run the demo?
Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (main.xml) in GeeXLab. This demo requires OpenGL 2.1+.

 
I found this cool effect in this shadertoy demo. I put the graffiti effect in a simple GeeXLab demo. That’s all!

GeeXLab - Graffiti shader - GLSL

 
In the following pixel shader, tex2 is the background texture (wall) and tex0 and tex1 are the graffiti. The graffiti are textures with green screen background like this one:
GeeXLab - green screen image

Pixel shader:

#version 120

#define PI 3.14159265359

uniform vec2 u_resolution;
uniform float u_time;

varying vec4 v_uv;

uniform sampler2D tex0;
uniform sampler2D tex1;
uniform sampler2D tex2;

uniform vec4 fx_params; // x=0.01;  y=0.6

vec3 graffiti(in vec2 uv, in sampler2D chan, in vec2 lit, float dist)
{
    vec3 col = vec3(0.0);
    vec3 texUV = texture2D(chan,uv).rgb;
    vec2 dShad = lit*vec2(dist);
    vec3 greenRef = texture2D(chan,vec2(.999,.999)).rgb;
    
    float gr =  0.7 - texUV.g; // red patches
    col.gb -= vec2(fx_params.y)*smoothstep(.1, .4, gr);
    
    gr = texture2D(chan,uv - vec2(fx_params.x)).r - texUV.r;	//Black sketch
    col -= smoothstep(.0,.5,gr);
    gr = texture2D(chan,uv + vec2(fx_params.x)).r - texUV.r;
    col -= smoothstep(.0,.5,gr);
    
    float shad = float(any(bvec3(step(.25,abs(texture2D(chan,uv + dShad*(1.-float(any(bvec2(step(1.-dShad,uv)))))).rgb - greenRef)))));
    float mask = float(any(bvec3(step(.25,abs(texUV - greenRef)))));
    col -= shad*(1.-mask);
    
    return col;
}

void main() 
{
    vec2 st = v_uv.xy;
    st.y *= -1.0;

    vec3 color = texture2D(tex2, st).rgb;

    vec2 lit = vec2(0.1, 0.1);
    float dist = 0.025;
    color += graffiti(st, tex0, lit, dist);
    color += graffiti(st, tex1, lit, dist);

    gl_FragColor = vec4(color,1.0);
}

GeeXLab - Graffiti shader - GLSL

The post Graffiti Shader first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20220819/graffiti-shader/feed/ 0
Shadertoy Demopack v22.8.16 https://www.geeks3d.com/hacklab/20220816/shadertoy-demopack-v22-8-16/ https://www.geeks3d.com/hacklab/20220816/shadertoy-demopack-v22-8-16/#respond Tue, 16 Aug 2022 10:59:12 +0000 https://www.geeks3d.com/hacklab/?p=1668 Downloads Shadertoy demopack Download GeeXLab Downloads Feedback thread / Forum (EN) A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your PC. The Shadertoy demopack is a selection of the coolest demos available on shadertoy website. New shadertoy demos are in the following folders: – gl-shadertoy-singlepass/ – gl-shadertoy-multipass/ These demos require at least GeeXLab 0.40+.   Unzip the pack where … Continue reading Shadertoy Demopack v22.8.16 »

The post Shadertoy Demopack v22.8.16 first appeared on HackLAB.]]>

Shadertoy demopack for GeeXLab



Downloads

A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your PC. The Shadertoy demopack is a selection of the coolest demos available on shadertoy website.

New shadertoy demos are in the following folders:
gl-shadertoy-singlepass/
gl-shadertoy-multipass/

These demos require at least GeeXLab 0.40+.

 
Unzip the pack where you want, and drag and drop any demo (main.xml or demo.xml) into GeeXLab.

If you want to benchmark and log scores, you can do it via command line:

GeeXLab /width=1920 /height=1080 /fullscreen /demofile="absolute_path_to_the_demo.xml" /demofile_abs_path=1 /no_menubar /benchmark_duration_ms=10000 /benchmark_log_score

Many demos, if not all, are shipped with live-coding ready pixel shader. That means you can edit the shader file (shader_img.glsl in single pass demos) in your favorite text editor and any change is instantly visible.

 
New demos:

v2022.08.16
+ added gl-shadertoy-singlepass/bouncing-ball-and-colorful-logo/
+ added gl-shadertoy-singlepass/twisted-rotation-on-grid-211ch/
+ added gl-shadertoy-singlepass/lightmotif-v1/
+ added gl-shadertoy-singlepass/kitties/
+ added gl-shadertoy-singlepass/polaroid-gyroidoscopic/
+ added gl-shadertoy-singlepass/paraboloid-intersection/
+ added gl-shadertoy-singlepass/hud-aim/
+ added gl-shadertoy-singlepass/smooth-partial-arc/
+ added gl-shadertoy-singlepass/impossible-ring-2/
+ added gl-shadertoy-singlepass/wiggly-lines-illusion/
+ added gl-shadertoy-singlepass/infinite-nested-block-2/
+ added gl-shadertoy-singlepass/fract-city-v1/
+ added gl-shadertoy-singlepass/motion-graphics-doodle/
+ added gl-shadertoy-singlepass/tiles-flipper-loop/
+ added gl-shadertoy-multipass/hard-surface-sphere2/
+ added gl-shadertoy-multipass/kleinian-seahorse/
+ added gl-shadertoy-singlepass/one-small-step/
+ added gl-shadertoy-multipass/hex-marching/
+ added gl-shadertoy-singlepass/noren/
+ added gl-shadertoy-multipass/candy-crush/

Some screenshots:

Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

The post Shadertoy Demopack v22.8.16 first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20220816/shadertoy-demopack-v22-8-16/feed/ 0
(Demo) NVIDIA NVML Library in Python 3 https://www.geeks3d.com/hacklab/20220816/demo-nvidia-nvml-library-in-python-3/ https://www.geeks3d.com/hacklab/20220816/demo-nvidia-nvml-library-in-python-3/#respond Tue, 16 Aug 2022 09:51:44 +0000 https://www.geeks3d.com/hacklab/?p=1666 Downloads Python 3 Demopack Demo: geexlab-demopack-python3/nvidia/nvml/main.xml GeeXLab Downloads Forum thread for feedbacks / bug-report How to run the demo? Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (main.xml) in GeeXLab. This demo requires OpenGL 2.1 and Python 3.8+.   NVIDIA NVML is NVIDIA’s Management Library. NVML allows to get various informations about the graphics hardware and the … Continue reading (Demo) NVIDIA NVML Library in Python 3 »

The post (Demo) NVIDIA NVML Library in Python 3 first appeared on HackLAB.]]>

GeeXLab - Python 3 NVIDIA NVML demo



Downloads

How to run the demo?
Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (main.xml) in GeeXLab. This demo requires OpenGL 2.1 and Python 3.8+.

 
NVIDIA NVML is NVIDIA’s Management Library. NVML allows to get various informations about the graphics hardware and the dynamic library (nvml.dll) is shipped with NVIDIA graphics drivers. Here is a more detailed description:

NVML is a C-based API for monitoring and managing various states of the NVIDIA GPU devices. It provides a direct access to the queries and commands exposed via nvidia-smi. The runtime version of NVML ships with the NVIDIA display driver, and the SDK provides the appropriate header, stub libraries and sample applications. Each new version of NVML is backwards compatible and is intended to be a platform for building 3rd party applications.

Source: NVIDIA Management Library (NVML).

NVML is also available for Python 3 via the nvidia-ml-py package.
The installation of nvidia-ml-py is simple, just type the following command in a terminal:

pip install nvidia-ml-py

Based on the example provided by NVIDIA, I coded a small GeeXLab demo that does basic GPU monitoring (clock speeds, temperature, fan speed) of your NVIDIA GPUs. The demo is available in the Python 3 demopack: geexlab-demopack-python3/nvidia/nvml/main.xml

Here are the code snippets (INIT and FRAME scripts):

INIT script:

#-------------------------------------------------------------------
# NVIDIA NVML
#-------------------------------------------------------------------

# Python Bindings for the NVIDIA Management Library
# https://pypi.org/project/nvidia-ml-py/
# pip install nvidia-ml-py
from pynvml import *

def GpuMonitoring():

    strResult = ''

    nvmlInit()

    strResult += '  driver version: ' + str(nvmlSystemGetDriverVersion()) + '\n'

    deviceCount = nvmlDeviceGetCount()

    for i in range(0, deviceCount):
        h = nvmlDeviceGetHandleByIndex(i)

        gpu_name = nvmlDeviceGetName(h)
        strResult += '\n  GPU: ' + gpu_name + '\n'

        gpu_cores = nvmlDeviceGetNumGpuCores(h)
        strResult += '  - CUDA cores: %d\n' % gpu_cores

        gpu_core_clock = nvmlDeviceGetMaxClockInfo(h, NVML_CLOCK_GRAPHICS)
        strResult += '  - core clock: ' + str(gpu_core_clock) + ' MHz\n'
        gpu_mem_clock = nvmlDeviceGetMaxClockInfo(h, NVML_CLOCK_MEM)
        strResult += '  - mem clock: ' + str(gpu_mem_clock) + ' MHz\n'

        gpu_temp = nvmlDeviceGetTemperature(h, NVML_TEMPERATURE_GPU)
        strResult += '  - temperature: ' + str(gpu_temp) + '°C\n'

        num_fans = nvmlDeviceGetNumFans(h)
        for f in range(0, num_fans):
            fan_speed = nvmlDeviceGetFanSpeed_v2(h, f)
            strResult += '  - fan speed ' + str(f) + ': ' + str(fan_speed) + '%%\n'


    nvmlShutdown()

    return strResult


nv_gpu_monitoring_str = ""

FRAME script:

imgui_frame_begin()
gh_imgui.set_color(IMGUI_WINDOW_BG_COLOR, 0.1, 0.1, 0.1, 0.6)
gh_imgui.set_color(IMGUI_TEXT_COLOR, 1.0, 1.0, 1.0, 1.0)

is_open = imgui_window_begin_pos_size_always("Control panel", winW, winH, 0, 0)
if (is_open == 1):

  win_hovered = gh_imgui.is_window_hovered()

  gh_imgui.set_color(IMGUI_TEXT_COLOR, 1.0, 1.0, 0.0, 1.0)
  gh_imgui.text("Python version: " + sys.version)

  gh_imgui.set_color(IMGUI_TEXT_COLOR, 1.0, 1.0, 1.0, 1.0)
  gh_imgui.spacing()
  gh_imgui.spacing()
  gh_imgui.text("NVIDIA NVMLtest")

  gh_imgui.spacing()
  gh_imgui.spacing()

  if (gh_imgui.button('GPU monitoring', 180, 30) == 1):
    nv_gpu_monitoring_str = GpuMonitoring()

  gh_imgui.text_wrapped(nv_gpu_monitoring_str)

  gh_imgui.spacing()
  gh_imgui.spacing()

imgui_window_end()
imgui_frame_end()

The NVML python library is shipped with GeeXLab in the python3 folder.

The post (Demo) NVIDIA NVML Library in Python 3 first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20220816/demo-nvidia-nvml-library-in-python-3/feed/ 0
Simple Text to Speech Demo in Python 3 (with pyttsx3) https://www.geeks3d.com/hacklab/20220630/simple-text-to-speech-demo-in-python-3-with-pyttsx3/ https://www.geeks3d.com/hacklab/20220630/simple-text-to-speech-demo-in-python-3-with-pyttsx3/#respond Thu, 30 Jun 2022 14:48:56 +0000 https://www.geeks3d.com/hacklab/?p=1663 Downloads Python 3 Demopack Demo: geexlab-demopack-python3/speech/01-text-2-speech/main.xml GeeXLab Downloads Forum thread for feedbacks / bug-report How to run the demo? Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (main.xml) in GeeXLab. This demo requires OpenGL 2.1 and Python 3.8+.   pyttsx3 is a text to speech conversion library for Python 3. This library does not require an internet … Continue reading Simple Text to Speech Demo in Python 3 (with pyttsx3) »

The post Simple Text to Speech Demo in Python 3 (with pyttsx3) first appeared on HackLAB.]]>

Text to Speech pyttsx3



Downloads

How to run the demo?
Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (main.xml) in GeeXLab. This demo requires OpenGL 2.1 and Python 3.8+.

 
pyttsx3 is a text to speech conversion library for Python 3. This library does not require an internet connection, that’s good, GeeXLab loves offline libs!

pyttsx3 is shipped with GeeXLab 0.47.2 in the python3_8/Lib/site-packages/ folder. If you want to play with pyttsx3 in no time, just grab the latest GeeXLab + the demopack. Now, if you want to install pyttsx3, open a terminal and type:

pip install pyttsx3

Let’s see how to use pyttsx3 to hear more or less any speech from a string. Here is a simple example that import the pyttsx3 library, initializes it and play a text:

import pyttsx3 as t2s
t2s_engine = t2s.init()
tex = "The quick brown fox jumped over the lazy dog."
t2s_engine.say(text)
t2s_engine.runAndWait()

pyttsx3 offers the possibility to change the rate (number of words per minute), the volume, the voice and even the language:

rate = t2s_engine.getProperty('rate')
t2s_engine.setProperty('rate', rate)

volume = t2s_engine.getProperty('volume')
t2s_engine.setProperty('volume ', volume )

voices = t2s_engine.getProperty('voices')    
t2s_engine.setProperty('voice', voices[0].id)

I prepared a GeeXLab demo that allows you to type a short text and change the rate:


GeeXLab demo: Text to Speech with pyttsx3

This demo is available in the Python 3 demopack in the geexlab-demopack-python3/speech/01-text-2-speech/ folder.

Remark: the runAndWait() function blocks the demo. If the text is short that should be ok but for longer texts that can be a problem. One solution would be to run the text to speech conversion in a separate thread using a ZOMBIE script and shared variables or shared memory.

The post Simple Text to Speech Demo in Python 3 (with pyttsx3) first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20220630/simple-text-to-speech-demo-in-python-3-with-pyttsx3/feed/ 0
How to Download a File with curl from GeeXLab https://www.geeks3d.com/hacklab/20220616/how-to-download-a-file-with-curl-from-geexlab/ https://www.geeks3d.com/hacklab/20220616/how-to-download-a-file-with-curl-from-geexlab/#respond Thu, 16 Jun 2022 15:41:37 +0000 https://www.geeks3d.com/hacklab/?p=1658 Downloads OpenGL 2.1 Demopack Demo: geexlab-demopack-gl21/d65-curl/main.xml GeeXLab Downloads Forum thread for feedbacks / bug-report How to run the demo? Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (main.xml) in GeeXLab. This demo requires OpenGL 2.1+.   curl is a powerful command line utility for transferring data with URLs. curl has a lot of command line parameters that … Continue reading How to Download a File with curl from GeeXLab »

The post How to Download a File with curl from GeeXLab first appeared on HackLAB.]]>

curl logo



Downloads

How to run the demo?
Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (main.xml) in GeeXLab. This demo requires OpenGL 2.1+.

 
curl is a powerful command line utility for transferring data with URLs. curl has a lot of command line parameters that offer a myriad of possibilities.

For example, if you want to download the following image (in this tweet) with curl from the command line, just type:

curl --insecure -o img.jpg https://pbs.twimg.com/media/FVXVWBEXEAAvr69?format=jpg

and you should get the following image (file img.jpg) in the folder:


GeeXLab demo

 
We can do the same thing with GeeXLab in Lua or Python. Here are the current functions to deal with curl engine available in the gh_utils lib:

– curl_get_file_time_and_size()
– curl_download_file_in_buffer()
– curl_download_file_v1()

curl_get_file_time_and_size() allows to get the time and size of a remote file. Useful to check the presence of a file before trying to download it.

curl_download_file_v1() downloads a remote file and store it in a regular file on the disk. In the case of an image for example, you can then load the texture with gh_texture.create_from_file().

curl_download_file_in_buffer() downloads a remote file and store it in a memory buffer. Still in the case of an image, you can create a texture from the buffer with gh_texture.create_from_buffer().

curl functions are available on Windows, Linux and Raspberry Pi OS. GeeXLab for Windows comes with curl DLLs. On Linux and Raspberry Pi OS, curl is already installed and you have to tell GeeXLab where to find the .so files.

The demo (d65-curl/) shows how to use these functions:


GeeXLab demo - curl functions

 
Here is a code snippet with the important functions (complete code is available in init.lua):

local remote_filename = "https://pbs.twimg.com/media/FVXVWBEXEAAvr69?format=jpg&name=small"

local app_dir = gh_utils.get_app_dir() 	

curl_dylib = "" -- On Windows
if (is_linux) then
  curl_dylib = app_dir .. "dylibs/libcurl.so.4.6.0" -- Linux Mint 20.3 
elseif (is_rpi) then
  curl_dylib = app_dir .. "dylibs/libcurl.so.4.7.0" -- Raspberry Pi OS
end


-- Check the size of the file that will be downloaded. This step is optional, you can directly download the file from the web.
--
filesize, filetime, filetime_str128 = gh_utils.curl_get_file_time_and_size(curl_dylib, remote_filename)

if (filesize > 0) then

  local download_in_memory = true

  if (download_in_memory) then

    -- Download the file in a memory buffer without storing it in a file on the disk.
    --
    buffer, buffer_size = gh_utils.curl_download_file_in_buffer(curl_dylib, remote_filename)
    if (buffer_size > 0) then
      tex0 = gh_texture.create_from_buffer(buffer, buffer_size, upload_to_gpu, pixel_format, texture_unit, gen_mipmaps, compressed_texture)
      gh_utils.curl_free_buffer(buffer)
    end

  else

    -- Download the file in a local file on the disk.
    --
    local local_filename = demo_dir .. "assets/01.jpg"
    local ret = gh_utils.curl_download_file_v1(curl_dylib, remote_filename, local_filename)
    if (ret == 1) then
      if (file_exists(local_filename)) then
        tex0 = gh_texture.create_from_file_v6(local_filename, pixel_format, gen_mipmaps, compressed_texture)
      end
    end
  
  end
end

The post How to Download a File with curl from GeeXLab first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20220616/how-to-download-a-file-with-curl-from-geexlab/feed/ 0
Shadertoy Demopack v21.12.3 https://www.geeks3d.com/hacklab/20211203/shadertoy-demopack-v21-12-3/ https://www.geeks3d.com/hacklab/20211203/shadertoy-demopack-v21-12-3/#respond Fri, 03 Dec 2021 14:38:58 +0000 https://www.geeks3d.com/hacklab/?p=1651 Downloads Shadertoy demopack Download GeeXLab Downloads Feedback thread / Forum (EN) A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your PC. New shadertoy demos are in the following folders: – gl-shadertoy-singlepass/ – gl-shadertoy-multipass/ These demos require at least GeeXLab 0.40+.   Unzip the pack where you want, and drag and drop any demo (main.xml or demo.xml) into GeeXLab. If … Continue reading Shadertoy Demopack v21.12.3 »

The post Shadertoy Demopack v21.12.3 first appeared on HackLAB.]]>

Shadertoy demopack for GeeXLab



Downloads

A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your PC.

New shadertoy demos are in the following folders:
gl-shadertoy-singlepass/
gl-shadertoy-multipass/

These demos require at least GeeXLab 0.40+.

 
Unzip the pack where you want, and drag and drop any demo (main.xml or demo.xml) into GeeXLab.

If you want to benchmark and log scores, you can do it via command line:

GeeXLab /width=1920 /height=1080 /fullscreen /demofile="absolute_path_to_the_demo.xml" /demofile_abs_path=1 /no_menubar /benchmark_duration_ms=10000 /benchmark_log_score

Many demos, if not all, are shipped with live-coding ready pixel shader. That means you can edit the shader file (shader_img.glsl in single pass demos) in your favorite text editor and any change is instantly visible.

 
Some screenshots:

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Changelog:

2021.12.03
+ added gl-shadertoy-singlepass/metaballs-quintic/
+ added gl-shadertoy-singlepass/darkcore/
+ added gl-shadertoy-singlepass/jelly-gateways-2/
+ added gl-shadertoy-multipass/a-green-thing-variation-zero/
+ added gl-shadertoy-multipass/alexander-horned-sphere-zoom/
+ added gl-shadertoy-singlepass/taste-of-noise3/
+ added gl-shadertoy-singlepass/taste-of-noise2/
The post Shadertoy Demopack v21.12.3 first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20211203/shadertoy-demopack-v21-12-3/feed/ 0