Hi , I'm DarkBasic Begineer .
I try to test terrain with flashlight . But I get that error "Runtime Error 7029 - 3D Memory Error at line " why I got this error .I don't understand
.Please help me .This is my [/
set display mode 1024,768,32
color backdrop rgb(0,0,0)
backdrop on
autocam off
sync on
sync rate 30
global Brightness as float
global Light as float
position camera 0,4,-50
point camera 0,0,0
load image "media/spotlight.png",5
load effect "FX/FlashLight.fx",6,0
load object "TerrianWithLimb/TerrainwithLight.dbo",1
set object effect 1,6
texture object 1,2,5
`Brightness
Brightness#=0
Light=0
`Light Vectors
Global ActiveLights
r=make vector4(1)
r=make vector3(2)
r=make matrix4(3)
r=make matrix4(4)
r=make vector3(5)
r=make vector3(6)
r=make vector3(7)
do
Control camera using arrowkeys 0,0.5,0.5
if KEYSTATE(33)=1 and NoPressF=0 and Light=0 then Light=1:NoPressF=1
if KEYSTATE(33)=1 and NoPressF=0 and Light=1 then Light=0:NoPressF=1
if Light=0 then Brightness#=Brightness#-0.1
if Light=1 then Brightness#=Brightness#+0.1
if Brightness#>4.0 then Brightness#=4.0
if Brightness#<0.0 then Brightness#=0.0
set effect constant float 6,"BrightNess",Brightness#
if KEYSTATE(33)=0 then NoPressF=0
if Brightness#>0.0
set vector4 1,camera position x(),camera position y(),camera position z(),0
set effect constant vector 6,"LightPosition",1
angX#=curveangle(camera angle x(),angX#,4)
angY#=curveangle(camera angle Y(),angY#,4)
rotate x matrix4 3,wrapvalue(angX#)/57.3
rotate y matrix4 4,wrapvalue(angY#)/57.3
multiply matrix4 3,3,4
set vector3 2,0,0,1
transform normals vector3 2,2,3
set vector3 5,0,0,0
set vector3 6,x vector3(2),y vector3(2),z vector3(2)
set vector3 7,0,1,0
build lookat lhmatrix4 3,5,6,7
build fov lhmatrix4 4,1,1,1,5000
multiply matrix4 3,3,4
set effect constant matrix 6,"LightProjMatrix",3
endif
if scancode()=0 then NoPress=0
Update_DynamicLights()
sync
loop
end
Function Set_DynamicLight(LposX#,LposY#,LposZ#,ColR#,ColG#,ColB#,Range#)
ActiveLights=ActiveLights+1
if ActiveLights>6 then ActiveLight=6
set vector4 1,LposX#,LposY#,LposZ#,0
set effect constant vector 1,"LightPosition_"+str$(ActiveLights),1
set vector4 1,ColR#/255,ColG#/255,ColB#/255,0
set effect constant vector 1,"LightColor_"+str$(ActiveLights),1
set effect constant float 1,"LightRange_"+str$(ActiveLights),Range#
Endfunction
`----------------------------------------------------
Function Update_DynamicLights()
set effect technique 6,"Light"+str$(ActiveLights)
ActiveLights=0
Endfunction]
And this is my terrain.I create this terrain as dbo format.
[/code
set display mode 1024,768,32
color backdrop rgb (0,0,0)
backdrop on
autocam off
sync on
sync rate 60
global X as integer
global Y as float
global Z as integer
global cx as float
global cy as float
global cz as float
#constant T 1 `make terrain
position camera 1566,7,1880
point camera 0,0,0
Create_Terrain_Limb()
do
control camera using arrowkeys 0,5,1
text 50,50,str$(camera position x())
text 50,60,str$(camera position y())
text 50,70,str$(camera position z())
`save object "TerrainwithLight.dbo",1
sync
loop
end
function Create_Terrain_Limb()
#constant MesTer 1
#constant rootobj 1
xscale#=12: yscale#=1.0: zscale#=12
make object terrain 1 ` create the terrain object
set terrain heightmap 1, "map.bmp" ` set the heightmap
set terrain scale 1, xscale#, yscale#, zscale# ` set the scale
set terrain split 1, 16 ` split value by 16 * 16
set terrain tiling 1, 16 ` detail map tiling
set terrain light 1, 1, -0.25, 0, 1, 1, 0.78, 0.5 ` light - xdir, ydir, zdir, red, green, blue, intensity
set terrain texture 1, 1, 2 ` base and detail texture
build terrain 1 ` finally build the terrain
set object filter 1,2
load image "terrain/grass1s.png",1
make mesh from object MesTer,1
delete object 1
make object sphere rootobj,0
add limb 1,1,MesTer
texture limb 1,1,1
set object normals 1
endfunction]
Please help me ,explain me and teach me
.Sorry for my poor English Skill.