PDA

View Full Version : Texture Download...



royconejo
03-19-2001, 09:58 PM
Hi,

Do I have any way to specify where I want to download textures? Now I'm using
gluBuild2DMipmaps, but I don't know where they're stored (System, AGP, or Video memory).

I really don't want to use AGP memory, since it's slower than vidmem...

Well, thanks for your help.

- Royconejo.

Jorrit
03-20-2001, 12:08 AM
With OpenGL you cannot specify where your textures go. The driver will handle that for you.

Be sure to use glGenTextures and glBindTexture and you're ok. You might want to sort your geometry on texture (so that you'll have the least number of glBindTexure calls), but that totally depends on what you're doing.

royconejo
03-20-2001, 03:22 PM
So I can't do anything about it..

Maybe there is an OpenGL extension or something??

Anyway, Thanks for your help!

- Royconejo.

Tom Nuydens
03-21-2001, 01:42 AM
OpenGL's texture management is completely opaque to the developer. On consumer-class PC hardware, it goes like this:

You load textures into system memory
OpenGL copies as many of them as possible to video memory
When rendering, textures that aren't in video memory yet are transferred over from system memory
The least recently used textures are thrown out of video memory to make room for the new ones

I don't know how current drivers use AGP memory in all this, but I suspect that it would be used instead of system memory to keep the backup copies of the textures. I also don't know what happens to dynamically created textures (glCopyTexImage2D()). If anyone knows, please do tell http://www.opengl.org/discussion_boards/ubb/smile.gif

I don't think there's anything you can do to change the way your drivers manage all this... Although you could always try storing textures in memory that you get with wglAllocateMemoryNV() http://www.opengl.org/discussion_boards/ubb/wink.gif

For further reading, here's a few links relating to texture management:
http://finger.stomped.com/archive.php3?archive=johnc%7Cidsoftware.com%7C2000-03-07%7C2347
http://www.3dlabs.com/product/technology/vtpaper.pdf
http://apollo.iwt.uni-bielefeld.de/~ml_robot/OpenGL-10-1999/0595.html
http://www.flipcode.com/tfiles/muresan.shtml
http://www.gamedeveloper.org/delphi3d/3de/3de_20.shtml (shameless plug)

- Tom

zed
03-21-2001, 02:34 AM
you might wanna try a hint with glPrioritizeTextures(..) but i dont think drivers take head of this to much

cass
03-21-2001, 03:07 AM
Tom,

For NVIDIA hardware, in release10 drivers and beyond, glCopyTex{Sub}Image2D() only updates the on-card texture -- if the formats match closely enough for a "fast copy". If the texture ever has to be evicted, you pay for readback then. That way you may never have to pay for readback.

Thanks -
Cass

duckman
03-23-2001, 07:17 AM
Originally posted by zed:
you might wanna try a hint with glPrioritizeTextures(..) but i dont think drivers take head of this to much

glPrioritizeTextures(..) is the way to go.
Higher priority textures are more likely to remain in video memory
USE THIS

why
well think about it
Iif you could controll which textures went into vid mem you......
-would have to adjust the code to suite thefact that each card has different mem on board
- Use LRU paging algorithem or something similar to dump textures out of vid mem
-priorities textures to make the page more sticky in the LRU algorithem
-prioritize textures to get them sorted in order of which ones get vmem when available.

This is what glPrioritizeTextures(..) does.
dont reinvent the wheel!
- OpenGL is a software abstraction to the hardware
- Directly controlling hardware, ie knowing what texture is in what memory is against
the development phylosophy of OpenGL

basicy
-asign priorities to your textures
-spend time finding other optimizations

royconejo
03-23-2001, 06:37 PM
Thanks, I'll try it..

- Royconejo.

jwatte
03-23-2001, 07:23 PM
Originally posted by cass:
For NVIDIA hardware, in release10 drivers and beyond, glCopyTex{Sub}Image2D() only updates the on-card texture -- if the formats match closely enough for a "fast copy". If the texture ever has to be evicted, you pay for readback then. That way you may never have to pay for readback.

Are you implying that you read texture data back from the card when you need to evict a texture? That sounds slow. I had been assuming that you'd store a backup copy of the texture in system RAM (maybe even pageable RAM). That way, on machines with lots of memory (like mine) there is no "penalty" except locking the backup memory and re-uploading it.

Serge K
03-23-2001, 07:41 PM
Originally posted by jwatte:
Are you implying that you read texture data back from the card when you need to evict a texture? That sounds slow. I had been assuming that you'd store a backup copy of the texture in system RAM (maybe even pageable RAM). That way, on machines with lots of memory (like mine) there is no "penalty" except locking the backup memory and re-uploading it.



WTF??? http://www.opengl.org/discussion_boards/ubb/confused.gif

Do you know what is glCopyTex{Sub}ImageXX()? http://www.opengl.org/discussion_boards/ubb/rolleyes.gif

Gorg
03-23-2001, 08:58 PM
glCopyTexImage1d
glCopyTexSubImage1d
glCopyTexImage2d
glCopyTexSubImage2d
etc..

{ } is a BNF(to describe a language) symbol to say Sub is no necessary, but you can have it

Serge K
03-23-2001, 09:31 PM
Originally posted by Gorg:
glCopyTexImage1d
glCopyTexSubImage1d
glCopyTexImage2d
glCopyTexSubImage2d
etc..

{ } is a BNF(to describe a language) symbol to say Sub is no necessary, but you can have it

glCopyTex{Sub}ImageXX() copies pixels from the framebuffer into the texture image.

If somebody think that a "backup copy of the texture in system RAM" happens just by itself (you know - magicaly), than I have nothing to add..

Dirk
03-25-2001, 06:06 AM
Originally posted by cass:
Tom,

For NVIDIA hardware, in release10 drivers and beyond, glCopyTex{Sub}Image2D() only updates the on-card texture -- if the formats match closely enough for a "fast copy". If the texture ever has to be evicted, you pay for readback then. That way you may never have to pay for readback.


Hmm, do you really do that? There was a lengthy discussion on ogl-gamedev some time ago that concluded in "It's not possible", because bluescreens like 'CD Missing' can clobber vidmem without telling you. What do you do there?

jwatte
03-25-2001, 04:47 PM
Serge, you're right. Have a great day!