vpGetImage(3)
π vpGetImage β get a field of the intermediate image π
okay bestie, sit down, hydrate, and let's talk about vpGetImage(3) from the VolPack library, aka your little backstage pass to the messy middle of the render pipeline β¨
πΈ NAME πΈ
vpGetImage β literally just: get a field of the intermediate image π«Ά
β¨ SYNOPSIS β¨
#include <volpack.h>
vpResult
vpGetImage(vpc, image, width, height, scan_bytes, pixel_type,
image_type)
vpContext *vpc;
void *image;
int width, height;
int scan_bytes;
int pixel_type, image_type;
π ARGUMENTS π
vpcβ your VolPack context, the one you got fromvpCreateContext. your main character.imageβ a 2D array where the result image goes to live. it's the destination, it's the moment.widthβ width of that array, in pixels.heightβ height of that array, in pixels.scan_bytesβ how many bytes per scanline in the array. yes it's bytes not pixels, read the name bestie.pixel_typeβ a code that says what format each pixel in the array is in.image_typeβ a code that says where the image data is coming from. your two options areVP_IMAGE_BUFFERorVP_SHADOW_BUFFER. that's it, that's the menu.
π DESCRIPTION π
so this one is a debugging function, no cap. it's here so you can peek at one of the temporary rendering buffers used while rendering β specifically the intermediate image or the shadow buffer. π
here's the lore: rendering happens in two stages. first the volume gets resampled and composited into the intermediate image, which gives you a distorted volume rendering. then that intermediate image gets warped into the final image. and if shadows are enabled, the shadow buffer gets used during that first stage to incrementally compute which voxels are lit up by the light source. π‘
what this function hands you is the images produced during the first stage, before the final warp. so like, the behind-the-scenes cut, not the final edit. π¬
you can call this after calling one of the rendering routines (see vpRenderRawVolume(3)).
- if
image_typeisVP_IMAGE_BUFFER, data gets copied from the intermediate image. thepixel_typeargument says what info to copy and what format to store it in the output array. the possible values forpixel_typeare the same as for thepixel_typeargument tovpSetImage. for instance, useVP_LUMINANCEto extract the grayscale intensity (assuming the current shader produces grayscale pixels). - if
image_typeisVP_SHADOW_BUFFER, data gets copied from the shadow buffer instead. and here's the catch: the only valid option forpixel_typeisVP_ALPHA, because there's literally no color information stored in the shadow buffer. so don't try it. π
for the details on the pixel formats, the layout of the output array, and the remaining arguments β go read vpSetImage. she has the answers, I'm just the messenger. π¬
and to figure out how big your result array needs to be, use vpGeti with:
- the
VP_INTERMEDIATE_WIDTHandVP_INTERMEDIATE_HEIGHToptions (whenimage_typeisVP_IMAGE_BUFFER), or - the
VP_SHADOW_WIDTHandVP_SHADOW_HEIGHToptions (whenimage_typeisVP_SHADOW_BUFFER).
get the size first, then allocate. order of operations, periodt. π―
π ERRORS π
the normal return value is VP_OK. everything's fine, we're thriving, slay. π
the following error return values are possible:
VPERROR_BAD_SIZEβ the destination array size is incorrect, OR there is no intermediate image. either way, not the vibe. πVPERROR_BAD_OPTIONβ thefieldargument is invalid. π«
π¦ SEE ALSO π¦
and that's the whole page bestie!! π₯³ this one comes to you from the VolPack library manual β Library Functions Manual energy, vpGetImage(3) forever, mwah π go get those intermediate images, you've got this π«Άβ¨
π¦ where this page comes from
- debian bookworm: libvolpack1-dev 1.0b3-9 Β· BSD-3-Clause
- debian trixie: libvolpack1-dev 1.0b3-10 Β· BSD-3-Clause
- ubuntu jammy: libvolpack1-dev 1.0b3-9 Β· BSD-3-Clause
- ubuntu noble: libvolpack1-dev 1.0b3-9.1 Β· BSD-3-Clause
- ubuntu questing: libvolpack1-dev 1.0b3-11
- ubuntu resolute: libvolpack1-dev 1.0b3-11build1 Β· BSD-3-Clause
- ubuntu stonking: libvolpack1-dev 1.0b3-11build1 Β· BSD-3-Clause
- Copyright (c) 1994 The Board of Trustees of The Leland Stanford
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms