PDA

View Full Version : glDrawPixels() to the front or back buffer?



drumminj
04-27-2000, 09:24 PM
So again I'm working on this phong-shader. It was suggested in the other topic to draw to my own buffer then blit it over to the framebuffer rather than use GL to draw a bunch of points. That seems fair, however, I have a few questions in that regard:

1) will this still be faster if, say, only 15% of the screen is drawn to?

2) is glDrawPixels() fast enough to copy directly to the front buffer, or do I need to copy to the back buffer and then call glutSwapBuffers()?

3) is one format faster than others(float, unsigned byte, etc. I would think bytes are faster...

Hrm..I guess that's all for now http://www.opengl.org/discussion_boards/ubb/smile.gif

J


[This message has been edited by drumminj (edited 04-27-2000).]

[This message has been edited by drumminj (edited 04-27-2000).]

drumminj
04-27-2000, 10:41 PM
Another 2 questions actually:

#1: For the 5th parameter, which is GLvoid *pixels, does pixels have to be a pointer to a 2d array, or can it be 1d? I guess I'm curious how it's traversed. I'm using a 1d array of floats and doing my own pointer arithmetic..curious if i need to change this.

#2: What settings should I use for glPixelTransfer() and glPixelMap() and gPixelStore()???

thanks

J

Bob
04-28-2000, 02:15 AM
Q2 from post 1: Depends on how you want your application to work. If you just want to display a rendered image, you can copy it to the frontbuffer. If you want a smooth animation, you should always draw things into your backbuffer.

Q1 from post 2: What's the difference between 1D and 2D arrays? Not much, except the way you access then in your code. The only thing you have to think about is to store your image row by row (and in the proper format too http://www.opengl.org/discussion_boards/ubb/tongue.gif ). Your compiler might complain if you pass a 2D array because of the type, but all you have to do then is do a typecast.