Sign in to follow this  

GL_POLYGON

This topic is 4354 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well this seemed like google was a no brainer but I cannot seem to allocate any general information on this. See I got these rooms, all I have are points in the room, so taking this room data and turning it 3D I feel should be a simple process with the theory I've built. Just use GL_POLYGON, if it acts how it sounds, then all the rooms, odd shaped ones even should work out no problem just by throwing the points at GL. Am I right? Is there a limit to the number of points? How fast is it? Is it the slowest of them? how hard is the performance hit (maybe 4 rooms at most being rendered at once)? Will this work for concave convex rooms? Like where some points are actually behind their last point? (Edit: tried to draw some ASCII shape examples but forum messed them up to many times, so imagine convex and concave polygons) I'm trying to find out really if I'm down the right track before I begin programming the project based on this idea. Thanks for any help, Halsafar

Share this post


Link to post
Share on other sites
You can very easily use GL_POLYGON to render any concave or convex shape. Converting your polygons to a 3d level should be pretty easy, as long as you know the height of the floor and the ceiling in each 'room'. Once you have the floor and ceiling rendered as GL_POLYGON and the sides as GL_QUADS, just render the whole thing as a display list for an immediate performance boost. If you really need more than that for such simple geometry, break it up into smaller segments (all the rooms in once section of the map in one display list, all the rooms in this corner in another, etc.) and render only the ones that the player can see.

Share this post


Link to post
Share on other sites
Concave polygons are not guaranteed to render correctly! For more information please see:

http://www.flipcode.com/articles/article_tesselating.shtml

Best is to perform your own tesselation.

Share this post


Link to post
Share on other sites
As much as I enjoyed Daedalus' answer (wasn't that a FF6 boss?) I believes gold's answer hits the spot more. I read over that entire page, I do believe with a bit of work I can get that to work out for me, except that left a few questions unanswered.

Textures?
If I lay out this complex concave polygon (texture coords included) and allow it to split it up into easy to render convex polygons, will the texture still render okay? Will I run into any problems with some more advanced rendering tecniques using this?

Share this post


Link to post
Share on other sites
Am I right in thinking that any Convex(and some, if not all, concave) polygons could also be rendered with GL_TRIANGLE_FAN with only one additional point? Would this be faster or slower than GL_POLYGON?

Share this post


Link to post
Share on other sites
Afaik TRIANGLE_FAN is convex only but I'm not sure.

I'd still like an answer to the texture question, will Polygon Tessellation via GLU totally mess up texturing? Or complicate it... I suppose I'll have to proceed down this road and find out.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ezbez
Am I right in thinking that any Convex(and some, if not all, concave) polygons could also be rendered with GL_TRIANGLE_FAN with only one additional point? Would this be faster or slower than GL_POLYGON?
Triangle fans can render any convex polygon without adding any points. They can render some (certainly not all) concave polygons without adding any points depending on which point you start the fan from, and could render some more concave polygons by using a new point as the first point in the fan. If you have the points for a concave polygon, it is much safer to tesselate it though.
Quote:
Original post by Halsafar
I'd still like an answer to the texture question, will Polygon Tessellation via GLU totally mess up texturing? Or complicate it... I suppose I'll have to proceed down this road and find out.
It complicates it a little bit. Read the Tessellators and Quadrics chapter of the Red Book for more information on using the GLU tesselation routines.

Share this post


Link to post
Share on other sites
Excellent RedBook article, I'm about half way through it.

What about some crazy shape like this:

Polygon???

Can this be tesselated in any sense?

Edit: That Redbook article above doesn't say more than one minor word on texturing these generated simple convex polygons.

[Edited by - Halsafar on January 12, 2006 2:11:04 PM]

Share this post


Link to post
Share on other sites
As in, yes that polygon can be tesselated or no that is to much.
I googled for awhile and found no such example of a crazy complex shape like the one above. I find many stars, squares with holes.

All I need a picture of a crazy shape like in my last post and someone saying they where able to tesselate it using the API outlined in the other replies in this thread. If so, then I'm set.

Share this post


Link to post
Share on other sites
How about this, I think the correct term for this type of polygon is a "Mono-connected polygon". (reference the link a few posts up)

Is the gluTessellation API capable of working with this?

Share this post


Link to post
Share on other sites
Quote:
Original post by Halsafar
Edit: That Redbook article above doesn't say more than one minor word on texturing these generated simple convex polygons.
If you look at example 11-2 in that chapter, you'll see a vertex callback that sends color along with the vertex coordinates. Adding texture coordinates is no different.

As for that polygon... why don't you just try it out for yourself and see if it works, surely that would've taken much less time than googling and then asking here and waiting for an answer? I would actually consider stars and polygons with holes more complicated because of the overlapping or direction-switching contours, so to answer your question I see no reason why the GLU tesselation routines couldn't handle that.

Share this post


Link to post
Share on other sites
Thank you, I will give it my own shot now.
I am not full of hours of free time and have several programming projects on the go. I felt I'd save myself the work load if this was not plausible.

Thanks for the help everyone,
Halsafar

Share this post


Link to post
Share on other sites

This topic is 4354 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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