2d images with Graphics3d

Blitz3D Forums/Blitz3D Beginners Area/2d images with Graphics3d

Cousin Gilgamesh(Posted 2006) [#1]
Hi, I'm trying to use a 2d overlay for the text in my 3d game. The text engine works really great in my test environment, but when I use the ScaleImage function to account for variable screen resolution WHILE I call Graphics3d, the program flops... black screen. It works great when I use the Graphics function instead of Graphics3d, but I need it to work in graphics3d so that I can run my game. Is there some sort of incompatability between graphics3d and scaleimage? because it only doesn't work if I use both.


Ross C(Posted 2006) [#2]
Any code to demonstrate whats happening?


Cousin Gilgamesh(Posted 2006) [#3]
ok...

Graphics 640, 480

image = LoadImage("mountainst.jpg")
ScaleImage image, 1.5, 1.5

DrawImage image, 20, 20

While Not KeyHit(1)

Wend


Just ScaleImage, Graphics, works. then...

Graphics3D 640, 480

image = LoadImage("mountainst.jpg")

DrawImage image, 20, 20

While Not KeyHit(1)

Wend


Graphics3d, no scaleimage, works... but then...

Graphics3D 640, 480

image = LoadImage("mountainst.jpg")
ScaleImage image, 1.5, 1.5

DrawImage image, 20, 20

While Not KeyHit(1)

Wend


Graphics3d and ScaleImage used together, black screen. Does that help?


octothorpe(Posted 2006) [#4]
[code]


Cousin Gilgamesh(Posted 2006) [#5]
Whuzzat?


octothorpe(Posted 2006) [#6]
http://blitzbasic.com/faq/faq_entry.php?id=2


Cousin Gilgamesh(Posted 2006) [#7]
Alright... thanks... but you guys are asnwering everything except the question I asked first. All I want to know is, why does the code snipet not work while the first two snippets do?


WolRon(Posted 2006) [#8]
This appears to work:
Graphics3D 640, 480

;image = LoadImage("mountainst.jpg")
image = CreateImage(300, 200)
SetBuffer ImageBuffer(image)
Line 0, 0, 300, 200
SetBuffer FrontBuffer()

ScaleImage image, 1.5, 1.5

DrawImage image, 20, 20

While Not KeyHit(1)

Wend
Maybe it's defaulting to the backbuffer? Try using a Flip and see what happens.


octothorpe(Posted 2006) [#9]
Yes, Graphics3D sets the active buffer to the back buffer. Just Flip() when you're finished rendering (and drawing) a frame. You'll need to Cls() too if you're not RenderWorld()ing.


Cousin Gilgamesh(Posted 2006) [#10]
That makes sense. thanks.