glReadPixels

I’ve been using glReadPixels(…) on a workstation and it has been working fine. I started using a different workstation (same program) and it no longer works. Previously when I switched workstations I just adjusted the display resolution and the color settings and it has worked fine, but now it doesn’t work. Does anyone have any ideas? I really need to get this working.

please help!! I know someone must know this.

The code goes something like this…

GLfloat* mygreen = new GLfloat[sizexsizey];
GLfloat
myblue = new GLfloat[sizex*sizey];

glFlush();
glReadBuffer(GL_FRONT);

glReadPixels(xmin, ymin, sizex, sizey, GL_GREEN, GL_FLOAT, mygreen);
glReadPixels(xmin, ymin, sizex, sizey, GL_BLUE, GL_FLOAT, myblue);

I also specify the drawing to take place in the front buffer.

It runs on one win2k platform, but wont run on another. I’m not sure where the problem is coming from. I’m getting all 1’s in the myblue and mygreen arrays.

[This message has been edited by hatemagnet (edited 09-23-2002).]

hmmm

not sure at all really but my ‘best’ guess is something to do with the sizeof(floats) not being consistent over the two platforms?

Allan

The actual size of a float should, in this case, be irrelevant since he’s using GL-types exclusively. If he would have defined the array as ‘float’, not ‘GLfloat’, there could have been some problems.

eh?

i might be being thick (proberbly) but GLfloat is just a typedef float isnt it? This would mean that it’s size would change on a different system?

if i’m being dense explain it to me.

Cheers

Allan

On most sytems a GLfloat is just a typedef for a float, but that wouldn’t necessarily be true for all systems.

In any case, I highly doubt that the sizeof float is the problem. Virtually all systems use a 4-byte float. And considering this guy is going from one Win2k platform to another Win2k platform, it’s pretty likely that’s not the problem.

What kind of graphics hardware is on each of these systems?

And even if a GLfloat was of different sizes on the two platforms, the size wouldn’t matter anyways. Since mygreen/myblue are pointers to a GLfloat, and the implementation stores the values GLfloats (specified by GL_FLOAT), there’s no problems with the size.

Deiussum-
I’m using a 3D Labs Wildcat III 6110 graphics card on a Dell pc with a xeon processor and the program doesn’t work right. The graphics card is supposed to be especially for opengl.

I was using a 3D labs Oxygen VX1 graphics On a gateway pc with a duel pentiumII processors and it worked fine.
Bob-
The sizeof float and GLfloats on the dell are both 4 on the Dell PC. I cant check on the old gateway right now but I’m guessing as you said the size is 4.

Any suggestions??

[This message has been edited by hatemagnet (edited 09-23-2002).]

[This message has been edited by hatemagnet (edited 09-23-2002).]

As Bob said, even if by some odd chance the sizes were different, it should still work since you are explicitly using GLfloat types, and specifying GL_FLOAT in the glReadPixels.

I’m not too familiar with those cards. Do you have the latest drivers for both? If they are both 3d Labs cards, I would assume that the drivers would be fairly comparable in their behavior. I’m not quite sure what else to try.

Hey it was just a (admittedly poor) guess fellas.

that is all.

move along - nothing to see here.