Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4034256
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:56:58+00:00 2026-05-20T11:56:58+00:00

I need to draw a gridded image using opengl. I’ve read that images created

  • 0

I need to draw a gridded image using opengl. I’ve read that images created using grids allows to do various effects on images, like the famous wave effect, or a ripple effect from this link:

http://www.soulstorm-creations.com/index.php?option=com_content&view=article&id=111:opengl-making-a-2d-grid-image&catid=18:programming-articles&Itemid=39

I’ve also gone through lesson 6 android port from NEHE Tutorials:
http://insanitydesign.com/wp/projects/nehe-android-ports/

I can convert it from cube to rectangle, but I need help in understanding
1) why we are using vertex coordinates in terms of 0 and 1? Why have they not used coordinates according to image width and height?
2) How can we divide the texture region in small grids as explained in tutorial above? If some one can guide on 1), I guess I can work on point 2).

Any help would be really appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:56:59+00:00Added an answer on May 20, 2026 at 11:56 am

    The vertex coordinates are from 0 to 1 so that you can use vertex data with many different textures without worrying about the dimensions of the image.
    That said, for pixel perfect operations you often have to often the texture coordinates by a fraction the image’s pixel width (say 0.5f * (float) image->width()) and height in order to make sure OpenGl (or d3D) samples from the correct place.

    As for dividing the grid, straight forward simple linear interpolation. If you have a grid going from pixel coordinates 0 to 100 and you want 10 steps in your grid, you start at 0 and increment in steps of 10 pixels :

      vertex_xi =  (start_x + ((end_x - start_x) / 10) * i));
      vertex_yi =  (start_y + ((end_y - start_y) / 10) * i));
    

    similarly,, for texture coordinates, you’d do the same thing only you usually name them like this:

      vertex_ui =  (start_u + ((end_u - start_u) / 10) * i));
      vertex_vi =  (start_v + ((end_v - start_v) / 10) * i));
    

    where ‘start_u’ and ‘start_v’ are ‘1.0f +/- offset and end ‘end_u’ and ‘end_v’ are ‘1.0f +/- offset’. Put those in your vertex array and you should be good to go.

    HTH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to draw the following figure in openGL. I tried to do that
I need to draw images into a CALayer because I need to perform various
I need to draw an image using 4 points. I have these 4 points
i need to draw something like the image below using WPF... i need this
I need to draw concentric arcs of various sizes using raphael.js. I tried to
I need to draw 3d projections and i am using opengl wrapper for JAVA.
I need to draw a spinning globe using opengl es in android. I think
I need to draw a lot of lines. I'm using UIBezierPath for drawing lines
I need to draw 2D overlay over OpenGL scene. OpenGL is used for 2D
A need to draw an X in a View using Shapes , but the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.