projects

Tuesday, August 23, 2005


A box revolving in some axis.. software rendered using scanline technique. The box rotates realtime with very good fps. The result of the scanline is saved in a software buffer. Then the image from the buffer which is in RAM is drawn to the frame buffer (color buffer) using glDrawPixel(...) in 2D orthographic mode.
//rotate the box
box->RHAnimate(3.8);

//clear the software buffer..
BUFFER->ClearColorBuffer(0, 0, 255);

//do the scanline conversion..
scanline->ScanObject(box);

//draw to frame buffer...
glRasterPos2f(-1, -1);
glDrawPixels(600, 600, GL_RGB, GL_UNSIGNED_BYTE, BUFFER->GetColorBuffer());
Pressing the s or the p key will save the current frame as tga file.
  • p - from the software buffer.
  • s - from the opengl frame buffer
Both will produce the same tga file... but saving from the software buffer will be faster since the RGB information is not obtained from the frame buffer but from the processor memory (RAM) itself.

Still need to fix one more thing before procedding further..
In the picture there are two lines visible. This lines ofcourse should not be there.... and is occuring due to loss of information when a floating point is converted to inetger value.

0 Comments:

Post a Comment

<< Home