Here is the error recreated
I made a simple flag you can set to true and false to see wath works and wath dont
I only hope you dont find it to be an Cliff error
setsyncrate(0,1)
Setvirtualresolution(640,480)
cubeSize=64
REM // change this to false to get the one that appends the file and work
REM move forward to the far end so will you also se the error in the object that appears when it dont work
this_dont_work=1
if this_dont_work=1 // This one gets weird results
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
ObjFile=OpenToWrite("temp.obj")
Add_Plane_Floor_bad_(ObjFile,64,20,20)
obj=LoadObject("temp.obj")
setobjectposition(obj,64,0,64)
CloseFile(ObjFile)
else // this one work
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_Plane_Floor(64,20,20)
obj=LoadObject("temp.obj")
setobjectposition(obj,64,0,64)
endif
SetObjectColor(obj,255,255,255,255)
SetCameraPosition( 1, 0, 0, 0-100 )
SetCameraRotation( 1, 0, 0, 0 )
loadimage(1,"texture.png")
setobjectimage(obj,1,0)
do
GFT#=GetFrameTime()
if GetDirectionY() <0.0 then movecameralocalz(1,200.0*GFT#)
if GetDirectionY() >0.0 then movecameralocalz(1,-(200.0*GFT#))
if GetDirectionX() >0.0 then Rotatecameralocaly(1,200.0*GFT#)
if GetDirectionX() <0.0 then RotatecameralocalY(1,-(200.0*GFT#))
print(screenfps())
Print(GetPolygonsDrawn() )
Print(GetCamerax(1) )
Print(GetCameraz(1) )
Sync()
loop
REM // this one dont work and gets scrambled at the end
Function Add_Plane_Floor_Bad_(fileID,scalus#,Width,Height)
Blank$=str(0.000000)
xNega#=-((scalus#/2)+0.000000)
xPosi#=(scalus#/2)+0.000000
zNega#=-((scalus#/2)+0.000000)
zPosi#=(scalus#/2)+0.000000
for x=0 to Width
xNega#=-((scalus#/2)+0.000000)
xPosi#=(scalus#/2)+0.000000
for y=0 to Height
inc planeCount
xNega$=str(xNega#)
xPosi$=str(xPosi#)
zNega$=str(zNega#)
zPosi$=str(zPosi#)
yHeight#=0.000000
yHeight#=-32
yHeight$=str(yHeight#)
WriteLine(fileID,"v "+ xNega$ +" "+ yHeight$ +" "+ zNega$)
WriteLine(fileID,"v "+ xNega$ +" "+ yHeight$ +" "+ zPosi$)
WriteLine(fileID,"v "+ xPosi$ +" "+ yHeight$ +" "+ zPosi$)
WriteLine(fileID,"v "+ xPosi$ +" "+ yHeight$ +" "+ zNega$)
yHeight#=32
yHeight$=str(yHeight#)
WriteLine(fileID,"v "+ xNega$ +" "+ yHeight$ +" "+ zPosi$)
WriteLine(fileID,"v "+ xNega$ +" "+ yHeight$ +" "+ zNega$)
WriteLine(fileID,"v "+ xPosi$ +" "+ yHeight$ +" "+ zNega$)
WriteLine(fileID,"v "+ xPosi$ +" "+ yHeight$ +" "+ zPosi$)
xNega#=xNega#+scalus#
xPosi#=xPosi#+scalus#
if random(0,1)=1
WriteLine(fileID,"vt 0 1 0" )
WriteLine(fileID,"vt 0 0 0" )
WriteLine(fileID,"vt 1 0 0" )
WriteLine(fileID,"vt 1 1 0" )
else
WriteLine(fileID,"vt 0.5 1 0" )
WriteLine(fileID,"vt 0.5 0.5 0" )
WriteLine(fileID,"vt 1 0.5 0" )
WriteLine(fileID,"vt 1 1 0" )
endif
WriteLine(fileID,"vt 0 1 0" )
WriteLine(fileID,"vt 0 0 0" )
WriteLine(fileID,"vt 1 0 0" )
WriteLine(fileID,"vt 1 1 0" )
next y
zNega#=zNega#-scalus#
zPosi#=zPosi#-scalus#
next x
f1=1
f2=f1+f1
f3=f1+f1+f1
f4=f1+f1+f1+f1
for t=1 to planeCount
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4
inc f2,4
inc f3,4
inc f4,4
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4
inc f2,4
inc f3,4
inc f4,4
next t
endfunction
REM // this one works when i append and close the file when writing
Function Add_Plane_Floor(scalus#,Width,Height)
Blank$=str(0.000000)
xNega#=-((scalus#/2)+0.000000)
xPosi#=(scalus#/2)+0.000000
zNega#=-((scalus#/2)+0.000000)
zPosi#=(scalus#/2)+0.000000
for x=0 to Width
fileID=OpenToWrite("temp.obj",1)
xNega#=-((scalus#/2)+0.000000)
xPosi#=(scalus#/2)+0.000000
for y=0 to Height
inc planeCount
xNega$=str(xNega#)
xPosi$=str(xPosi#)
zNega$=str(zNega#)
zPosi$=str(zPosi#)
yHeight#=0.000000
yHeight#=-32
yHeight$=str(yHeight#)
WriteLine(fileID,"v "+ xNega$ +" "+ yHeight$ +" "+ zNega$)
WriteLine(fileID,"v "+ xNega$ +" "+ yHeight$ +" "+ zPosi$)
WriteLine(fileID,"v "+ xPosi$ +" "+ yHeight$ +" "+ zPosi$)
WriteLine(fileID,"v "+ xPosi$ +" "+ yHeight$ +" "+ zNega$)
yHeight#=32
yHeight$=str(yHeight#)
WriteLine(fileID,"v "+ xNega$ +" "+ yHeight$ +" "+ zPosi$)
WriteLine(fileID,"v "+ xNega$ +" "+ yHeight$ +" "+ zNega$)
WriteLine(fileID,"v "+ xPosi$ +" "+ yHeight$ +" "+ zNega$)
WriteLine(fileID,"v "+ xPosi$ +" "+ yHeight$ +" "+ zPosi$)
xNega#=xNega#+scalus#
xPosi#=xPosi#+scalus#
if random(0,1)=1
WriteLine(fileID,"vt 0 1 0" )
WriteLine(fileID,"vt 0 0 0" )
WriteLine(fileID,"vt 1 0 0" )
WriteLine(fileID,"vt 1 1 0" )
else
WriteLine(fileID,"vt 0.5 1 0" )
WriteLine(fileID,"vt 0.5 0.5 0" )
WriteLine(fileID,"vt 1 0.5 0" )
WriteLine(fileID,"vt 1 1 0" )
endif
WriteLine(fileID,"vt 0 1 0" )
WriteLine(fileID,"vt 0 0 0" )
WriteLine(fileID,"vt 1 0 0" )
WriteLine(fileID,"vt 1 1 0" )
next y
CloseFile(fileID)
zNega#=zNega#-scalus#
zPosi#=zPosi#-scalus#
next x
f1=1
f2=f1+f1
f3=f1+f1+f1
f4=f1+f1+f1+f1
fileID=OpenToWrite("temp.obj",1)
for t=1 to planeCount
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4
inc f2,4
inc f3,4
inc f4,4
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4
inc f2,4
inc f3,4
inc f4,4
next t
CloseFile(fileID)
endfunction
texture neaded is included.
Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz