user3901459
user3901459

Reputation: 844

OpenGL Reading Pixels from Texture?

I need a way to get the pixels of an already existing texture. Similarly to how D3DTexture's LockRect works with ReadOnly and NoSysLock. Some of my textures are also stored in compressed DXT1/3/5 formats, not entirely sure if that would affect anything. If those formats are simply decoded by Opengl and stored as raw pixels instead of in the compression. So would retrieving the pixels guarantee the same format that was used to set the texture with?

Upvotes: 1

Views: 14679

Answers (1)

Thomas
Thomas

Reputation: 6196

Generally you will want to use a PBO for reading pixels. Here's all the information you need on PBOs, click here

So would retrieving the pixels guarantee the same format that was used to set the texture with?

It is possible to convert the format and retrieve the pixels at the same time. Look at the format conversion section on the page I linked.

Upvotes: 1

Related Questions