News:

Function Finder  Find all the functions within source code files

Main Menu

rendertoimage won't work in my code? help.

Started by stevmjon, September 09, 2007, 10:55:36 PM

Previous topic - Next topic

stevmjon

hello

    if i open a new project and use rendertoimage, it works perfectly.  i am using V1.63n / IDE 1.15f .  BUT, in my own code i cannot get it to work properly. is there an instance or condition it won't work? if so, i must be doing it without knowing.
 
what happens is i can cls rgb(), and this works, but any graphics like dot/line etc are all drawn to the main screen and not to the image. i make sure that the image index no. is greater than zero. why would the colour be in the image, but nothing else?

here is a brief approximate outlay of where it is in my code:

do
rendertoscene
clear scene
some code
capture depth 3
gosub new_image_here:
draw all sprites
draw camera 1
loop

new_image_here:
rendertoimage 9
cls rgb()  *works perfectly
line   *doesnt work* this draws to the main screen
dots  *doesnt work* this draws to the main screen
render to scene
return

any advice or pointers would be appreciated.

  thanks  stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin

#1
 If capture mode is enabled, they you'll have to disable it before rendering to a different surface.

PlayBASIC Code: [Select]
 ; create a new camera. Which will be attached to the current surface (the screen) 
MyCamera=Newcamera()


; create a new image
MyImage=Newimage(200,200)

; start of main loop
Do
; Capture all draw events to the scene cache
CapturetoScene

; Clear the Scene cache
ClsScene

; call a routine to draw to an different surface
gosub DRawingStuffToImage

; draw (capture) this image to the scene Capture
drawimage MyImage,mousex(),mousey(),false

; Draw all the items in the scene through this camera
drawcamera MyCamera

Sync
loop



DrawingStuffToImage:
; Enable immediate rendering, rather than caching
DrawGFXimmediate
; direct all draw to this image
RendertoImage MyImage

; draw stuff directly to my image
Circlec rnd(100),rnd(100),rnd(10),true,rndrgb()

; Restore Capture mode before returning to the main loop
CaptureToScene
return





stevmjon

thank you very much kevin.

it now makes sense to me. i spent a whole day wracking my head around this.

much appreciated,  stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.