Hi,
first sorry for my english, i'm a poor french litle programmer.
I'm currently make (or made) � HomeworldLike game and i'm just like to do
screen shot.
So i made this code :
GLint view[4];
glGetIntegerv(GL_VIEWPORT,view);
unsigned char* t = new unsigned char
[(view[2]-view[0]+1)*(view[3]-view[1]+1)*4];
//i now size of 't' is not good
glReadBuffer(GL_BACK);
glPixelZoom(1.0f,1.0f);//we never know
glReadPixels(0,0,view[2],view[3],GL_RGB,GL_UNSIGNED_BYTE, t);
save_to_bmp(t,view[2],view[3]);
delete[] t;
i'm currently sure that view[0]=view[1]=0
and sure that save_to_bmp is good (i hope so).
But when i save my screen i've � shift of 1,2,3 or 0 :) byte by line.
And i think that in the data the color are save like that :
RGBRGBRGB000
RGBRGBRGB000
RGBRGBRGB000...
how can i bee sure that the blue composent of the end pixel of a line is
directly follow(ed) by the red composent of the first pixel of the next line
?!?
Thanks,
Trident.
|
|
0
|
|
|
|
Reply
|
astro.trident (1)
|
7/21/2004 6:24:03 PM |
|
Trident wrote:
> i think that in the data the color are save like that :
>
> RGBRGBRGB000
> RGBRGBRGB000
> RGBRGBRGB000...
>
> how can i bee sure that the blue composent of the end pixel of a line is
> directly follow(ed) by the red composent of the first pixel of the next line
> ?!?
glPixelStorei(GL_PACK_ALIGNMENT, 0);
--
<\___/>
/ O O \
\_____/ FTB. For email, remove my socks.
Governments, like diapers, should be changed often,
and for the same reason.
|
|
0
|
|
|
|
Reply
|
fungus
|
7/21/2004 7:06:40 PM
|
|
So, glPixelStorei(GL_PACK_ALIGNMENT, 1); works realy good.
Thanks a milion.
|
|
0
|
|
|
|
Reply
|
Trident
|
7/21/2004 7:39:24 PM
|
|
Trident wrote:
> So, glPixelStorei(GL_PACK_ALIGNMENT, 1); works realy good.
>
>
Um, yes. I meant "1"...
--
<\___/>
/ O O \
\_____/ FTB. For email, remove my socks.
Governments, like diapers, should be changed often,
and for the same reason.
|
|
0
|
|
|
|
Reply
|
fungus
|
7/21/2004 7:49:29 PM
|
|
|
3 Replies
481 Views
(page loaded in 0.105 seconds)
Similiar Articles: Framebuffer grab problem using glReadPixel() - comp.graphics.api ...... glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, input); Then I write input buffer in a file in ppm format. ... Framebuffer grab problem using glReadPixel ... Grabbing float pixel values (from frame buffer)? - comp.graphics ...... OrigX, OrigY, width, height, GL_RGB, GL_UNSIGNED_BYTE ... can type "GL_FLOAT" instead of "GL_UNSIGNED_BYTE" for the data format. ... Framebuffer grab problem using glReadPixel VBOs vs Display Lists - lets test it out! - comp.graphics.api ...... TEXTURE_2D, 0, 3, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE ... Uint32 col=0; // Temporary pixel value storage ... memcpy(&col, offset, m_pTextureImage->format ... Problem: glReadPixel & Pixel Format Descriptor - openglPixel stride when using glReadPixel. 6. glReadPixel GL_RGB,GL_UNSIGNED_BYTE storage format Hi, first sorry for my english, i'm a poor french litle programmer. glReadPixel and glPixelStore - OpenGL - The Industry Standard for ...... RGBA) pixel format is it true that reading GL_RGBA is faster because pixels need not to be converted to GL_RGB ? ... 8) with a glReadPixel ... 0, 6, 8, GL_RGB, GL_UNSIGNED_BYTE ... 7/24/2012 3:16:29 PM
|