Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


glReadPixels


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 TheMummy   Members   -  Reputation: 122

Like
Likes
Like

Posted 18 November 2001 - 10:01 AM

Hi there, I am currently writing a litte tool that reads wgl bitmap fonts and writes them into a file ... to get platform independent fonts. At first I put every letter from 32 - 255 into one frame to get the maximum size of the font. So I call glReadPixels the first time and check the size. Then I create a buffer and open an output file. After that I render every letter and read it with glReadPixels but during this call to glReadPixels the porgram always crashes... I commented the line and the access violation is gone Whats wrong ? Edited by - TheMummy on November 18, 2001 5:04:27 PM

Sponsor:

#2 Fruny   Moderators   -  Reputation: 1653

Like
Likes
Like

Posted 18 November 2001 - 10:14 AM

My guess would be that you''ve not allocated your pixel array (last parameter to glReadPixels) or that it has the wrong size.

#3 jenova   Members   -  Reputation: 122

Like
Likes
Like

Posted 18 November 2001 - 10:29 AM

make sure your read buffer is set to the back buffer (assuming double buffering). make sure your pixel store settings are set correctly and make sure you allocate enough memory to store the amount of ascii characters you need. make sure the file is open and set for writing.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

#4 TheMummy   Members   -  Reputation: 122

Like
Likes
Like

Posted 18 November 2001 - 07:09 PM

quote:
Original post by jenova
make sure your read buffer is set to the back buffer (assuming double buffering) ...


errhm so do you mean I have to call glReadPixels after switching the buffers or right before ???

Render Frame
SwitchBuffer
glReadPixels --- The way I set it

or

Render Frame
glReadPixels
SwitchBuffer



#5 jenova   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 November 2001 - 06:31 AM

well, i meant that you need to set the correct read buffer. i.e. if you are going to draw the scene first, then use:

"glReadBuffer(GL_FRONT);".

also the default "glPixelStore" settings, might not be what you want.

and the only other thing is to allocate enough memory for storing the pixel data. you might want to create a static array for testing purposes that''s the size of the screen.

i.e. "char bitmap[640][480][4];" // 640x480, 32-bit color.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

#6 TheMummy   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 November 2001 - 09:23 AM

Yes thanks you both were right !
I didn''t alocate enough memory !! I read w*h pixels and alcoated memory for (w-1)*(h-1) pixels ........
So I can continue now ...




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS