View Full Version : glCopyTex...Image2d(...)
06-30-2002, 10:00 AM
I thought glCopyTexImage2D()
was slower than glCopyTexSubImage2D()
but I tried and it seams to be exactly the same.
So my question is : Is it usefull to
use glCopyTexSubImage2D ?
06-30-2002, 11:31 AM
Well, I think it is senseful. I think so, because CopyTexImage CREATES a texture each time and WILL NOT delete the old texture, so you have to delete the old texture yourself and all in all the update of your texture will look like:
glDeleteTextures (delete old)
glGenTextures (create new id)
glBindTexture (selecting id)
glTexCopySubImage2D (loading image from fb)
glTexParameterf... (filter mag) (all settings)
glTexParameterf... (filter min)
glTexParameterf... (wrap s)
glTexParameterf... (wrap t)
instead of only
glTexCopySubImage2D (loading image)
So first of all you have only a 5th of the API calls. I don't know, how your test program looks like and if you anyway deleted and recreated the texture in it as it's needed. If not..... well, then you know now, what caused why suddenly 40 MB of your free memory stood missing after quitting your program http://www.opengl.org/discussion_boards/ubb/wink.gif. On the other hand you also totally fragment your memory through this. If you want to try write a little program always reserving and freeing little blocks of memory. Windows will do this may be one hour if you are lucky and then freeze away or show you the good old blue screen. So well... except you want to poke the driver... always use the one of the functions which is senseful. In case of updating textures: glCopyTexSubImage2D http://www.opengl.org/discussion_boards/ubb/wink.gif.
06-30-2002, 12:06 PM
I really thank you.
You were right : "40 MB of my free memory stood missing after quitting my program"
07-01-2002, 02:54 AM
Well, I did the same mistake once too, hehe. I also thought that OpenGL would automatically free the old texture if I store a new one using the same ID. And every time after loading a savegame I had suddenly 30 MB memory less http://www.opengl.org/discussion_boards/ubb/smile.gif. I debugged and debugged and found nothing... till I asked myself if it may be cause of the textures http://www.opengl.org/discussion_boards/ubb/wink.gif.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.