• Advertisement

Archived

This topic is now archived and is closed to further replies.

polygon structure

This topic is 6217 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

hi, i''m trying to write your basic polygon proggy. basicall just a square or triangle on the screen that can be filled/texture.. just to get the hang of things.. so far i''ve been structuring my polygons like so: typedef struct { int x, y; } POINT; typedef struct { POINT p[3]; // 3 points to a triangle (duh) int x, y; } POLY; POLY tri; void init_poly() { tri.p[0].x = -40; tri.p[0].y = 42; // ... etc. } now.. i''m finding that is is not a good way to structure my polygons. could somebody please enlighten me thanks, Scott

Share this post


Link to post
Share on other sites
Advertisement
Hi

If you''re just trying to get your code working what you are doing is probably best as you can see the initial values clearly and manipulate them easily. The alternatives might be write a quick and dirty editor (just working with vertices/wireframe) or generate them programatically. Of course either of these methods could contain bugs which makes the debugging of your poly drawing code more difficult

Of course if your drawing code is fine and you need to init lots of shapes you''d better write an editor and load them from a file. At the end of the day you have to store the information somewhere it just depends how much data you have. The method of storage is of course dependent on what sort of access you need to the data... could be an array a linked list or whatever.

What stage is your code at?

Regards

Paul.

Share this post


Link to post
Share on other sites

  • Advertisement