glEdgeFlag

i don’t have a strong allegiance to APIs in general. i try to do all of my work from scratch. still opengl has treated me good, and i like the general structure, and i think its something graphics people are likely to be comfortable with.

so sometimes i build APIs for my systems which mimic opengl structure as close as i can afford. i’ve built a run-time opengl parser, so i know if i stick to the format, building a run-time parser for a given api should be as simple as ‘copy paste’ to use a windows euphamism.

today i’m considering mimicing the seemingly quirky little glEdgeFlag and would like to hear maybe something more about it.

best i can tell glEdgeFlag is soley for when rendering in line polygon mode. it seems that when rendering polygons as lines you can control whether or not edges are rasterized with glEdgeFlag via assigning flags to their starting vertex.

i’m assuming it maps well to all triangle display modes (TRIANGLES,QUADS,TRIANGLE_STRIP,etc)… if not please let me know.

it is said that glEdgeFlag defines boundary and non-boundary edges.

i’m working with this interesting real-time nurbs system i’ve devised. it is real-time so effeciency is the key. it is subdivision based so it helps to start with a highly regular mesh (regular triangle area, rather than necesarrilly a regular grid connectivity). a nurbs parameterization may not be very regular though for complex models. so the idea is to map a subdivision type polygon model onto the parameterized surface via the polygon models texcoords (actually technicly the system reserves texcoords for actual texture coordinates, and rather vertices are assigned ‘parameter2f’, which function like texcoords but are indapendant, for spatial mapping to the nurbs base model). this mesh is not required to be a grid, so it can map well to an irregular parameterized surface.

so the idea is to provide an api for defining this initial mesh (subdivision lvl0).

right now i’m planning two flavors, one using opengl immediate mode, and and another based on glDrawElements et al.

one thing to be clear about is you would not run through this mapping process each frame as if drawing the manifold… you would just do it once to set it up and from there a clod based renderer takes over.

the issue arises in for instance, if two ajacent strip are rendered, then the system must internally be able to to recognize the overlapping vertices and connect the ajacent triangles so that subdivision will be continuous.

algorithmicly this is a bit tricky, but not the issue. the thing is, i wonder if it is always apropriate to assume that overlapping vertices should be merged, or if i should let the user explicitly define non-boundary edges via a glEdgeFlag analog.

i wonder if i’m being too nit-picky, but relying on EdgeFlag would also relieve the internal algorithm a great deal in many cases.

all i’m really asking though is what is the history of glEdgeFlag. does anyone ever use it, or is it just a quirk?

i want to provide an interface that will be intuitive for everyone to get started with, but i’m sure in the in a custom file format will be available for maximal effeciancy in managing connectivity. but at least this api serves as a basis for generating the initial connectivity relationship.

sincerely,

michael

PS: i realize as a start this thread is a lot more jabbering than real curiosity. but i’m trully interested in whether people would be comfortable using a glEdgeFlag type construct in this respect for total control and internal effeciency, or whether i’m going overboard here. also as ever interested in any kind of lateral suggestions whatsoever. -michael

Edge flags are beyond quirky.

No, they don’t work for TRIANGLE_STRIP, TRIANGLE_FAN, or QUAD_STRIP. Just TRIANGLES, QUADS and POLYGON.

Second, they work in both LINE AND POINT PolygonMode.

Third, they interact with clipping, (including client-defined clip planes).

2.6.2, 2.12 and 3.5.4, are the areas you will want to look at most closely.

-mr. bill

Originally posted by mrbill:
[b]
No, they don’t work for TRIANGLE_STRIP, TRIANGLE_FAN, or QUAD_STRIP. Just TRIANGLES, QUADS and POLYGON.

-mr. bill[/b]
it seems to me like they should work for the complex primitives. according to the docs i have, they flag the first vertex… or wait a second, i think they should work in immediate mode with complex primitives if done right, but i don’t figure they could work for DrawElements because associating the edge flag with a vertex and all of the vertice’s connecting edges just wouldn’t do i’m afraid.

so it looks like a useless construct for my constraints then really.

oh well, for the best of me i couldn’t think of a single reason why someone would want a subdivision system not to merge edges with overlapping vertices anyhow.


totally off topic, i’m building a software caching system for emulating the opengl immediate and DrawElements api.

i could really use some stock optimized assembly code to work with for run of the mill functions like a straight binary search/insertion on a fixed width array. some kind of quick sort might do if it can overwrite duplicate entries (or i just decide to ignore duplicates).

basicly cache address insertion and retrieval in software… can anyone recommend an optimal way to go about it???

edit: oh yeah, i meant to say i did my best to try to find an online stock assembly code repository but couldn’t find anything like that. any suggestions?

sincerely,

michael