Pixel drawing

Pixel drawing

Post by Gavin Kinc » Fri, 10 Mar 2000 04:00:00



I'm am trying to write directly ot the frame buffer using code like
this:

  glRasterPos2i(minX, minY);
I am trying to write to the fram buffer using code like this:

glRasterPos2i(minX, minY);
glDrawPixels(maxX, maxY, GL_RGB, GL_FLOAT, image);

where everything is positive

image is a float*. It is filled up using this function:

glReadPixels(minX, minY, maxX, maxY, GL_RGB, GL_FLOAT, image);

When I run the program nothing is drawn. If I output the current raster
position it returns the default value of (0, 0, 0, 1)
But surely then it would be drawing from the bottom left of the window?
Using the current values it should output exactly the same image, but it
don't ;-) Can anyone help?

 
 
 

Pixel drawing

Post by Paul Mart » Fri, 10 Mar 2000 04:00:00



Quote:> glReadPixels(minX, minY, maxX, maxY, GL_RGB, GL_FLOAT, image);

> When I run the program nothing is drawn. If I output the current raster
> position it returns the default value of (0, 0, 0, 1)
> But surely then it would be drawing from the bottom left of the window?

What do you base this assumption on? The raster position is transformed just
like a glVertex; it will only map to the bottom left corner of the window if
you have set up your ModelView and Projection matrices to make this occur.
--
   -Paul Martz
    Hewlett Packard Technical Solutions Lab
    Remove DONTSPAM to reply

 
 
 

1. Fast Pixel Drawing

[ Article crossposted from comp.sys.mac.programmer ]
[ Author was Vince Tourangeau ]
[ Posted on Fri, 28 Oct 1994 03:21:36 GMT ]

What's the fastest method of writing a pixel to the current CGrafPtr?
I'm currently writing my own graphic routines for the game I'm
designing - QuickDraw seems way too slow for some things, so I'm
trying to optimize all the commands for what I'm doing. Right now, I'm
calling SetCPixel to write to the current port. Is there a more direct
way of doing this? Come to think of it, how do I write directly to an
arbitrary PixMap?
        Thanks,
                Vince

----------------------------------------------------------------------
Vince Tourangeau
Carleton University

_______________________________________________________________
(Insert witty quote above)


----------------------------------------------------------------------

----------------------------------------------------------------------
Vince Tourangeau
Carleton University

_______________________________________________________________
(Insert witty quote above)


----------------------------------------------------------------------

2. gif89a

3. Need help with glOrtho

4. simple animation... avoid sub pixel drawing

5. gluCylinder - between 2 vertices.

6. Exact pixel drawing in SGI-OpenGL

7. Rotate fonction curves in track view (MAX 3)

8. Last pixel draw

9. Slow pixel draw solution?

10. MY DRAW PIXELS WON'T DRAW PIXELS!

11. How do I plot pixels/draw lines in C/Win'95?

12. Pixel by pixel bitmap drawing (like landscape in worms)