rendering 2D camera

Blitz3D Forums/Blitz3D Programming/rendering 2D camera

Bnesiba(Posted 2006) [#1]
when you use renderworld() do cameras using cameraprojmode(2) re-render?

i'm using a split screen (cameraviewport()) one orthographic and one normal. when i move some of the sprites in the orthographic view after they are rendered, in front of the other camera they are rendered in that "window" but are still in the cameraviewport of the orthographic camera...and havnt moved


Damien Sturdy(Posted 2006) [#2]
I'd post some code.

It sounds like you're moving them *forward* according to the orthographics camera, meaning they wont move in it but will in others.

Also, there's no need to post twice :)


Bnesiba(Posted 2006) [#3]
here's some code...
;create interface camera
icam = CreateCamera()
PositionEntity icam,0,0,0
RotateEntity icam,0,215,0
CameraViewport icam,0,640,840,480
CameraProjMode icam,2
CameraZoom icam,0.1
;create interface light
ilight = CreateLight()
PositionEntity ilight,0,50,0
RotateEntity ilight,40,215,0

bsprite = CreateSprite()
PositionEntity bsprite,-2.8,-.8,-10
ScaleSprite bsprite,3,6
ScaleTexture view,.9,.9
EntityTexture bsprite,view


lmsprite = CreateSprite()
ScaleSprite lmsprite,.15,.15
PositionEntity lmsprite,-4.92,3.44,-8
EntityTexture lmsprite,checkr

;other stuff

;main camera
cam = CreateCamera()
PositionEntity cam,0,0,0
CameraViewport cam,0,0,640,480
cube = LoadMesh(file$)
light = CreateLight()
tex = LoadTexture(tex$)
flortex = LoadTexture("images\floor.jpg")
ScaleTexture flortex,50,50
PositionEntity cam,0,0,0
PositionEntity cube,0,5,40
PositionEntity light,0,50,0
RotateEntity cube,30,20,0
RotateEntity light,40,0,0
ScaleEntity cube,3,3,3
EntityTexture cube,tex

;ScaleTexture tex,5,5
pln = CreatePlane()
EntityAlpha pln,0.5
EntityTexture pln,flortex
PositionEntity pln,10,-9,50
mir = CreateMirror()
PositionEntity mir,0,-10,0

whilde not keydown(1)

If mx>650 And my<58 And mx<684 And my>26
If MouseDown(1)
EntityTexture lmsprite,loadmd
Else
EntityTexture lmsprite,loadm
EndIf
EndIf

;stuff
renderworld()
flip
wend
end


then i have a while loop where it checks if you click a button i made, and if it does it changes the texture of the sprite (doesnt work).

so, i tried having it move sminsprite behind bsprite (this should make it invisible.. right?) i moved it so far i could see it in the main camera, but still see it with the orthographic one...

so, i dont think it's re-rendering, because when i push the button and have it change the texture of the floor plane that works fine, but if i have the sprite change texture nothing happens.




also, i created this post today, when after 20 hours noone had replied to my first one.


Stevie G(Posted 2006) [#4]
Your cameraviewports are screwed up .... assume your using a 1024, 960 resolution?

CameraViewport icam,0,640,840,480

This should be ....

CameraViewPort icam, 0, 640,480,480

Stevie


Bnesiba(Posted 2006) [#5]
i'm using 1024x768

and if i change the viewports my viewport gets messed up


Stevie G(Posted 2006) [#6]
Yes, but your Icam has a viewport height which goes past the bottom of the screen height ... 640 +480 > 768!! This will screwing up your rendering I think.

Stevie


Bnesiba(Posted 2006) [#7]
CameraViewport camera,x,y,width,height
Parameters
camera - camera handle
x - x coordinate of top left hand corner of viewport
y - y coordinate of top left hand corner of viewport
width - width of viewport
height - height of viewport


so my viewport's top left corner is 0,640 which is well within the screens limits, and the other is 840,480

which should be fine since my graphics setting was 840,480 (i just noticed.. is this what you meant by resolution?)


b32(Posted 2006) [#8]
Width and height are different then right and bottom.
So 0, 640, 840, 480 will define the area
(0, 640)- (840, 1120)


Stevie G(Posted 2006) [#9]
Yes, it is ... so you're not using 1024x768 your using 840x480 in windowed mode. e.g. Graphics3d 840,480,32,0?


Bnesiba(Posted 2006) [#10]
yes,

i think i figured it out though. i think cameraprojmode <camera>,2 doesnt re-render when you do renderworld()

when i turn off orthographic mode it renders fine and the texture changes as it is supposed to...

.:EDIT:.

ok, it was working.. and now it's not... is there a specific reason or something why a camera won't re-render?
when i do cls the cameraviewport turns black and doesnt re-render anything, including the plane that streches across the bottem of the world.

i am not using orthographic mode, and all of my meshes are closer than 12 distance from the camera.

..::EDIT::..
i got it working... thanks for all you guys' help