Back to main page

Draw surface

int DrawSurface_CreateFixed(int newWidth, int newHeight, int numberOfDepthBuffers, bool useExtraColorBuffer);

newWidth is the number of pixel columns.

newHeight is the number of pixel rows.

If numberOfDepthBuffers >= 1 then the draw surface can be rendered to with a camera.

If numberOfDepthBuffers >= 2 then soft particles can sample a copy of the depth buffer.

0 < newWidth ≤ 8192, 0 < newHeight ≤ 8192 and 0 <= numberOfDepthBuffers <= 2

Returns the ID to the new draw surface.

Creates a new draw surface of dimensions newWidth * newHeight.

int DrawSurface_CreateAutoSized(float widthMultiplier, float heightMultiplier, int widthAdder, int heightAdder, int numberOfDepthBuffers, bool useExtraColorBuffer);

Component width is the width in pixels of the area that show the engine's final result.

Component height is the height in pixels of the area that show the engine's final result.

0 < (component width * widthMultiplier) + widthAdder ≤ 8192, 0 <= numberOfDepthBuffers <= 2, 0 < (component height * heightMultiplier) + heightAdder ≤ 8192, 0 ≤ widthAdder ≤ 8192 and 0 ≤ heightAdder ≤ 8192

Returns the ID to the new draw surface.

Creates a new draw surface of dynamic dimensions ((component width * widthMultiplier) + widthAdder) * ((component height * heightMultiplier) + heightAdder).

int DrawSurface_GetFinalOutput(void);

Returns a constant but version depending ID to a draw surface used to show the final image. This ID can not be used to delete the draw surface. But you may render to it. Each render to the final draw surface causes the component to draw the result to the screen.

void DrawSurface_Delete(int DrawSurface);

DrawSurface is a valid draw surface but not the final draw surface.

The draw surface refered to by DrawSurface is deleted.

int DrawSurface_GetWidth(int DrawSurface);

DrawSurface is a valid draw surface.

The width of the draw surface refered to by DrawSurface.

int DrawSurface_GetHeight(int DrawSurface);

DrawSurface is a valid draw surface.

The height of the draw surface refered to by DrawSurface.

int DrawSurface_IsAutoSized(int DrawSurface);

DrawSurface is a valid draw surface.

Returns 1 if the draw surface refered to by DrawSurface is automatically resized according to the final image and 0 otherwise.

int DrawSurface_GetNumberOfDepthBuffers(int DrawSurface);

This method replaced DrawSurface_HasDepthBuffer to allow soft particles to read a copy of the depth buffer as a global texture.

DrawSurface is a valid draw surface.

Returns the number of depth buffers in the draw surface refered to by DrawSurface. Having at least 1 depth buffer allow a camera to render the scene to it. Having at least 2 depth buffers allow a camera to render soft particles.

int DrawSurface_HasExtraColorBuffer(int DrawSurface);

DrawSurface is a valid draw surface.

Returns 1 if the draw surface refered to by DrawSurface has an extra color buffer and 0 otherwise. This property allow using the draw surface as both input and output at the same time by taking the most recently modified surface as input and draw to the older surface.

void DrawSurface_GetPixelColor_OutV4(int DrawSurface, int X, int Y);

This call is extremely slow because memory have to be moved from the graphics card to the CPU. Only use this a few time per render. If you need to get a draw surface's average, minimum or maximum intensity, downsample using multisampling post effects until you have the average in a 1x1 draw surface and take the result from the only pixel to the CPU.

DrawSurface is a valid draw surface but not the final draw surface. 0 ≤ X < Width, 0 ≤ Y < Height.

The RGBA color from DrawSurface at X,Y is stored in (X1,Y1,Z1,W1). Draw surfaces that haven't been written to since it's last creation or automatic resizing will give (0,0,0,0).

void DrawSurface_SetPixelColor(int DrawSurface, int X, int Y, float Red, float Green, float Blue, float Alpha);

DrawSurface is a valid draw surface but not the final draw surface. 0 ≤ X < Width, 0 ≤ Y < Height.

The RGBA color in DrawSurface at X,Y is changed to (X1,Y1,Z1,W1).

int DrawSurface_SaveToFile_InSB(int DrawSurface);

For images that must be preserved exactly as they are, use the DDS file format. Otherwise you might be limited by annoying rounding, clamping and gamma correction.

A screenshot should use BMP (Large), JPG (Looks like shit) or PNG (Slow) because it does not matter when it will only be seen by a user.

A height, displacement, bump or normal map should use DDS because gamma correction is terrible for values that are not even colors. You might want to use the "DirectX Texture Tool" to use 16 bits per channel or remove unused channels.

DrawSurface is a valid draw surface but not the final draw surface and the string buffer must contain a valid filename ending with ".DDS", ".BMP", ".PNG" or ".JPG".

Tries to save a copy of DrawSurface to an image file named by a filename in the string buffer.

Returns 1 if the file was saved and 0 otherwise.

void DrawSurface_FillWithColor(int DrawSurface, float Red, float Green, float Blue, float Alpha);

This method does exactly the same thing as CPUSurface_FillWithColor.

Calling Camera_RenderScene will do this with the background color before rendering things.

Use it before calling Camera_RenderInstance with UseDepthBuffer set to true to avoid seeing the previous render.

DrawSurface is a valid draw surface.

All pixels in DrawSurface is set to the color (Red,Green,Blue,Alpha).

void DrawSurface_ClearDepthBuffer(int DrawSurface);

Calling Camera_RenderScene will do this before rendering things.

Use it before calling Camera_RenderInstance with UseDepthBuffer set to true to avoid being occluded by things from the previous render.

This method is only useful together with Camera_RenderInstance.

DrawSurface is a valid draw surface.

The depth buffer in DrawSurface is set to maximum depth.