   polygon problems
  hello,I need help filling in an irregular polygon for example, a polygon like the state of maryland. I tried using a triangle fan starting from the center. but as you can imagine for something like the state of maryland the mid points will be out side the actual polygon. So what i ultimately want to is draw a shape and fill it, kind of like the paint bucket on paint brush. Any suggestions or insight will be appreciated.Thanks for helping a noob,   
  Well are you using GLSL? or any shaders? If so draw out your image in PS or whatever paint program, such that the state is white and the background is black. Then if you have a Geforce 6/7 series card or Radeon 1000series card use PS3.0 feature called vertex texture and load that image as a texture and render the texture and walla, its bascially displacement mapping but as of now I don't have any other info on what you are using or trying to run this app on...   ;  You will need to look into polygon tessellation.  None of the OpenGL primitive types can properly render a complex polygon.GLU has a built-in polygon tessellator which takes a complex polygon and builds it into multiple triangle strips/fans or a list.  There even happens to be a nice tutorial on FlipCode which goes into how to tessellate with OpenGL.If you need any help with using the GLU tessellator after reading the tutorial, feel free to ask.  I (still) work with it quite a bit.;  mars_999 thanks for the link,I've read the tutorial and i tried to draw some of my polygons, but in some causes the combineCallback function gets an error. it appears that the vertex_data[2] and vertex_data[3] are set to NULL. I've tried looking for different combine callback methods but it all looks like the one in the tutorial none of does any kind of validation for the vertex_Data. is this not suppose to occur? I'll post the call back function and the array i'm trying to fill, i'm not sure if this is enough but if you need more please post a message.Thanks,void CALLBACK combineCallback(GLdouble coords[3],  GLdouble *vertex_data[4], GLfloat weight[4], GLdouble **dataOut ){   GLdouble *vertex;   int i;   vertex = (GLdouble *) malloc(6 * sizeof(GLdouble));   vertex[0] = coords[0];   vertex[1] = coords[1];   vertex[2] = coords[2];    for (i = 3; i < 7; i++){ vertex = weight[0] * vertex_data[0]; if(vertex_data[1]) vertex += weight[1] * vertex_data[1]; if(vertex_data[2]) vertex += weight[2] * vertex_data[2]; if(vertex_data[3]) vertex += weight[3] * vertex_data[3];   }    *dataOut = vertex;}GLdouble rect[75][3] = {-82,-241,0,-1,-401,0,79,-562,0,118,-648,0,150,-707,0,190,-785,0,195,-797,0,195,-797,0,249,-902,0,265,-933,0,296,-977,0,333,-1033,0,359,-1072,0,388,-1110,0,405,-1134,0,427,-1164,0,467,-1217,0,490,-1247,0,501,-1249,0,497,-1255,0,490,-1260,0,478,-1265,0,468,-1270,0,461,-1272,0,439,-1275,0,424,-1275,0,409,-1274,0,392,-1270,0,376,-1267,0,354,-1260,0,341,-1255,0,333,-1252,0,325,-1250,0,319,-1252,0,318,-1252,0,281,-1284,0,252,-1219,0,250,-1217,0,191,-1160,0,140,-1112,0,108,-1082,0,84,-1060,0,79,-1024,0,77,-1017,0,67,-1007,0,60,-999,0,44,-984,0,30,-970,0,12,-955,0,12,-955,0,-12,-898,0,-12,-898,0,-13,-892,0,-19,-883,0,-48,-863,0,-78,-842,0,-99,-820,0,-111,-792,0,-111,-763,0,-110,-733,0,-104,-708,0,-101,-690,0,-97,-655,0,-97,-625,0,-107,-590,0,-117,-565,0,-147,-522,0,-158,-500,0,-184,-468,0,-250,-388,0,-277,-336,0,-297,-310,0,-335,-245,0,-343,-193,0,-82,-241,0};;Quote:Original post by xwskxmars_999 thanks for the link,Who?  :)Quote:I've read the tutorial and i tried to draw some of my polygons, but in some causes the combineCallback function gets an error. it appears that the vertex_data[2] and vertex_data[3] are set to NULL.Hmm... the combine callback is only necessary if any given edge of your polygon intersects with itself.  If there are no intersections, then setting the callback to NULL should be sufficient.It might also help to scan over Chapter 11 in the Red Book.  That goes into more detail on the functions and how they are used.;  oops sorry for the confusion bpoint,my friend left his dog with me until friday and the dog is used to talking its walk and all that at 5:00 am, because my friend works early. unfornuately i don't walk up till 7:00 and once i wake up i can't go to sleep, so this whole week i've been tired, confused, and fustrated.Anyways back to the subject, i've read the comment on the redbook code and from my understanding if the lines don't interesect the callback function should not be called right? so does that mean interesecting from the point of origin or from the previous vectices?thanks again bpoint,   ;  oops never mind found the problem i was using some pointers and with similar names and i guess thats what caused the error because after i used the correct one it seems to work perfectly.thanks for the help bpoint!!!   