Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

Christoph Menge

@Christoph Menge
About
Posts
18
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • doubles a == b or not ?
    C Christoph Menge

    Well, I have a question there. Maybe I am getting something wrong. I agree these statements hold true if you force the result into a temporary variable, e.g.

    double x1 = x + x;
    double x2 = x - x;
    then x1 + x2 = Infinity + 0 = Infinity

    (or float, alternatively). However, as long as the statement is not forced into a double, the value is computed with 80bit precision, thereby correctly evaluating to 0.0 in all cases given?! From the little I remember from assembly, you will push values onto the (80bit) floating-point stack using fld, then perform floating point operations such as fadd, fsub, fmul (which expects its arguments at positions 0, 1 of the fp-stack and moves its results to st0), and pop the result off the stack using fstp or fistp for integer-targets. This raises the interesting question of debug vs. release: If the compiler optimized floating-point code, it would allow for more precision by holding temporary results in the fp-stack. While this would increase precision, it'd also cause inconsistent behaviour. I haven't encountered the latter so it probably doesn't, but it might be worth checking. EDIT: I just found this interesting post on the net, addressing exactly these issues: http://blogs.msdn.com/davidnotario/archive/2005/08/08/449092.aspx[^]

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    Clever Code csharp help question

  • Plagairism site?
    C Christoph Menge

    Ah... sorry, I don't have even the slightest clue :) Not only that I don't know a word (or char) Chinese, my English doesn't seem to be too good, either... I wanted to express that you could have basically written anything in Chinese, and I have no way to determine whether it was broken or not (but I guess you reffered to pronounciation anyway). Or .. something like that... perhaps. Peace! ;) Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    The Lounge com question

  • Plagairism site?
    C Christoph Menge

    Hey James, I got the email including those Chinese letters and I've been laughing my head off! :laugh: 'broken Chinese' yeah, right... Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    The Lounge com question

  • Plagairism site?
    C Christoph Menge

    You can't get a hold of him anyway if he is in China... So why pay for privacy? Anyway, the site is reachable and does not perform too bad right now. It looks messy though. I think he wants lots of page views from search engines for his ads... Of which there are LOTS. There's an anti-spyware ad on the sidebar right now... ironic, somehow, uh?! Cheers, Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    The Lounge com question

  • OpenGL- Tao- VB.Net simulating motion and zoom
    C Christoph Menge

    Hi, from what you say I guess you don't really have a rendering-loop. See, your OpenGL image is drawn this way: 1. Clear screen (glClear(), etc.) 2. Draw allvisible objects in a certain order (lots of code) 3. Wait until OpenGL finished drawing (glFlush()) 4. Swap front/back buffer to make the newly drawn objects visible (SwapBuffers()) So you have to remember a list of objects you want to draw. When one of your buttons is clicked, it should do sth like that: myRenderList.Add(someObject); myOpenGLControl.Invalidate(); Note: Do NOT put any OpenGL commands in a button. You should have one and only one loop to do all the GL stuff! Managing scene information (all objects, how to describe them, whether they are visible, etc.) is the hard part - the OpenGL commands are comparatively simple. (See the term 'scene graph' for more on that). For text rendering, check NeHe's tutorial[^]. He presents three options. You might want to take a look at EaseSDK[^] to make things easier. It includes CeGUI, which supports not only text rendering, but real GUI elements such as buttons, scroll bars, etc. Regards, Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    Graphics csharp graphics game-dev help

  • Draw Text in C# using OpenGL
    C Christoph Menge

    Hi, the link to NeHe works out for me. If it doesn't work, you might want to google it or visit gamedev.net, which links to NeHe. As for the code you supplied, I don't see any trouble. However, the problem might be caused by your update/resize methods. The question is: Under which circumstances do you redraw the screen? You have to do that whenever Windows tells you to do so, because it might have invalidated the screen. This can happen when resizing, minimizing, when another application draws in front of yours or even if a different control receives focus. The latter happens upon click, so make sure you redraw the scene for the events named above. Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    C# help csharp c++ graphics game-dev

  • Prefix or suffix? [modified * 2]
    C Christoph Menge

    Hi Vikram, what I meant is: "Is correlation alone a sufficient description for the entity, or is it necessary to call it liveCorrelation?". In essence, I prefer GetHistoricalCorrelation() over GetCorrelationHistorical() like most (all?) of the other posters did. Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    The Lounge java com json question

  • Draw Text in C# using OpenGL
    C Christoph Menge

    Hey, be careful not to mix up things here. First, OpenGL is a native C Library, so 'talking to' OpenGL, at some point, requires you to communicate with it - good news is, you don't have to that yourself (but you can if you want to). Check out the following libraries which may help: o Tao Framework[^] o EaseWrapperSDK[^] NOTE: Tao is for C#, EaseWrapper is for C++. If you haven't worked with managed C++ / Interop, look at Tao first. Tao has more to offer than just wrapping OpenGL, by the way (also wraps SDL, OpenAL, etc.) Second comes text rendering. There are a number of ways to it: o Manually. This involves a texture which contains letters and numbers. Then, you render little rectangles with orthographic projection on the screen. For a GUI, you want to do this after the scene is rendered. This is not as hard as it may sound. o Using a library such as glFont. As far as I know, glFont is a program or a library. Its not an OpenGL-Command. However, I don't know any C# gl font-render libraries, so again you might have to mess with a managed C++ wrapper. o Using a high-level library such as CeGUI which has a lot more to offer than text rendering. It is included in the EaseWrapperSDK, but it's also C++. There might be a GUI library in Tao, I'm not sure. I suggest you go for Tao and have a look at thoseNeHe Lessons[^] which concern font rendering. He presents a number of options. NeHe's tutorials are available as C#, but you will have to (in other words, you should) convert them to Tao if you use it. Hope that helps, Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    C# help csharp c++ graphics game-dev

  • Prefix or suffix? [modified * 2]
    C Christoph Menge

    Hey Rajesh, obvioulsy we agree on this :-) I just read a few lines of "Code Complete 2" about naming methods: "To name a procedure, use a strong verb followed by an object" As you pointed out already, "Get" is already a strong verb - so the real question here is whether "Correlation" itself can be regarded as an entity - but that requires some knowledge about the subject matter (which I don't have). However, in "Code Complete", Steve McConnell also points out that in an OO-environment, the method itself does not need to include the object name, because it is included in the invocation such as myHistoricData.GetCorrelation(). I think I'd still go for this, if possible. On the other hand, that might raise question whether to name the class/webService "financialDataHistoric" or "historicFinancialData"... Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    The Lounge java com json question

  • [Message Deleted]
    C Christoph Menge

    My expert opinion is you should not post unformatted code, especially when its XML. I won't read an XML file with > and < instead of the '>' and '<'-symbols, not to talk about syntax highlighting. I cant even copy&paste the code this way.

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    WCF and WF

  • Prefix or suffix? [modified * 2]
    C Christoph Menge

    So you are 'defaulting' to Live, and Historic is an option, so to speak? I think, its best to use either no defaults, thus creating GetLiveCorrelation(); GetHistoricCorrelation(); which seems clearer to me and is less implicit. Or maybe you put it into different services. Somehow, I feel you are creating a decorator/wrapper of what could easily be two interfaces. For some reason, I really dislike the suffix option, especially when paired with the default option of leaving 'live' out. Cheers, Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    The Lounge java com json question

  • OpenGL- Tao- VB.Net simulating motion and zoom
    C Christoph Menge

    As long as your window cannot be resized, you do not really have to handle the resize event, that is true. However, as it is basically no more code (because you can just move most of your inialization code into it), I consider it better. When a control is invalidated, you force the control and its children to redraw. The Invalidate()-method and the Refresh()-method do exactly that (only the latter also forces immediate redraw). Both methods are implemented by Control. However, Tao's SimpleOpenGlControl also offers a Draw()-method. It's implementation is rather simple: public void Draw() { this.Invalidate(); } So it is essentially all the same thing! I suggest, however, to use the Draw()-method because future releases of the control might behave differently.

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    Graphics csharp graphics game-dev help

  • OpenGL- Tao- VB.Net simulating motion and zoom
    C Christoph Menge

    Hi, do you invalidate the control somehow when changing yTrans? Otherwise, you won't notice any change. Check whether the Paint method is called at all using the debugger. EDIT: 2 more things: 1.) Handle the Resize-Event and do the following: Sorry, this is C#, but I don't really have an idea about VB. I guess this will help anyway: // Some private variable that stores initialization status. // Set this to true after InitializeContexts(); private bool initialized = false; protected override void OnResize(EventArgs e) { if (initialized) { MakeCurrent(); Gl.glViewport(0, 0, Width, Height); Gl.glMatrixMode(Gl.GL_PROJECTION); Gl.glLoadIdentity(); Gl.glOrtho(0.0, 10.0, 0.0, 10.0, -10.0, 10.0); Gl.glMatrixMode(Gl.GL_MODELVIEW); Gl.glLoadIdentity(); } } Also, make sure xTrans is not negative. Last, why do you call SwapBuffers(), although you set AutoSwapBuffers to true before? Hope this helps, Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    modified on Sunday, February 24, 2008 4:35 PM

    Graphics csharp graphics game-dev help

  • Efficient Real-Time X-Y Plotting/Graphing
    C Christoph Menge

    Hi, somehow, I don't see why you posted this to the WPF Forum: You are asking for a data structure or an algorithm. This is independent from the way you display it. Next, why do you have to process all points every time you update? Do you need real-time averages or something? Just moving the graph can certainly be accomplished in a smarter way. Concerning patterns/straight lines: Are you sure that your data will ever show up something like that? Measurement data is almost never precise enough. There are, however, interpolation and approximation algorithms using polynomials, splines, etc. But this is not exact anymore, and if the algorithm screws up, you might not notice that (e.g. you data jiggles wildly but the interpolation comes up with an almost straight line). In general, if this is measurement data, you should keep the original input somewhere or have your algorithm determine the interpolation/approximation error. It really depends on what you're up to. Note that these algorithms are usually computationally expensive, so it is probably not a good idea to apply them in real time. Are you sure you will have so many points that memory will be the bottleneck? Cheers, Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    WPF csharp wpf data-structures regex tutorial

  • Play AVI streams in Vista/Longhorn
    C Christoph Menge

    Hi, just a guess, but what about codecs? Do you have the same codecs installed? Do the movies play with Media Player? Cheers, Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    C# csharp question

  • Seems familiar?
    C Christoph Menge

    Less subtle, and probably posted a thousand times: bool b = whatever; switch(b) { case true: // do something break; case false: // omg... do something else? break; } Seen as PHP-Code... This is completely unrelated, but it just came to my mind...

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    The Weird and The Wonderful database question

  • How to generate random number [modified]
    C Christoph Menge

    Hi, what exactly are you trying to accomplish? Do you need a specific distribution, or a constant length, for example? If you just need some keys that do not collide, i.e. keys which are (almost) unique, you might want to take a look at UUIDs or GUIDs. They are time-based, but in a more subtle manner. Their length is constant. However, they are usually written in hexadecimal strings, e.g.: {2AED1BB2-7314-43e9-9DE7-8AAB3BBC20C1}. Or do you just need something like Random a = new Random(); string x = String.Format("{0}{1}", a.Next(), DateTime.UtcNow.Ticks); ? yielding, for example, this:

    "2143552667633393651580403445"

    Note that this has a variable length, because

    a.Next()

    returns some number which can be shorter or longer. Also note that a, if initialized without a seed will use the system time as seed, thus creating completely different numbers on each run (these alone, however, have a rather large chance of colliding). In general, there are no keys which can *never* collide (unless they have infinite legth...), but you can make it extremely unlikely to happen. Hope that helps, Chris

    "Obstacles are those frightening things you see when you take your Eyes off your aim" - Henry Ford
    Articles  Blog

    C# help tutorial lounge

  • WPF improvements and new controls
    C Christoph Menge

    Cool thing, thanks for the info! Good to know that "DropShadow and Blur bitmap effects, [...] are currently software rendered [...]". One stupid question, though: Is it still necessary to almost 'hack' the button control to create a CommandLink? I don't understand why they hide such things... Just a thought. Chris

    The Lounge csharp announcement asp-net wpf graphics
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups