vpGetImage(3)
π vpGetImage(3) π
okay so bestie, we're in section 3 of the VolPack Library Functions Manual today and the vibe is debugging, so buckle up π
β¨ NAME β¨
vpGetImage β grab yourself 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β the VolPack context you got fromvpCreateContext. your main character π«Άimageβ a 2D array where the result image gets stored. it's the canvas, she's ready πwidthβ how wide the array is, in pixels.heightβ how tall the array is, in pixels.scan_bytesβ how many bytes there are per scanline in the array.pixel_typeβ a code saying what format each pixel in the array is in.image_typeβ a code saying where the image data is coming from: eitherVP_IMAGE_BUFFERorVP_SHADOW_BUFFER.
π DESCRIPTION π
so this one is a debugging function, periodt. what she does is pull the contents of one of the temporary rendering buffers that get used during rendering β specifically the intermediate image or the shadow buffer.
let's talk about how rendering works here, because it's literally two stages:
- the volume gets resampled and composited into the intermediate image, which gives you a distorted volume rendering β¨
- then the intermediate image gets warped into the final image π«
and if shadows are turned on, the shadow buffer is used during that first stage to incrementally compute which voxels are lit up by the light source. so this function gives you the images from the first stage, before the final warp even happens. no cap.
you can call this after one of the rendering routines (peep vpRenderRawVolume(3) for that).
- if
image_typeisVP_IMAGE_BUFFER, data gets copied out of the intermediate image. - if
image_typeisVP_SHADOW_BUFFER, data gets copied out of the shadow buffer.
the pixel_type argument says what info to copy and what format to store it in inside the output array. the valid values for pixel_type are the exact same ones as for the pixel_type argument to vpSetImage. for example, use VP_LUMINANCE to extract the grayscale intensity (that's assuming your current shader is producing grayscale pixels, bestie πΈ).
β οΈ heads up: whenimage_typeisVP_SHADOW_BUFFER, the only valid option forpixel_typeisVP_ALPHA, because there's no color information stored in the shadow buffer at all. so don't try it, she won't play π
for the deets on pixel formats, the layout of the output array, and the rest of the arguments β go read vpSetImage.
and to figure out how big your result array needs to be, use vpGeti with:
VP_INTERMEDIATE_WIDTHandVP_INTERMEDIATE_HEIGHTwhenimage_typeisVP_IMAGE_BUFFERVP_SHADOW_WIDTHandVP_SHADOW_HEIGHTwhenimage_typeisVP_SHADOW_BUFFER
π ERRORS π
the normal return value is VP_OK β she ate, no notes π
these are the error return values that can show up:
VPERROR_BAD_SIZEβ the destination array size is wrong, or there's just no intermediate image to speak of. πVPERROR_BAD_OPTIONβ thefieldargument is invalid. π«
π SEE ALSO π
VolPack(3), vpRenderRawVolume(3), vpGeti(3)
and that's the whole page, bestie π«Ά this one comes to you courtesy of VolPack and lives at vpGetImage(3). no date on this one, so consider this your timeless lil sign-off πβ¨
π¦ where this page comes from
- fedora 43: volpack 1.0c7-35.fc43 Β· BSD-3-Clause
- fedora 43: volpack 1.0c7-35.fc43 Β· BSD-3-Clause
- fedora 44: volpack 1.0c7-36.fc44 Β· BSD-3-Clause
- fedora 44: volpack 1.0c7-36.fc44 Β· BSD-3-Clause
- Copyright (c) 1995-2008, Stanford University
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms