Article View: comp.graphics.api.opengl
Article #36Re: How to make a scrrenshot
From: Charles E Hardwidge
Date: Thu, 06 Jan 2000 00:00
Date: Thu, 06 Jan 2000 00:00
29 lines
1892 bytes
1892 bytes
<Example>
Where Width&Height are pixels, and channels is; RGB=3 RGBA=4.
char* MyPicture = (char*)malloc(Width*Height*ChannelTotal);
FILE* pMyOut = fopen("test out.raw", "wb");
glReadPixels(0,0,Width,Height,GL_RGBA,GL_UNSIGNED_BYTE,MyPicture);
fwrite(MyPicture,(Width*Height*ChannelTotal),1,pMyOut2);
fclose(pMyOut);
delete MyPicture;
<Comment>
Don't forget to access the file as a binary ("wb"), like a klutz I forgot to
do this a while ago and spent rather a long time tracking down the reason.
Sheesh, like I only started programming yesterday. This may explain
distorted pictures (you were not to clear about what you meant by
"distorted").
--
***Anti - Spam Email Address***
ANY correspondence not of direct relevance to my posting, or any offer of
sale will be considered SPAM. Under UK law this breaches the Computer Misuse
Act, rendering the sender liable to a three year sentence and/or unlimited
fine. By sending me email, you agree the sending be covered by UK law.
news@eatmyshorts.fsnet.co.uk
Please replace eatmyshorts with hardwidge to reply.
Technical Details
Message-ID:
<852pl0$a64$1@newsg1.svr.pol.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<851jd0$rl$1@newsread.f.de.uu.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f65bb,2ad16ac8f9e3514d X-Google-Attributes: gidf65bb,public X-Google-Thread: 100291,2ad16ac8f9e3514d X-Google-Attributes: gid100291,public From: "Charles E Hardwidge" <news@eatmyshorts.fsnet.co.uk> Subject: Re: How to make a scrrenshot Date: 2000/01/06 Message-ID: <852pl0$a64$1@newsg1.svr.pol.co.uk> X-Deja-AN: 569207145 References: <851jd0$rl$1@newsread.f.de.uu.net> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: abuse@theplanet.net X-Trace: newsg1.svr.pol.co.uk 947186144 10436 62.136.85.91 (6 Jan 2000 19:15:44 GMT) Organization: Customer of Planet Online X-MSMail-Priority: Normal NNTP-Posting-Date: 6 Jan 2000 19:15:44 GMT Newsgroups: comp.graphics.api.opengl,3dfx.opengl