if u want 2d to stay on the screen all the time it has to be updated in the main loop always for it be present each displayed frame.
maybe u try something like this and instead of coloring the buttons place text on the screen in front of a color then grabbing a part of that into a texture location and texturing the button with text or images.
rem ------------------------------------------------------
rem 3D Button Functions by indi
rem
rem Button areas in the form of 3D Planes (plains)
rem DarkBasic Version 1.13 /Pro Patch2full
rem September 9 2002
rem ------------------------------------------------------
rem
rem
rem What does it Do???:
rem it automatically assigns a 3d plain as a button
rem it will also setup a mouse hot spot according
rem to the 3d button variables at the top of the code
rem
rem using these functions
rem
rem Make3D_btn(objnum,3d_btn_siz,3d_btn_x,3d_btn_y)
rem Place3Dbtn(objnum,X,Y)
rem Check3D_btn_(x1,x2,y1,y2,ms)
rem Delete3D_btn(objnum)
rem
rem easy to adapt for multiple buttons
rem
rem *** The Rotation and colouring
rem *** are just to show its usage
rem
rem What doesn't it Do???
rem It wont change its hotspot size if u wish to change the button
rem size dynamically in your project.
rem
rem
rem
rem
rem Functions By David Smith
rem Make3D_btn(3d_btn_siz,3d_btn_x,3d_btn_y)
rem Check3D_btn_(x1,x2,y1,y2,ms)
rem Delete3D_btn(objnum)
rem Function by Thomas Christ
rem Place3Dbtn(Object,X,Y)
rem ------------------------------------------------------
sync rate 0
sync on
randomize timer()
rem use arrays instead of variables in this example
3d_btn_x = 320
3d_btn_y = 240
3d_btn_siz = 150
3dbx1 = 3d_btn_x - (3d_btn_siz/2)
3dby1 = 3d_btn_y - (3d_btn_siz/2)
3dbx2 = 3d_btn_x + (3d_btn_siz/2)
3dby2 = 3d_btn_y + (3d_btn_siz/2)
Make3D_btn(1,3d_btn_siz,3d_btn_x,3d_btn_y)
rem temp main loop
do
Check3D_btn(3dbx1,3dbx2,3dby1,3dby2)
rem Output Debug
center text 320,20,"---==== 3D Buttons by indi ====---"
center text 320,40,"use mouse over square on screen"
center text 320,60,"mouse x "+STR$(mousex())
center text 320,80,"mouse y "+STR$(mousey())
center text object screen x(1)-90,object screen y(1)-40,"x1 " +STR$(3dbx1)
center text object screen x(1)-90,object screen y(1)-20,"y1 " +STR$(3dby1)
center text object screen x(1)+90,object screen y(1)+120,"x2 " +STR$(3dbx2)
center text object screen x(1)+90,object screen y(1)+140,"y2 " +STR$(3dby2)
rem safe exit
if inkey$()="q"
Delete3D_btn(1)
end
endif
sync
loop
rem ------------------------------------------------------
rem Make3D_btn(3d_btn_siz,3d_btn_x,3d_btn_y) Function By David Smith
rem ------------------------------------------------------
function Make3D_btn(objnum,3d_btn_siz,3d_btn_x,3d_btn_y)
make object plain objnum,3d_btn_siz,3d_btn_siz
lock object on objnum
Place3D_btn(objnum,3d_btn_x,3d_btn_y)
color object objnum,rgb(155,155,155)
endfunction
rem ------------------------------------------------------
rem Place3Dbtn(Object,X,Y) Function by Thomas Christ
rem ------------------------------------------------------
Function Place3D_btn(objnum,X,Y)
Width = Screen Width()/2
Height = Screen Height()/2
Z# = Screen Height()*0.83
Position Object objnum,(X-Width),(Height-Y),Z#
EndFunction
rem ------------------------------------------------------
rem Check3D_btn(x1,x2,y1,y2,ms) Function by David Smith
rem ------------------------------------------------------
Function Check3D_btn(3dbx1,3dbx2,3dby1,3dby2)
If mousex()>3dbx1 and mousex()<3dbx2 and mousey()>3dby1 and mousey()<3dby2 and mouseclick()=0
center text 320,460,"mouse over"
color object 1,rgb(55,155,55)
else
color object 1,rgb(155,155,155)
endif
If mousex()>3dbx1 and mousex()<3dbx2 and mousey()>3dby1 and mousey()<3dby2 and mouseclick()=1
center text 320,460,"left mouse click"
y = wrapvalue(y+1)
rotate object 1,0,y,0
color object 1,rgb(55,255,55)
endif
If mousex()>3dbx1 and mousex()<3dbx2 and mousey()>3dby1 and mousey()<3dby2 and mouseclick()=2
center text 320,460,"right mouse click"
y = wrapvalue(y+1)
rotate object 1,0,0,y
color object 1,rgb(55,255,255)
endif
If mousex()>3dbx1 and mousex()<3dbx2 and mousey()>3dby1 and mousey()<3dby2 and mouseclick()=3
center text 320,460,"both buttons"
y = wrapvalue(y+1)
rotate object 1,y,y,y
color object 1,rgb(rnd(255),rnd(255),rnd(255))
endif
Endfunction
rem ------------------------------------------------------
rem Delete3D_btn(objnum) Function By David Smith
rem ------------------------------------------------------
function Delete3D_btn(objnum)
delete object objnum
endfunction
http://www.lunarpixel.com/ is my new site