LoadImage and problem with video memory

Blitz3D Forums/Blitz3D Beginners Area/LoadImage and problem with video memory

sulusgames(Posted 2006) [#1]
Hi All,

I've tested my game in low-end PCs with 8mb( this size have a lot casual players :( ) video memory size, and got an error. I checked and found problem in using of the video memory , when i use LoadImage, this function load the images to Video Memory.
and i have question: Can load image to the RAM not Video Memory(With other DLL too)?

Thanks


Dreamora(Posted 2006) [#2]
LoadImage should load to RAM and not VRAM.
Only textures end in VRAM.

Sure you haven't done anything else to fill up VRAM?

Like doing Graphics3D with SetBuffer BackBuffer() and flip 0 or things like that?

What resolution was used? (Because with backbuffer, 1280x1024 would be more than this card can handle at all)


sulusgames(Posted 2006) [#3]
Thanks for reply
The game always use 800x600 resolution, Screen's bit per pixel(BPP) the game get from main screen, because the game use window mode.
I have checked with TotalVidMem() - AvailVidMem() after loading each image, and saw that VRAM using was increased.


sulusgames(Posted 2006) [#4]
Any ideas?


H&K(Posted 2006) [#5]
No.

Post the smallest runnable code that can do this.


Matty(Posted 2006) [#6]
There are alternatives to loading images using the loadimage command. You can store RGB data in a bank and write images pixel by pixel to the screen, which when done in the right manner can be quite fast - although you are using blitz3d which is not really quick enough for doing it that way however blitzplus can write individual pixels much faster than blitz3d which is what I use (blitzplus).


sulusgames(Posted 2006) [#7]
here a code of the diplay initialization

; Get a HND
options\blitz_hnd = api_FindWindow("Blitz Runtime Class", "The Game v" + version)
; Get a HDC
hdc% = api_GetDC(options\blitz_hnd)
; GET a Desktop BPP
options\desk_bpp = api_GetDeviceCaps(hdc, 12)

If Windowed3D()
 options\Gfx_Mode3D = "GfxMode3DExists( 800, 600, "+options\desk_bpp+") is 3D-capable"
 Graphics3D 800, 600,0, 3
Else
 options\Gfx_Mode3D =  "GfxMode3DExists( 800, 600, "+options\desk_bpp+") is NOT 3D-capable"
 ; If this 16 bit then Show Error Message
 If options\desk_bpp = 16
  RuntimeError(options\Gfx_Mode3D)
  End
 EndIf
 ; 24 or 32 bit, Change Screen BPP to 16 bit
 If options\desk_bpp <> 16
  api_SetDisplay(api_GetSystemMetrics(SM_CXSCREEN), api_GetSystemMetrics(SM_CYSCREEN), 16)
 EndIf
 ; 16 bit
 If Windowed3D()
  options\Gfx_Mode3D = "GfxMode3DExists( 800, 600,16) is  3D-capable"
  Graphics3D 800, 600,0, 3
 Else
  options\Gfx_Mode3D = "GfxMode3DExists( 800, 600,16) is NOT 3D-capable"
  RuntimeError(options\Gfx_Mode3D)
  End
 EndIf
EndIf




sulusgames(Posted 2006) [#8]
Thanks Matty :)
i will try to use it


Dreamora(Posted 2006) [#9]
You know that the chance that your API hacking on the window is causing problems is > 0 :)

did you try it with a simple graphics(800,600,16,2) window to see if it works?

If you are using images instead of 3D stuff, the 3D capable doesn't mind anyway as using Graphics3D without 3D objects does not give you any speedboost or the like.

PS: Do NOT play with peoples screen depth settings. there is nothing I hate more than want to be programmers that think they need to set my desktop depth to something different because if I wanted a different one, I had set it to that one.
If you want to enforce 16bit, use windowed or notify the user of it as other apps do it.


sulusgames(Posted 2006) [#10]
Thanks Dreamora :)

My game use 3d graphics(animated character) and 2d images for gui\text and etc, and i can't use graphics(800,600,16,2) :(

You are right, i'll show a message that player's video card don't support 3D Graphics in 32 bit mode.

But also i'm not found an info to help me with 'LoadImage'