Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Binding textures  (Read 2091 times)
0 Members and 1 Guest are viewing this topic.
Offline DavidYazel

Junior Devvie




Java games rock!


« Posted 2003-07-14 14:02:45 »

I have a question.  If I create N texture objects and I run out of texture memory, what happens?  Does the texImage2 fail?  I am confused because my docs say that opengl will automatically delete older textures and there is even an API to set that delete priority.

So if it does delete an older texture object how does my app know it has to reload it?  Will the subsequent bind fail?



David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Offline elias

Senior Devvie





« Reply #1 - Posted 2003-07-14 17:22:48 »

OpenGL will never delete your textures without you doing it explicitly. That said, your docs probably meant resident textures, and the functions to prioritize and query for residency. When a texture is readily available to the renderer, it is considered resident. If it isn't, it will have to be copied, and other resident textures might have to be kicked out.

Practically, residency means textures currently in video memory (usually 32, 64 MB on the common cards), and nonresidency means system memory. When binding a nonresident texture, the OpenGL driver will have to upload it to resident memory.

That also means that you can always create new textures, to the system memory limit, but performance will suffer if textures are swapped in and out of resident memory all the time.

- elias

Offline elias

Senior Devvie





« Reply #2 - Posted 2003-07-14 17:24:48 »

And that's also the reason texture binding are considering expensive - there's a risk that a texture will have to be uploaded at each bind.

- elias

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline DavidYazel

Junior Devvie




Java games rock!


« Reply #3 - Posted 2003-07-14 18:48:07 »

I am still confused.  If you use glGenTexture to get a texture object name, then use glBindTexture, should you not call glTextImage if it is already bound?  or does opengl just ignore the following glTexImage call if it already has a copy?

And is it safe to change the texture between draws?  Do you have to delete the texture to repplace it with a new one?

If you delete a texture is it's name still valid?

David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
8: Undefined index: online
File: /home/jgo/public_html/Themes/default/Display.template.php (main sub template - eval?)
Line: 161