   glTexImage2D
  Hi, Can I use glTexImage2D() to animate the texture? I want to create texture data by myself and dynamically change it, so every time when display() is called I update the glTexImage2D() first then do texture mapping, does it work?thank you very much.   
  While you certainly can do that, it will be painfully slow. If you can get away with only changing part of the image, you might want to try glTexSubImage2d, or use a spritesheet for animations if that is possible.   ;  I do this for a number of things.If you keep the texture size smallish, use pixel buffer objects it wont be too bad for speed.If you are only updating part of the texture use glTexSubImage2d or pixel buffer objects.   ;  You can allocate a texture with glTexImage and pass NULL as the last parameter. Then, all updating should be done with glTexSubImage, even all of the texels. Never use glTexImage since that causes a reallocation.   ;  A common trick is to use a 3D texture and change your texture coords per frame. While this is limiting for your animation length and uses more GPU memory, it's much faster in most cases. It should also allow you to blend between your frames, making the animation smoother.   