|
Hello all,
I was trying to use Tao framework 2.0 for C#.net and OpenGL. However, the tessellator in that version seems to be broken. Does anyone know of a way to tessellate a concave polygon (described by boundary only verticies) into a convex polygon (either save the verticies of the tessellated object with edge flags or into a format readable by OpenGL)?
Thanks,
Mike
P.S. If someone got The Tao Framework's tessellator to work, please let me know which version.
Gaming at the GuildofBlades.com is the only way to really experiece the level 99 Soul-Sucking Sword!
|
|
|
|
|
Take your vertexes that describe the boundary and order them. Then find the centroid point. Then make a triangle fan around that centroid.
Hope that helps.
|
|
|
|
|
I do not believe that will work. For instance:
Think of the letter: "U". The centroid is located in the bottom part of the U, but you cannot create a triangle fan around this point without making the U into a UV hybrid (pretty much a U with a V inside).
If I misunderstand, please correct me.
Thanks,
Mike
FREE 28 player online game @ http://www.1483online.com where the community drives enhancements to the game!
|
|
|
|
|
Hmmmm, misread that as convex, not concave :P
I think theres some routines in the GL Utility library or maybe in GLUT to do this. (Been a while since I've done any graphics programming
|
|
|
|
|
Hi there,
I want to list all links of website a) with my c# app.
Another website b) has an inline frame with the website a).
Using firefox I just klick in the iframe and then "Current frame -> view source".
Now i want to do the same in my application by accessing webBrowser.Document.Window.Frames[0], but i always get an "UnauthorizedAccessException was unhandeld" error form visual studio.
(I have to mention that, website a) is a third party website and not mine!)
But why can firefox access this site and list all the links and i can't?
any suggestions?
|
|
|
|
|
A good starting point would be that Firefox is not using the IE component. You perhaps need to check the docs and see what the right method is for you to use.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
It doesn't seem to be a general IE problem, i just tried the same with IE7: it works. But still not in my application
|
|
|
|
|
*sigh*
I am suggesting that you need to read the docs to find out how to get at the source, obviously the method you're trying to use is not working.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have few basic queries...pLease help!!
a) Can we have multiple Main methods in one class....? If yes how?
b) Can i have Main Method which returns otherthan Int value ?
Thanks!!
Thanks!!
|
|
|
|
|
a - of course not. You can only have one entry point. That entry point can call any other methods you like, and do it based in command line arguments if you'd like.
b - no.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Class MyClass contains a number of FindAll() methods in parent classes:
class MyClass: ActiveRecordBase<myclass> {... }
public abstract class ActiveRecordBase<t> : ActiveRecordBase {
protected ActiveRecordBase();
public static T[] FindAll();
public static T[] FindAll(params ICriterion[] criteria);
public static T[] FindAll(DetachedCriteria criteria, params Order[] orders);
public static T[] FindAll(Order order, params ICriterion[] criteria);
public static T[] FindAll(Order[] orders, params ICriterion[] criteria);
...
}
public abstract class ActiveRecordBase : ActiveRecordHooksBase {
protected ActiveRecordBase();
protected internal static Array FindAll(Type targetType);
protected internal static Array FindAll(Type targetType, params ICriterion[]
criteria);
protected internal static Array FindAll(Type targetType, DetachedCriteria
detachedCriteria, params Order[] orders);
protected internal static Array FindAll(Type targetType, Order[] orders,
params ICriterion[] criteria);
...
I need to invoke MyClass parameterless FindAll() method using Reflection.
I tried the following code but GetMethod() returns Ambiquous match found
exception.
How to run parameterless FindAll() method ?
How to add required method signature to GetMethod() parameters or other
solution ?
Type t = Type.GetType("MyClass, MyDll");
// this line causes Ambiquous match found exception :
MethodInfo mi = t.GetMethod("FindAll",
BindingFlags.Public |
BindingFlags.FlattenHierarchy |
BindingFlags.Static);
IList<object> list = (IList<object>)mi.Invoke(null, null);
Andrus
Andrus
|
|
|
|
|
Hi
You need to be more specific regarding the method that you want to invoke, when you are using reflaction on an object that have overloading methoods.
try using the following instruction :
MethodInfo mi = t.GetMethod("FindAll", BindingFlags.Public | BindingFlags.Static, null, Type.EmptyTypes, null);
|
|
|
|
|
My problem is, that I want to use 'objects', or what I should call them, in other functions than the one they were created in. For example:
public void button1_Click(object sender, EventArgs e)<br />
{<br />
StreamReader SR = new StreamReader(@"C:\test.txt");<br />
}
Since the StreamReader named SR is defined in button1_Click, I can't
access it's functions - for instance, SR.Write() - in other event handlers
or functions. For example, if I create a new event handler for a button called button2, and type SR, it can't find it, since it is defined in button1_Click.
How do I fix this? How can i access SR's functions in another event handler?
Hope you could understand it
- And yes, I know that I just could define the StreamReader outside a function/event handler, but I still want this one to work.
- Virtual1ty
|
|
|
|
|
No way.
That's how variable scopes work, you can't simply say "but I want it differently".
The compiler won't allow anything else.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Are you telling me, that this isn't possible in ANY way?
- Virtual1ty
|
|
|
|
|
If you don't want to create a new language and build your own compiler for it (and I assume you don't want to because you asked this question in the C# forum), the answer is "no, it isn't possible".
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks for your answer.
- Virtual1ty
|
|
|
|
|
That's not possible. When the method ends, the variable goes away. You can't access it from any other method, because it only exist while that method is running.
---
single minded; short sighted; long gone;
|
|
|
|
|
Awwww. That's not fair. I want my code to leak memory like a sieve just because I might want to use a variable again at some point in the future. I know - I'll make everything global static, then that will solve everything; oh wait my program's taken up all of the stack space.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Any reason you want a member variable, and NOT define it as such ?
One thing you can do is define an anonymous method for an event, inside this method. The variables inside the method are then scoped to that code. So, if you do this:
StreamReader SR = new StreamReader(@"C:\test.txt");
myTimer.Tick += new delegate()
{
SR.Read();
}
Assuming that Read is a parameterless method on the streamreader, this would work.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
how to calculate the code execution time in nanoseconds
|
|
|
|
|
You can use the System.Diagnosics.Stopwatch class.
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: use the System.Diagnosics.Stopwatch class
But the OP wanted in nanoseconds. Only way I think that can be achieved is through an unmanaged .dll using the rdtsc instruction...I've got one around here, maybe I should write out a quick article on it
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Right, the StopWatch class only gives microsecond resolution.
I wonder if the OP really needs nanosecond resolution, or if he meant microseconds...
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: I wonder if the OP really needs nanosecond resolution
I wondered the same thing. I find the .dll utility class that I created that works with rdtsc as being a bit too granular, but it's there if I need to get that fine of a resolution.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|