Accessing glumpy textures

Skip to first unread message


Feb 13, 2012, 12:39:15 PM2/13/12
to glumpy-users
I have a program that shows the output of various monochrome cameras.
I'd like to have a false-color display mode, and the pyopengl-users
list suggested that I check out glumpy. I took a look at the examples;
it looks like the "colormaps" example should do what I want. What
would be the best way to go about integrating that into my existing

I tried replacing the part of my code that calls glGenTextures and
glTexImage2D with the creating of a glumpy.image.Image and then
grabbing the image._texture._id property for later display, but that
made WX (which I'm using for windowing and GL contexts) upset. I'm
guessing that the glumpy Image uses its own rendering context, causing
the texture to not actually be available. I'd rather not use the built-
in glumpy display code because I need to support several customized
features (pan, zoom, tiled image display, custom markers, etc.).

Any suggestions? Is glumpy actually the right way to go here?


Nicolas Rougier

Feb 15, 2012, 12:47:42 PM2/15/12
to glumpy-users

The false color replacement happens in a fragment shader that is quite
simple. It requires two textures (the one you want to display and the
one you want to use to false colorization). Then you can do (in your
fragment shader):

uniform sampler2D texture;
uniform sampler1D color_lut;
void main()
vec2 uv = gl_TexCoord[0].xy;
vec4 color = texture2D(texture, uv);
gl_FragColor = texture1D(color_lut,color.a);

Reply all
Reply to author
0 new messages