Results 1 to 3 of 3

Thread: Scaling Pixel Data to Fit on Device Screen

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    2

    Scaling Pixel Data to Fit on Device Screen

    So here is my situation:

    I am trying to draw an image, pixel by pixel, on a 320x480 pixel iPhone screen.

    I'm doing this using GLDrawArrays( ). I create a vertex array including x,y pairs for all of the pixels on the screen (i.e., there are 320*480 x,y pairs in the array). Then I create an array that defines a color for each pixel (i.e., there are 320*480 colors in the array).

    This works well.

    Now, let's say that I now need to draw an image with 1024x480 pixels on the iPhone screen. I can no longer do a pixel to pixel mapping between the image and the screen. Does OpenGL ES have some way to squeeze this data onto the iPhone screen?

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Scaling Pixel Data to Fit on Device Screen

    I create a vertex array including x,y pairs for all of the pixels on the screen (i.e., there are 320*480 x,y pairs in the array)
    You don't need so many vertices. Four vertices on the corners of the rectangle are enough. You then apply a texture onto that geometry and that's it.

    I would recommend you to read some simple tutorials on texture mapping, which is the name of this technique.

    A quick search turned up this tutorial on texture mapping.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    2

    Re: Scaling Pixel Data to Fit on Device Screen

    That is perfect. Thanks for the help.

Similar Threads

  1. Positional data in pixel shader
    By mrflibble in forum OpenGL ES general technical discussions
    Replies: 3
    Last Post: 01-20-2013, 01:30 PM

Posting Permissions

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