Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


glReadPixels question....

This topic is 5421 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

MSDN says something about that but I want to make sure. So glReadPixels( GLint x,GLint y,GLsizei width, GLsizei height,GLenum format,GLenum type, GLvoid *pixels ); reads the buffer and stores the pixels in pixels array in row order or in column order? What I mean is that the first pixels in array will be the first row''s pixels or the first column''s pixels? Thanks

Share this post

Link to post
Share on other sites
Thanks for the answer.I have another question. I know that the first row of the pixels is the lowest of the buffer''s rectangle
which I read with glReadPixels.If I use fwrite() to write this array to a .bmp file (suppose I have already written the header and all the necessary stuff) will it be written the same way (from the lowest row to the highest) or opposite? If I use
fread() then, will the array I get remain the same (the first row will be the lowest and the last the highest)? I know these things are clarified , but I need to make sure in order to proceed in an assigment. I want to read the buffer with glReadPixels , save it to a .bmp file , then read the .bmp file (with fread()),get an unsigned char array of pixels and transform this array to a 2-dimensional array of zeros and ones.So if the first row is the lowest of the bitmap , I''ll need to store the first rows of the unsigned char array to the last rows of the 2-dimensional array so my 2-dimensional array has as the first row the highest row.So I need to know what is the order of the rows of the unsigned array.I hope you understood my question.Thanks in advance

Share this post

Link to post
Share on other sites
this is a homework/assignment question - so why don't you just do your assignment like you should be.

The whole point of an education is to learn things. If you keep at it this way your going to end up being one of those half-arsed IT or computer science graduates who gets a job but still can't use microsoft excel or program the simplest I/O program after apparently "studying" it for 3 to 5 years.

To LEARN you have to ATTEMPT the bloody assignment.

Your question is a damned easy one.

Try it.

If it's upside down you know that the order of it's the other way. If it isn't upside down, then it's fine.

It's pretty bloody simple. If you can't do that, then I recommend changing degrees, or going back to first year and starting again.


and if your in highschool - start learning instead of getting others to do your homework. Your better off learning something and getting passes instead of not knowing sweet feck all and getting full marks.
If you do learn, you may even be able to pull both off.

Computing is one of the easiest subjects you could possibly do. If you can't get it right, there isn't much hope for you.

Atleast TRY and learn it. It's not hard. It's programming.
The only HARD bit about programming is doing it fast and being able to optimise your code. Everything else is easy.

[edited by - Dredge-Master on December 16, 2003 11:27:37 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!