Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get texture data using textureID's in openGL

I'm writing some code where all I have access to is a textureID to get access to the required texture. Is there any way that I can get access to the RGB values of this texture so I can perform some computations on it?

EDIT: I am looking for the inverse of glTexSubImage2D. I want to get the texture data rather than replace it.

like image 448
Sonoman Avatar asked Feb 25 '11 13:02

Sonoman


People also ask

How do you show textures in OpenGL?

in display() function : GLuint texture; texture = LoadTexture("bubble. png"); glBindTexture(GL_TEXTURE_2D, texture);

What is a sampler OpenGL?

A Sampler Object is an OpenGL Object that stores the sampling parameters for a Texture access inside of a shader.

How many textures can you load in OpenGL?

OpenGL 3. x defines the minimum number for the per-stage limit to be 16, so hardware cannot have fewer than 16 textures-per-stage.


1 Answers

You are probably looking for glGetTexImage

Before using glGetTexImage, don't forget to use glBindTexture with your texture ID.

like image 70
Greg S Avatar answered Sep 29 '22 13:09

Greg S