How to mix graphic images and 3d images

Blitz3D Forums/Blitz3D Programming/How to mix graphic images and 3d images

Amanda Dearheart(Posted 2009) [#1]
Unfortunately, I left my code at home today, but I'm having a problem with with it.

I'm trying to use 2D images (y'know with the ImageLoad command) and 3d models with the LoadMesh command in the graphics3D mode. I'm trying to mix them together on the same screen, but it won't work properly.

I've placed them both in separate functions (Like in the following pseudocode)

function LOADIMAGES()
image = LOADIMAGE("image")
viewport 10, 100, 40, 50
drawimage image, 10, 100
viewport 0, 0, 800, 600
flip
end function

function LOADMODELS()
model = loadmesh("model")
positionmesh model, 100, 110
renderworld
flip
end function

If I do it this way, the models will erase the images. If I reverse the functions, the images will erase the models.

If I try to put them all in one function like this :

function LOADIMAGES()
image = LOADIMAGE("image")
viewport 10, 100, 40, 50
drawimage image, 10, 100
viewport 0, 0, 800, 600

model = loadmesh("model")
positionmesh model, 100, 110
renderworld
flip
end function

the code doesn't work at all!

any help would be appreciated!


Warner(Posted 2009) [#2]
Try it this way:



Midimaster(Posted 2009) [#3]
at first you create and render the 3d world

in the second step you draw images, texts, rect etc over them

at last you flip the backbuffer

graphics3d 800,600
camera=create camera
cube=createcube()
repeat
    mouse and keys
    move entitys....
    
    updateworld
    renderworld
    
    drawimage...
    text...
    flip
forever