soulfreezer wrote on Tuesday, August 10, 2010:


I want to manipulate the Image-Data, which I got from the glfwReadImage-
Function. I loaded a tga-File with an alpha-channel.

Now I have two questions:

1. What means the Flag: GLFW_ORIGIN_UL_BIT ?? does it work correctly?

I had created an 256x256 TGA-File with GIMP and then saved it with “Origin in
the Upper Left”. If I read this file with glfwReadImage and then texture it on
a quad, it is painted reverse! If I REMOVE the flag GLFW_ORIGIN_UL_BIT
from the glfwReadImage and replace it with a 0, then it appears correct! If I
create in GIMP a TGA-File, which is NOT saveing the Origin in the upper left
and then I use glfwReadImage with the GLFW_ORIGIN_UL_BIT-Flag, it is ALSO
painted reverse!
Can someone explain me plz, how the usage of this flag is meant?

2. Whats the internal format of GLFWimage ?

I loaded a TGA with alphachannel and it is correct painted. The transparent is
correct set. That means, the data in GLFWImage
seems to be correct. But how can I manipulate the Data in the GLFWImage-

I have read, that in GL_RGBA-Mode the Pixels are linear stored from the
bottom left to the upper right? Correct?
for example I want to draw a simple line into my loaded Image:

GLFWImage img;

//Read the Stuff ….

for(int i=0; i< 100; i+=4)
img.date_ = 255; = 0; = 0; = 0;

I thougt, I would get a horizontal red line at the bottom of my image but that
is not the case. I can see one small line at the bottom (much to small) and
one synchron thin line at the top of the image! Does anybody know, what I do
I have checked img.Format and it is correct -> GL_RGBA! The image is correct
painted, only my modification seems to be incorrect :frowning:

Thanx so much for help!! :slight_smile:

Grtz Soul


soulfreezer wrote on Tuesday, August 10, 2010:

//sry, this code-part is correct. Ths is the part which does not work

//Manipulate for(int i=0; i< 100; i+=4)
{[i] = 255;[i+1] = 0;[i+2] = 0;[i+3] = 0; 

soulfreezer wrote on Wednesday, August 11, 2010:

hmmm…does nobody know an answer ? :frowning:

elmindreda wrote on Wednesday, August 11, 2010:

The orientation is not related to the pixel format.

You have written nothing about how you set up your quad.

soulfreezer wrote on Thursday, August 12, 2010:

Hi Camilla,

I have solved the Problem. The redundant apperance of the pixels is maybe a
repeating drawing of the Texture on the Quad?
Maybe cause of my Perspective? If I translate the quad nearer on z-axis (less
negative value), then it looks correct. I have switched then to Ortho-Mode
and set the viewport exactly to Screensize. Then I drawed the texture against
the clock on the quad. The Quad has the size of 256x256 and the texture also.
Also I activated Backface-Culling. Now it looks correct on each translate-
combination. Strange thing………