Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Displaying only part of the image

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    5

    Displaying only part of the image

    Hi I am making a grid based game with 2D animation. To draw 2D objects, I followed the steps in
    Code :
    http://www.gamedev.net/community/forums/topic.asp?topic_id=104791
    I was also able to display images using open gl using the steps in
    Code :
    http://www.nullterminator.net/gltexture.html
    Now, my problem is that I want to display only half (for example) of hte image. How do I do that? If I change the szie of the quad, it just resizes.

    Code :
    //if i try limiting the image to 50%, it just resizes
    glVertex2d(50%, 50%);

    Thanks!

  2. #2
    Intern Contributor Godlike's Avatar
    Join Date
    May 2004
    Location
    Greece
    Posts
    62

    Re: Displaying only part of the image

    You can change the texture coordinates of your quad. Generally the texture coords vary from 0.0 to 1.0. If you limit X from 0.0 to 2.0 you will draw half the image across the X axis. I hope I understood correctly your question.

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    5

    Re: Displaying only part of the image

    Thanks for the answer. Limiting the texture coords solved my problem!

Posting Permissions

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