Sign in to follow this  
frapell

OpenGL OpenGL Draw lines and render them in perspective

Recommended Posts

Hi all, this is my first post, and i'm learning OpenGL, and to do so, i wanted to start a project...

Basically, i'm developing an android app that eventually (i hope :P) will be somehting like this[0] but using data from OpenStreetMap.

I'm currently stuck with the street rendering.

As i have vertex coordinates (latitude and longitude of the nodes that form the street) i started using them to render the streets using GL_LINE_STRIP.
Also, using glLineWidth so they look like streets instead of pathways :P

When i got familiar with that, i started to play with the gluLookAt function... and here is where my problems started. Lines do not play nice with perspective.

As i found reading other forums and every result google gave me, i have no option but to use GL_QUADS to render rectangles that look like lines.

This sounded logical, until i started to think in all different shapes that a street can have. That's why i'm here, seeking for advice.

How can i think this ? how can i get the needed vertex to draw the quad, based on the information that i do have ? also, is there any other way of doing what i want to do ? or rendering the quads is the only way ?

I'm attaching an image to explain a little better. The blue dots are the data i have (coords for the x and y position of each vertex), the red dots are the ones i need to figure out where to place them so i can render the quad (being the grey parts in the image)

Hope someone can give me some pointers because i'm a bit lost here :(

Thank you very much in advance.

Kind regards

[0] - http://media.shinyplastic.com/prodimg/garmin-885t.jpg

Share this post


Link to post
Share on other sites
Given the input data you have, you can compute the mesh data procedurally. (If the minimum interior angle allowed is ~90 degrees, and if the width is relatively small relative to the segment lengths, the process is actually fairly straightforward.)

I don't know how this fits in with the Android side of things, but in theory at least, the geometry you're looking for can easily be generated with a little vector math.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this