PDA

View Full Version : texture upload question



rgreene
10-17-2002, 04:13 PM
I asked this in the beginners forums, but have not yet gotten a response. Maybe you guys could help me out. Here's my question:

I assume that when I call glTexImage2D () the OpenGL driver attempts to put the texture into video memory, and if it cannot, then it stuffs it into the next most likely place (AGP?). Is there an easy way to make it simply fail to upload the texture if it cannot fit it into video memory?

Asgard
10-17-2002, 04:54 PM
Originally posted by rgreene:
Is there an easy way to make it simply fail to upload the texture if it cannot fit it into video memory?

No. OpenGL is supposed to hide such details from you.

zeckensack
10-17-2002, 05:10 PM
A hack:
glAreTexturesResident(...); //good luck getting reliable info from this
if (!) glDeleteTextures(...);

But what would you win this way?

I guess you don't really want to do that. Implement a user controlled texture detail setting and be done with it.

AdrianD
10-18-2002, 03:09 AM
wasn't there a way to check for it with so called "proxy textures" ?
as far i remember, a proxy texture is a way to call your texture-allocation-code without doing any actual reservation. After this call you can determine if this texture would fit into videomem or not.

(i think this is also described in the original ogl1.1 specs)

but i am not really sure...just check out the specs and try it out.

AdrianD
10-18-2002, 03:20 AM
...another idea: maybe you will take also a look at the texture-priorty thing in openGL ?
this could also help you, to make sure that some textures are allways in videomem.

maybe this would solve your actual problem.
i don't really know why you want to know where your texture is located, but i guess that's because you have some more important textures, which have to stay always in videomem...am i right ?

in this case you could solve this problem it easier with
glPrioritizeTextures calls.

Asgard
10-18-2002, 03:20 AM
I always thought that proxy textures are for verifying maximum texture sizes...a mechanism to check that a call to glTexImage with a "real" texture image will actually succeed. But I've never used proxy textures myself, so I might be wrong.

AdrianD
10-18-2002, 03:25 AM
Originally posted by Asgard:
I always thought that proxy textures are for verifying maximum texture sizes...a mechanism to check that a call to glTexImage with a "real" texture image will actually succeed. But I've never used proxy textures myself, so I might be wrong.

as i said: i am not sure, but it might be worth to check it out. and so i suggested it.

Relic
10-18-2002, 06:44 AM
First answer from Asgard hit the nail on the head.
There are no means to distinguish the placement of textures on user side. They are either downloaded to OpenGL somewhere or not.
Proxy textures will only report if they can be downloaded, not to which memory.
Prioritize will also only be a hint.
And all this is hardware dependent! Imagine older hardware which could only access textures in video memory. The driver needs to page them in an out for rendering.
Or your texture memory management is completely virtualized and only the necessary parts of a texture are on the board.
Or... lots of other arguments.

rgreene
10-18-2002, 09:24 AM
Thanks for the replys guys. Right now I'm working on a project that has a minumum requirment of a GF4 with 128 megs of memory, needlessly to say I have not yet filled it up with textures http://www.opengl.org/discussion_boards/ubb/smile.gif. However, I wanted to be able to stop textures from loading if we do hit the ceiling on, say a GF3 (which should still be able to run my app). It's kind of a moot point, I was just wondering.

Thanks!

amendol
10-18-2002, 09:33 AM
Originally posted by AdrianD:
...another idea: maybe you will take also a look at the texture-priorty thing in openGL ?
this could also help you, to make sure that some textures are allways in videomem.

maybe this would solve your actual problem.
i don't really know why you want to know where your texture is located, but i guess that's because you have some more important textures, which have to stay always in videomem...am i right ?

in this case you could solve this problem it easier with
glPrioritizeTextures calls.

In a perfect OpenGL world this would work -- Unfortunately I have never seen these calls work, but I've never tried it on an NVidia card.