Results 1 to 6 of 6

Thread: Image scale with OpenGL

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2005
    Location
    Shenzhen,China
    Posts
    5

    Image scale with OpenGL

    In a real-time image system, To scale image cost lots of CPU circles, for every image frame, a resample process needed.

    So , my question is:
    could the image-scale done by GPU, if so , please show a little bit guides on how to do it with openGL?

    Image scale:
    To resize a picture or image from original size to another size without obvious information lost. when we ajust the replayer/window-media-player 's window size, we do a image scale.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jan 2004
    Posts
    314

    Re: Image scale with OpenGL

    It all depends on what you want to do with it.

    If all you're interested in is displaying a (relatively static) picture, you only need to render one textured quad:

    1. Upload texture, specify minification/magnification options (texture filtering) - you'll probably want to use GL_LINEAR.

    2. When refreshing the screen, render a textured quad.

    If you want to retrieve the results, you can use glReadPixels, but it's a slow operation.

    If you want to get more advanced filtering (more advanced than simple linear interpolation), you might be able to use a fragment program for it, but it's more complex to get that to work.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2005
    Location
    Shenzhen,China
    Posts
    5

    Re: Image scale with OpenGL

    Thanks.

    In fact, I want to scale an real-time video image(25Frames/second), so I need so fast scale operation. could texture quad work?

    Thanks again.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jan 2004
    Posts
    314

    Re: Image scale with OpenGL

    In principle: yes. One textured quad won't be a problem at all.

    But it all depends on how fast textures can be read in and uploaded to the card.
    You'll probably not want to create mipmaps, since those cost performance to create.

  5. #5
    Junior Member Newbie
    Join Date
    Jul 2005
    Location
    Shenzhen,China
    Posts
    5

    Re: Image scale with OpenGL

    Thanks T101,

    I have tried , create and read a 1024*512 2D_texture cost 5ms on my PC.

    But I dont know how to scale the 2D_texture and dispaly it on the screen.

    hope for your guide.

  6. #6
    Senior Member Regular Contributor
    Join Date
    Jan 2004
    Posts
    314

Similar Threads

  1. how to scale a rgb image with opengl api
    By ccczzzlll in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-17-2012, 09:18 AM
  2. How to scale the image
    By pnpvivek in forum OpenGL: Windows
    Replies: 8
    Last Post: 01-07-2009, 08:45 AM
  3. scale an image
    By dmf9000 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-24-2004, 01:19 AM
  4. how to show the grey-scale image?
    By in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 09-30-2003, 01:37 PM
  5. how i can scale a image from a opengl view
    By jeselviz in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 05-14-2001, 05:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean