Recent Posts

Pages: 1 [2] 3 4 ... 10
11
64-bit SDK programming / How to create a BBP_GLSL plugin
« Last post by Patrice Terrier on December 30, 2025, 06:22:41 pm »
BassBox GLSL Plugin – Minimal Tutorial (Template Walkthrough)

This post explains how to use the provided bbp_GLSL.cpp + GLSL.h template
to build a simple GLSL-based visual plugin for BassBox64 / MBox64.

The goal is not to introduce “modern OpenGL”, but to show how a GLSL fragment shader
is integrated cleanly into the existing BassBox OpenGL pipeline.

The template uses:
- a legacy full-screen quad (glBegin / glVertex)
- a minimal passthrough vertex shader
- a fragment shader driven by audio and time
- a 32-color LUT system shared between CPU and GPU


----------------------------------------------------------------
1) Plugin lifecycle (BBProc)
----------------------------------------------------------------

The host communicates with the plugin through the exported function:

    ExportC long BBProc(BBPLUGIN &BBP);

The most important messages are:

BBP_CREATE 
Called once to declare plugin identity and rendering mode.
Here you set:
- title
- author
- version
- BBP_OPENGL (mandatory for GLSL plugins)

BBP_INIT 
Called once when the plugin is initialized.
This is where you:
- bind the host OpenGL context (wglMakeCurrent)
- reset OpenGL state
- initialize time and audio variables
- create textures (including the LUT)
- compile and link GLSL shaders
- cache uniform and sampler locations

BBP_RENDER 
Called every frame.
This is where you:
- update time and audio values
- send uniforms to the shader
- bind textures
- draw a full-screen quad

BBP_SIZE 
Called when the plugin window is resized.
You must update glViewport and internal width/height.

BBP_DESTROY 
Called when the plugin is unloaded.
You must delete:
- GLSL program
- textures
- any allocated resources


----------------------------------------------------------------
2) Rendering model
----------------------------------------------------------------

This template uses a very simple and reliable rendering model:

- A full-screen quad is drawn in clip space (-1 .. +1)
- The vertex shader simply forwards gl_Vertex to gl_Position
- The fragment shader runs once per pixel

No VBO, no VAO, no FBO, no multipass.
This keeps the focus on the shader logic itself.


----------------------------------------------------------------
3) Core uniforms provided to the shader
----------------------------------------------------------------

The following uniforms are automatically filled by the plugin:

uniform vec3 iResolution; 
- x = viewport width in pixels 
- y = viewport height in pixels 
- z = 1.0 (convention)

uniform float iTime; 
- Accumulated animation time
- Already modulated by audio on the CPU side
- Suitable for driving motion directly

uniform float iAudio; 
- Smoothed audio level
- Typically in the range 0.0 .. 1.0 (may slightly exceed)
- Stable enough for visual modulation

uniform vec3 iLutColor; 
- One color selected from the 32-color LUT
- Chosen on the CPU side according to audio peaks
- Already normalized (0..1)

uniform vec3 iMouse; 
- Present for compatibility
- Currently set to (0,0,0) in the template
- Can be wired later via BBP_MOUSE

uniform vec4 iDate; 
- Only iDate.w is used in the template
- Contains raw system time in seconds
- Useful if you need a non-audio-modulated time source


----------------------------------------------------------------
4) LUT system (CPU + GPU)
----------------------------------------------------------------

The template defines a 32-color palette:

- On the CPU:
  - gP.color[32]  : packed ARGB
  - gP.fR/G/B[32]: normalized float values

- On the GPU:
  - a 32x1 RGB texture bound to iChannel1

You can:
- use iLutColor for a single selected color
- sample iChannel1 in the shader for custom palette logic

The LUT texture uses:
- GL_NEAREST filtering
- GL_CLAMP_TO_EDGE wrapping


----------------------------------------------------------------
5) Demo fragment shader (what it shows)
----------------------------------------------------------------

The provided demo shader demonstrates:

- coordinate normalization using iResolution
- time-based animation using iTime
- audio-driven modulation using iAudio
- color tinting using iLutColor
- a simple ring/pulse effect
- a subtle vignette

It does NOT require:
- any texture input
- any mouse interaction
- any advanced OpenGL features

Alpha output is set to 1.0, producing an opaque image.


----------------------------------------------------------------
6) Where to modify things
----------------------------------------------------------------

To change the visual effect: 
Edit the quoted GLSL string inside:

    static GLuint CompileShaderFromString()

To add textures: 
Populate gP.mt[] in BBP_INIT and sample them as iChannel0..3.

To enable transparency: 
- Output alpha < 1.0 in gl_FragColor
- Enable blending in BBP_INIT or BBP_RENDER
- Ensure the host compositing mode supports it

To react more strongly to audio: 
- Adjust the scaling of audioNow
- Modify smoothing factor
- Use iAudio directly in the shader


----------------------------------------------------------------
7) Why this template matters
----------------------------------------------------------------

This template is intentionally:

- minimal
- stable
- legacy-compatible
- host-friendly

It avoids:
- undefined OpenGL state
- hidden multipass logic
- fragile modern-only constructs

Once this base works reliably, more complex shaders and techniques
can be layered on top with confidence.


----------------------------------------------------------------
End of tutorial
----------------------------------------------------------------

The VS 2022 bbp_GLSL.zip is attached to this post
12
Eye Candies / MBox64 3.00
« Last post by Patrice Terrier on December 30, 2025, 11:10:42 am »
MBox64 3.00 — Full Composited GLSL Playback (No Compromise)



After a long development and consolidation phase, it is time to officially present MBox64 3.00.

The screenshot above shows MBox64 playing a GLSL plugin in full composited mode, with true per-pixel alpha, no tearing, no intermediate capture, and no GPU readback hacks.

This is not a shader demo.
This is a real multimedia player, running real-time GLSL visualizations, fully integrated into a Win32 / GDI+ / OpenGL composited pipeline.

What makes this unique

To my knowledge, no other Windows multimedia player is currently able to do all of the following simultaneously:
  • Run modern GLSL shaders inside a legacy OpenGL host
  • Preserve full alpha compositing through the entire pipeline
  • Integrate seamlessly with layered windows and GDImage
  • Remain tear-free, audio-synchronized, and visually stable
  • Work without screen capture, without DWM hacks, and without off-screen video surfaces
This is not OBS-style compositing.
This is not shader playback inside a video texture.
This is true GPU rendering, composed natively with the Windows desktop.

Technical highlights
  • 64-bit native C/C++, no scripting layer
  • WinLIFT + GDImage composited rendering
  • Hybrid OpenGL architecture (legacy context + modern GLSL path)
  • Bass / Media Foundation audio backend
  • Real-time audio-driven shaders
  • No GPU → CPU frame readback
  • Deterministic render pipeline
Note: MBox64 is not DPI-aware.
Window scaling is handled by Windows itself, which allows the composited pipeline to remain stable and predictable across display configurations.

Why this matters

Most “visualization software” today relies on:
  • screen capture,
  • FBO readbacks,
  • or opaque swap chains that break alpha.
MBox64 3.00 proves that high-end GLSL visuals can be treated as first-class UI elements, not as videos or overlays.

This opens the door to:
  • fully composited shader UIs,
  • shader-driven audio players,
  • live GLSL tools,
  • and future hybrid 2D/3D desktop applications.
Screenshot context

The screenshot shows:
  • a GLSL Waveform plugin
  • running in full composited mode
  • with true transparency
  • inside the MBox64 3.00 main window
No post-processing.
No capture.
No trick.

Just the pipeline working as designed.

Source code

The full C/C++ VS 2022 project is attached to this post.
13
Eye Candies / BassBox64 version 3.00
« Last post by Patrice Terrier on December 29, 2025, 01:16:18 pm »
BassBox64 3.00 – New Version Highlights

  • Full VS2022 C/C++ source code project
  • Advanced Desktop Window Manager (DWM) integration
  • New skin theme based on DWM blur glass
  • Plugin-level blur mode with adjustable blur strength
  • Fully DPI-aware rendering (high-DPI and mixed-DPI setups)
  • Correct alpha composition and stable transparency
  • Native Windows 10 / 11 composited window support
  • Remanent histogram processing for persistent audio visuals
  • Smoother audio-to-visual response and temporal coherence
  • One-pass GLSL support from version 1.20 up to 3.30
  • Unified legacy / modern GLSL pipeline (no multipass overhead)
  • Enhanced texture support (formats, precision, alpha handling)
  • Improved OpenGL performance and rendering stability
  • Better multi-monitor and high refresh-rate handling
  • Tiny standalone executable built with TCLib
  • No Microsoft CRT dependency (reduced size and overhead)



Note: This version use exclusively 64-bit plugins, with brand new GLSL support (converted from Shadertoy).

Strongest Points of the New BassBox64 Version

Full Visual Studio 2022 Source Code Provided
The complete, build-ready VS2022 project is included, offering full transparency, long-term maintainability, and the ability to study, modify, or extend every subsystem of BassBox64.

Deep DWM Integration with Blur Glass UI
Native use of Windows DWM composition enables true blur-glass visuals, seamless desktop blending, and a modern, premium look that plugins can fully exploit.

Plugin-Level Blur with Fine Control
Blur is no longer a static UI effect: each plugin can control blur intensity dynamically, allowing glass, crystal, or frosted effects that enhance depth without hiding audio-reactive elements.

One-Pass GLSL Pipeline (1.20 → 3.30)
A unified single-pass GLSL architecture supports both legacy and modern shaders without multipass overhead, keeping performance high and code paths clean.

Remanent Histogram Audio Processing
Visualizations retain audio energy over time, producing smoother, more musical, and more expressive visuals than classic peak-based FFT displays.

True DPI Awareness and Modern Display Handling
Correct scaling and alignment across high-DPI, mixed-DPI, multi-monitor, and high-refresh-rate setups—no blurry scaling, no clipped viewports.

Enhanced Texture and Alpha Handling
Improved texture precision, format support, and alpha correctness ensure stable transparency and consistent visuals in both OpenGL and composited modes.

Tiny Standalone Executable (No CRT)
Built with TCLib and no Microsoft CRT dependency, the executable remains extremely small, fast to load, and free from runtime bloat.

Tight Audio-to-Visual Synchronization
Refined timing and smoothing logic deliver visuals that feel directly connected to the music, not just reactive but musically coherent.

Native 64-bit, Low-Latency Architecture
Pure C/C++ design focused on performance, predictability, and long-term maintainability—no frameworks, no unnecessary layers.

Context-sensitive blur control
when “Plugin fully visible” is disabled, the blur level can be adjusted interactively using the mouse wheel.

14
Pour la simulation de dés ChatGPT conseille le moteur de physique 3D "Bullet"

C'est un moteur de physique 3D prêt à l’emploi.
Son rôle n’est pas d’afficher, mais de calculer “comme dans la réalité” :

- gravité (les dés tombent),
- collisions (dé/sol, dé/dé),
- rebonds (restitution),
- frottements,
- rotations réalistes,
- arrêt quand tout est stable (“sleep”).

OpenGL et GDImage fait l’image ; Bullet fait les mouvements.
15
Bonjour Monsieur Lauzon

J'ai installé VS 2026 community, je n'ai pas trouvé de différence fondamentale pour ce qui concerne C++.

Il y a 2–3 points “pièges” avec GLUT sous Visual Studio 2022/2026, surtout en x64. Le plus important est de choisir une implémentation compatible (FreeGLUT recommandé) et de bien aligner architecture (x86/x64), lib et DLL.

1) Recommandation : utiliser FreeGLUT (plutôt que l’ancien “GLUT”)
Le GLUT historique (Mark Kilgard) est ancien et on trouve souvent des binaires incomplets ou seulement x86. FreeGLUT est l’alternative maintenue et plus simple à intégrer.

2) Le point critique : x64 vs x86

Si le projet est en x64, il faut freeglut.lib + freeglut.dll en x64.

En Win32, il faut les versions x86.
Ne mélangez jamais : une lib x86 avec un EXE x64 (erreur de link assurée).

3) Où mettre les fichiers
Typiquement :

Headers : GL\freeglut.h (et parfois GL\glut.h selon le package)

Lib : freeglut.lib (et éventuellement freeglut_static.lib si tu veux statique)

DLL : freeglut.dll (si lien dynamique)


Organisation conseillée (simple et propre) :

D:\Dev\libs\freeglut\include\GL\...
D:\Dev\libs\freeglut\lib\x64\freeglut.lib
D:\Dev\libs\freeglut\bin\x64\freeglut.dll


4) Réglages VS2022 (par projet)
Dans Project Properties (Configuration = Debug/Release, Platform = x64/Win32) :
C/C++ → General → Additional Include Directories

Ajouter :
D:\Dev\libs\freeglut\include

Linker → General → Additional Library Directories
Ajouter :
D:\Dev\libs\freeglut\lib\x64 (ou ...\lib\x86)


Linker → Input → Additional Dependencies
Ajouter au minimum :
freeglut.lib
opengl32.lib
glu32.lib (si vous utilisez GLU)
gdi32.lib (souvent nécessaire avec GLUT/FreeGLUT)
winmm.lib (parfois requis par FreeGLUT selon build)


5) DLL : où la mettre pour que ça lance
Si liés avec freeglut.lib (dynamique), il faut freeglut.dll :
soit dans le même dossier que l'.exe (le plus simple),
soit dans un dossier du PATH.


Piège classique : ça compile/link, puis au lancement Windows dit qu’il manque la DLL.
6) Un mini test de compilation
Inclure :
#include <windows.h>
#include <GL/freeglut.h>

Puis un main/WinMain simple qui fait glutInit, glutCreateWindow, glutMainLoop.
7) Cas particulier : conflit avec le pipeline OpenGL/Win32 existant

GLUT crée sa propre fenêtre et gère sa loop (glutMainLoop), ce qui peut être incompatible avec une architecture OpenGL standard.


En ce qui me concerne je n'utilise jamais GLUT, je préfère attaquer OpenGL directement, ainsi que les extensions WGL.

Le plus simple, est de partir d'un projet existant avec une boucle de message et une procédure de traitement standard, avec ou sans GDImage.

16
Bonjour M. Terrier,
J'ai changer d'ordinateur et j'ai installé visual studio 2026.
l'environnment semble très différent de VS2022.
Avez-vous des conseils pour la configuration de OpenGL et Glut car je ne retrouve pas les répertoires de base tel que décrit dans votre post "« Reply #8 on: December 24, 2024, 10:09:23 am »"
Merci à l'avance

Michel
17
Eye Candies / Re: BassBox Plugin 64-bit
« Last post by Patrice Terrier on November 24, 2025, 08:46:43 am »
New plugins are coming based on GLSL.
18
64-bit SDK programming / DWM Blur for Mica/Acrylic
« Last post by Patrice Terrier on October 30, 2025, 09:26:25 pm »
A compact demo of real DWM blur with an image overlay, gradient tint, and DPI-aware text rendering.
All packed in a stand-alone 24 KB /MT binary linked with TClib.lib.

Main Highlights
  • True DWM blur toggle (Right-Click) with instant switch — no transition flash.
  • Optional image overlay (Middle-Click), scaled and clipped to cover the client while preserving aspect.
  • Mouse-wheel–driven alpha control with speed-sensitive step (base 8 → up to 64).
  • DPI-aware (Per-Monitor-V2) rendering, sharp at any scaling.
  • Seamless maximize/restore via off-viewport reposition — no white flash or DWM fade.
  • Off-screen GDI+ compositing (double-buffered).
  • Two-color linear gradient overlay via GradientPaintDC, variable opacity / angle.
  • Private font collection with dynamic memory allocation (use-and-forget).
  • Text orientation: horizontal, bottom-up, or top-down, perfectly centered and clipped.
  • Black-theme caption bar with adaptive text color.
  • Custom small rounded corners replacing Windows 11’s exaggerated defaults.
  • Compatible with Windows 10 & 11 (Mica / Acrylic supported).

Controls
Mouse Right-Click Toggle DWM blur
Mouse Middle-Click Toggle overlay image
Mouse Wheel Adjust overlay alpha (speed-based)


Technical Notes
  • Pure Win32 / GDI+ C++ (Visual Studio 2022).
  • Static link /MT with TClib.lib → stand-alone 24 KB executable.
  • Direct-linked DPI APIs (SetThreadDpiAwarenessContext, GetDpiForWindow, etc.).
  • No external runtime or dependencies.
  • GDI+ text pipeline: DrawStringFormatedEx + BlurTextPlus.
  • Gradient painting handled by GradientPaintDC (two-color ARGB, any angle).
  • Caption bar color auto-adapts to Windows theme.
  • Custom region defines small uniform corner radius for balanced frame geometry.
  • Works seamlessly with DWM blur, Mica, or Acrylic on Windows 11.





Developer Notes

Project goal
To recreate the original Vista-style blur aesthetic with a modern, DPI-aware GDI+ implementation, packaged in a self-contained 24 KB binary (no runtime dependencies).
The design emphasizes simplicity, instant response, and pixel-perfect rendering at any scale.


Rendering architecture
  • All drawing is performed on an off-screen buffer created via GDI+ (Graphics object) to guarantee flicker-free updates.
  • Final presentation uses BitBlt to the window DC in WM_PAINT.
  • WM_ERASEBKGND always returns 1 to avoid background flashes.
  • Composition order:
    • DWM blur background (if enabled)
    • Background image (aspect-preserving cover fit, clipped to client)
    • Gradient overlay via GradientPaintDC (two-color linear fill with alpha)
    • Text and caption rendering (horizontal or rotated)


Image handling
  • Loaded once at WM_CREATE using GDI+ (GdipCreateBitmapFromFile).
  • Auto-fit logic computes the largest uniform scale to cover the client area while preserving aspect ratio.
  • Clipping handled with IntersectClipRect.
  • The image alpha channel is applied dynamically with GdipApplyImageAlpha(img, imgAlpha).


Alpha control
  • WM_MOUSEWHEEL adjusts imgAlpha with a base step of 8, automatically scaled for faster wheel spins (up to 64).
  • Alpha change triggers a re-composite via InvalidateRect (no erase).


Gradient overlay
  • Implemented by GradientPaintDC.
  • Simple two-color linear gradient (ARGB start → end), angle-based, with full opacity control.
  • Blended using SourceOver compositing on top of the image background.


Text engine
  • Uses custom DrawStringFormatedEx and BlurTextPlus for precise GDI+ text layout.
  • Supports three orientations: horizontal, bottom-up, and top-down.
  • Centered rotation around the text bounding box, with automatic clipping and no duplication artifacts.
  • Anti-aliased text rendering via TextRenderingHintAntiAlias.
  • Optional soft shadow or blur behind text.


Font management
  • Uses GDI+ Private Font Collection API (GdipPrivateAddFontFile / GdipPrivateAddMemoryFont).
  • Fonts are loaded dynamically, kept in memory only while needed ("use-and-forget").
  • Supports multiple concurrent fonts without leaks or persistent registry installs.


DPI awareness
  • Fully Per-Monitor-V2 compliant; no manifest required.
  • Enabled through direct calls to SetProcessDpiAwarenessContext and SetThreadDpiAwarenessContext.
  • Scale factor (dpi_scale) computed from GetDpiForSystem or GetDpiForWindow as fallback.


Window behavior
  • Maximize handling: the window is temporarily moved off-viewport (y = -5000) during SC_MAXIMIZE to suppress DWM transition flashes, then restored normally on SIZE_RESTORED.
  • Rounded corners: replaced the default Windows 11 exaggeration with a small, uniform radius using a custom region.
  • Caption bar: custom draw with adaptive color — black for dark theme, light for bright.
  • Theme changes: WM_SETTINGCHANGE updates caption and text colors automatically.


Performance & build
  • Compiled with Visual Studio 2022 /MT.
  • Linked with TClib.lib for minimal runtime footprint.
  • Final binary: approximately 24 KB stand-alone executable.
  • No heap allocations during painting (only during initialization).
  • Compatible with Windows 10 and 11, both light and dark modes.


  • The full VS2022 C/C++ 64-bit project is attached to this post.
19
FFcapture / FFcapture C++ version 3.00
« Last post by Patrice Terrier on October 25, 2025, 11:30:20 am »
FFcapture v3.00 — Release Candidate

Headline

New in 3.00: record a specific window or the full desktop with DPI-accurate coordinates.


How it works

During recording, the FFcapture window is minimized (iconized), so it never appears in the video.

Restoring FFcapture from the taskbar stops recording (clean Ctrl+Break handling preserved).


Other notes

Real-time capture stays on MP4 (x264) for zero dropped frames; .webm is available as a post-conversion step.

DPI helpers ensure correct sizing on high-DPI/multi-monitor setups.

Smaller binary size (French localization removed).


The full VS2022 C/C++ 64-bit project is attached to this post.
20
64-bit SDK programming / zTrace version 3.02 (DPI aware)
« Last post by Patrice Terrier on September 27, 2025, 07:36:27 pm »
Since I have a new laptop with a 2560x1600 resolution, I am slowly converting my utilities to become DPI aware.

The latest zTrace.dll version 3.02 is attached to this post, with full C/C++ VS 2022 source code.
The resulting DLL binary size is only 12 Kb.
Pages: 1 [2] 3 4 ... 10