texture - texture handle frame (optional) - texture frame |
Returns the handle of a texture's drawing buffer. This can be used with dxSetBuffer to perform 2D drawing operations to the texture, although it's usually faster to draw to an image, and then copy the image buffer across to the texture buffer using dxCopyRect. You cannot render 3D to a texture buffer; 3D can only be rendered to the back buffer. To display 3D graphics on a texture, use dxCopyRect to copy the contents of the back buffer to a texture buffer. |
; dxTextureBuffer Example ; --------------------- dxGraphics3D 640,480 dxSetBuffer dxBackBuffer() camera=dxCreateCamera() light=dxCreateLight() dxRotateEntity light,90,0,0 cube=dxCreateCube() dxPositionEntity cube,0,0,5 ; Create texture of size 256x256 tex=dxCreateTexture(256,256) ; Set buffer - texture buffer dxSetBuffer dxTextureBuffer(tex) ; Clear texture buffer with background white dxColor dxClsColor 255,255,255 dxCls ; Draw dxText on texture font=dxLoadFont("arial",24) dxSetFont font dxColor 0,0,0 dxText 0,0,"This texture" dxText 0,40,"was created using" : dxColor 0,0,255 dxText 0,80,"dxCreateTexture()" : dxColor 0,0,0 dxText 0,120,"and drawn to using" : dxColor 0,0,255 dxText 0,160,"dxSetBuffer dxTextureBuffer()" ; Texture cube with texture dxEntityTexture cube,tex ; Set buffer - dxBackBuffer dxSetBuffer dxBackBuffer() While Not dxKeyDown( 1 ) pitch#=0 yaw#=0 roll#=0 If dxKeyDown( 208 )=True Then pitch#=-1 If dxKeyDown( 200 )=True Then pitch#=1 If dxKeyDown( 203 )=True Then yaw#=-1 If dxKeyDown( 205 )=True Then yaw#=1 If dxKeyDown( 45 )=True Then roll#=-1 If dxKeyDown( 44 )=True Then roll#=1 dxTurnEntity cube,pitch#,yaw#,roll# dxRenderWorld dxFlip Wend End |