PDA

View Full Version : OpenGL & memory



micstach
08-21-2003, 04:19 PM
Hi, i've got a little question...

Where OpenGL stores textures ????
From a little bit of testing a get an strange answer that probably not in Graphic Card Mem, i've notice that using Task Manager. While loading tex, when loading tex using glTexImage2D(...) .

If im correct, than why do i need for example 64MB on graph card ?? (f gl stores tex in RAM...) is there any way use that mem (on graph card) ??

thanks for any help :)

rgpc
08-21-2003, 06:49 PM
Your driver will "always" try to put the texture in the best possible place - on the card. I say "always" because if you're using the standard Microsoft implementation, it is not aware that you have a 3D enabled card and will always store your texture in system memory.

So I would suggest that you check to see if you are successfully using your vendors GL implementation or the standard Micro$oft one (glGetString(GL_VENDOR)).

Mazy
08-22-2003, 12:06 AM
If you have an HW accelerated card the texture will probably be in the gfxcard when you use it for rendering, but since opengl should manage the gfxcards resources for you, it must still have a resident copy somewhere ( probably in the systemmem ) becourse you cannot count on that the card can handle all textures at the same time. If you for example use more texture than the card han hold at one time ( or that you run several opengl programs at the same time) a texture on the card might be replaced by another texture that must be there in order to render a certain material, then when you want to use the first texture again, opengl must upload that one again.. It should be possible to move the texture from the sysmem to the card, remove it fom system memory and if it had to be removed otu of the card the driver can download it and save it in the sysmem again, but that should be to complicated and to slow so they often just overwrite the texturemem on the card and flag the texture as not beeing there anymore.

In early dx versions this kind of management wasnt implemented, so the application writer had to do this himself, but checking a flag before he used a texture in order to figure out if it was needed to upload it again, or if he just could bind it.. ( its not like that anymore )

So - when you upload a texture to opengl, the most common case is that you have one copy on the card and another in systemmem..

micstach
08-22-2003, 12:47 AM
thanks :)

in that case i understand that i need twice as much memory for storing textures...

i've got one more question, is there any opengl refrence where i can get some information about 'how opengl manages memory' ?

Is there any way to get information about available graph mem ?

micstach
08-22-2003, 12:55 AM
Originally posted by rgpc:
Your driver will "always" try to put the texture in the best possible place - on the card. I say "always" because if you're using the standard Microsoft implementation, it is not aware that you have a 3D enabled card and will always store your texture in system memory.

So I would suggest that you check to see if you are successfully using your vendors GL implementation or the standard Micro$oft one (glGetString(GL_VENDOR)).

I hope so http://www.opengl.org/discussion_boards/ubb/smile.gif

for example:

when i run unreal tournament using gl driver and it uses almost two times more memory than when it uses directx driver, so thats why i asked this question http://www.opengl.org/discussion_boards/ubb/smile.gif (i've got Radeon 9000, and im sure im using ati's opengl driver)

Mazy
08-22-2003, 01:46 AM
It shouldnt take 2times the memory in opengl vs DirectX. Like i stated, dx uses this management as well.. But you might forgot to move your applications copy of the texture, then you end up with 3 copies of the texture.. you applications, opengls systemcopy, and ( and this is invisible for the memcounter) the copy on the graphicscard.