dxGraphics3D 640,480 dxSetBuffer dxBackBuffer() dxSeedRnd MilliSecs() ; create camera camera=dxCreateCamera() dxCameraClsColor camera,160,160,160 dxPositionEntity camera,0,0,-30 middle=dxCreatePivot() dxEntityParent camera,middle ; create add texture - white cirlce on a black background For n=0 To 50 dxColor 5+(n*5),5+(n*5),5+(n*5) dxOval 10+n,10+n,236-(n*2),236-(n*2),1 Next blob_tex=dxCreateTexture(256,256) blob=dxCreateImage(256,256) GrabImage blob,0,0 dxCopyRect 0,0,256,256,0,0,dxImageBuffer(blob),dxTextureBuffer(blob_tex) dxFreeImage blob max_blobs=100 ; create blobs using add blend mode Dim blobs(max_blobs) ; blob sprites Dim xyblobs#(max_blobs,2) ; blob vector For n=0 To max_blobs blobs(n)=dxCreateSprite() dxEntityFX blobs(n),1 dxEntityBlend blobs(n),3 ;set blend mode to add dxEntityTexture blobs(n),blob_tex xyblobs(n,0)=dxRnd(-.1,.1) xyblobs(n,1)=dxRnd(-.1,.1) xyblobs(n,2)=dxRnd(-.1,.1) dxEntityColor blobs(n),dxRand(0,255),dxRand(0,255),dxRand(0,255) ;give it a colour Next ; create cube texture dxColor 255,255,255 dxRect 0,0,256,256,1 For n=0 To 7 If n=0 Then dxColor 0,0,0 If n=1 Then dxColor 0,0,255 If n=2 Then dxColor 0,255,0 If n=3 Then dxColor 0,255,255 If n=4 Then dxColor 255,0,0 If n=5 Then dxColor 255,0,255 If n=6 Then dxColor 255,255,0 If n=7 Then dxColor 255,255,255 dxRect n*32,n*32,32,32,1 Next dxColor 0,0,0 For n=0 To 255 Step 32 dxLine 0,n,255,n dxLine n,0,n,255 Next cube_tex=dxCreateTexture(256,256) cube=dxCreateImage(256,256) GrabImage cube,0,0 dxCopyRect 0,0,256,256,0,0,dxImageBuffer(cube),dxTextureBuffer(cube_tex) dxFreeImage cube ; create cube cube=dxCreateCube() dxScaleEntity cube,11,11,11 dxEntityTexture cube,cube_tex dxEntityFX cube,17 ;set fullbright and 2 sided textures dxEntityBlend cube,2 ;set multiply blend Repeat ; move the blobs around For n=0 To max_blobs dxMoveEntity blobs(n),xyblobs(n,0),xyblobs(n,1),xyblobs(n,2) ;bounce off sides If dxEntityX(blobs(n))<-10 Or dxEntityX(blobs(n))>10 Then xyblobs(n,0)=-xyblobs(n,0) If dxEntityY(blobs(n))<-10 Or dxEntityY(blobs(n))>10 Then xyblobs(n,1)=-xyblobs(n,1) If dxEntityZ(blobs(n))<-10 Or dxEntityZ(blobs(n))>10 Then xyblobs(n,2)=-xyblobs(n,2) Next ; turn camera dxTurnEntity middle,.1,.2,.3 dxUpdateWorld dxRenderWorld dxFlip Until dxKeyHit(1)