Danmit! i cant seem to get a cube to do cubemapping!
my card does support it cos a demo has worked
BUT i do this
water=createcube()
cubetex = createtexture(64,64,128)
entitytexture water,cubetex
and then use this function
Function UpdateCubemap(tex,camera,entity)
tex_sz=TextureWidth(tex)
; Show the camera we have specifically created for updating the cubemap
ShowEntity camera
; Hide entity that will have cubemap applied to it. This is so we can get cubemap from its position, without it blocking the view
HideEntity entity
; Position camera where the entity is - this is where we will be rendering views from for cubemap
PositionEntity camera,EntityX#(entity),EntityY#(entity),EntityZ#(entity)
CameraClsMode camera,False,True
; Set the camera's viewport so it is the same size as our texture - so we can fit entire screen contents into texture
CameraViewport camera,0,0,tex_sz,tex_sz
; Update cubemap
; do left view
SetCubeFace tex,0
RotateEntity camera,0,90,0
RenderWorld
CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)
;; do forward view
SetCubeFace tex,1
RotateEntity camera,0,0,0
RenderWorld
CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)
; do right view
SetCubeFace tex,2
RotateEntity camera,0,-90,0
RenderWorld
CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)
; do backward view
SetCubeFace tex,3
RotateEntity camera,0,180,0
RenderWorld
CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)
; do up view
SetCubeFace tex,4
RotateEntity camera,-90,0,0
RenderWorld
CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)
; do down view
SetCubeFace tex,5
RotateEntity camera,90,0,0
RenderWorld
CopyRect 0,0,tex_sz,tex_sz,0,0,BackBuffer(),TextureBuffer(tex)
; Show entity again
ShowEntity entity
; Hide the cubemap camera
HideEntity camera
End Function
but the water dissapears and looks liek nothing is there?
|