Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: drawing pixels

  1. #1
    Advanced Member Frequent Contributor
    Join Date
    Aug 2000
    Cardiff University

    drawing pixels

    Hi all,
    Ok with my project I am drawing an image, but the problem is that i need to perform an operation on every pixel. Currently its running at about 5-10fps and it needs to be real time. I have tried most simplistic speed measures. I am using draw pixels, as I thought that the constant loading of textures to memory would make texturing a quad slower? The image can get to about 500^2. Currently using gl bytes and GL_RGB, any other pointers or things I can turn on/off that will make an impact? My client is suggesting that I pre create all the images... uuuggghh, hardly ideal, especially due to the amount of code that would become redundant!



  2. #2
    Junior Member Regular Contributor
    Join Date
    Sep 2003

    Re: drawing pixels

    From the Red Book:

    glDrawPixels() - Writes a rectangular array of pixels from data kept in processor memory into the framebuffer at the current raster position specified by glRasterPos*().

    Try using textures - a 512 x 512 RGBA image is 1 MB, so you can keep a fair number of them resident even on a card with low memory (say, 32 MB, by todays standards), plus they can be DMA'd to the card, which is probably the real advantage.

  3. #3
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000

    Re: drawing pixels

    "I am drawing an image"
    What type of application is that?

    "the problem is that i need to perform an operation on every pixel"
    What operation exactly?
    Could you do that using fragment shaders on the GPU?

    "I am using draw pixels"
    Generally not a fast solution.
    Make sure everything affecting a simple 2D copy is off, like depth test, lighting, texturing, vertex and fragment programs, blending, etc.

    "Currently using gl bytes and GL_RGB"
    Try GL_UNSIGNED_BYTE in GL_BGR or GL_BGRA order as input. Some hardware uses that as native format and wouldn't need to swap R and B of your input data.

    "My client is suggesting that I pre create all the images"
    How many?
    Do you get them from a changing input or are they all based on one single input with the "operation you need to perform on each pixel"?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts