2d images with Graphics3d
Blitz3D Forums/Blitz3D Beginners Area/2d images with Graphics3d
| ||
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. |
| ||
Any code to demonstrate whats happening? |
| ||
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? |
| ||
[code] |
| ||
Whuzzat? |
| ||
http://blitzbasic.com/faq/faq_entry.php?id=2 |
| ||
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? |
| ||
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) WendMaybe it's defaulting to the backbuffer? Try using a Flip and see what happens. |
| ||
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. |
| ||
That makes sense. thanks. |