Jump to content
  • Advertisement

Painless

Member
  • Content Count

    150
  • Joined

  • Last visited

Community Reputation

126 Neutral

About Painless

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Painless

    [java] Java Event Polling

    Are you redrawing on mouse/keyboard input? I've never had any problems taking keyboard/mouse input by listeners, but if your mouse/key responses are very heavy, that might be a problem.
  2. Painless

    2D Transformation Query

    [ a b c ] * [ x ] [ d e f ] [ y ] [ 0 0 1 ] [ 1 ] = [ x * a + y * b + c d * x + e * y + f 1 ] Just set c and f to 0.
  3. Painless

    [java] Why use Java3D?

    Quote:Original post by misterX productivity!!! I had to make a simple FPS in Java 3D retained mode and I hated it. I don't know if immediate mode would have been any better. I'm almost certain that if I could have used C++ and Direct3D for the same project, I would have had a faster, better-looking and overall more robust program ready in less time. The only use for Java3D that I can see is toy programs where you have some cute, simple shapes that you can drag around.
  4. Painless

    Is my Gouraud broken?

    Since you say the problem appears inside triangles and not on the edge, it does sound like a problem with the gouraud shader itself (that should be just linear interpolation). I recommend trying it with a box first since it's simpler than a sphere, if that looks right, check your sphere data.
  5. Painless

    Memory leaks in C++

    As Miserable said, use RAII. More specifically, for containers, use the STL ones - they don't leak (but your own allocations might - they don't call delete automatically). Also learn to use smart pointers, boost::shared_ptr is quite good. I don't know about Unix, but the poor man's way to detect leaks is to overload ::operator new and ::operator delete so they log the amount of memory allocated and put logging blocks around scopes that aren't supposed to allocate any permanent memory.
  6. Painless

    [java] loop help with swing

    Quote:Original post by NightMonkey The JTextArea.getText() function only reads the text currently in the text area it does not wait for the enter key to be pressed. You need to use some kind of keyListener/actionListener to know when the user has finished typing. This monkey is telling the truth! Also, unless this is supposed to be real-time, you might want to put the whole thing in a modal dialog - that way, you can just call dialog.show() and then collect the answer.
  7. Painless

    [java] loop help with swing

    Well, you didn't give the types of any of the variables, but if "text" and "inputField" are Swing objects, it's pretty safe to say that inputField.getText(); //gets the text text.getText(); //gets the text from the text area won't do anything useful. Also, for debugging, try adding an else clause to that big series of ifs so you can see when text (I think you should have inputField.getText() there?) isn't any of the "legal" inputs.
  8. Painless

    10 files in my project... wow.

    Quote:Original post by Eleventy In my FPS game engine, I have 1 ~350KB .cpp file (about 10,000 lines) and 1 .h file. Still too lazy to split them up, and as of now I have to use the search function to find the function I want to work on. I'll probably get around to organizing my code in the next half a year or so. Be careful not to fall asleep during that half a year or you might never be able to organize that. Anyway, my biggest project was 134 .cpp + .h-files, 7454 loc. It was pretty awful - no design, lots of tiny classes with "funky" multi-inheritance hierarchies and no real concept of subsystems. I might still be able to understand how it works but I certainly don't like it.
  9. Painless

    Rendering seas

    A shadow map blur algorithm I coded did like 20 fullscreen passes per frame with fairly complicated (50-60 instructions, lots of dependent texture reads) ps2.0 pixel shaders and still got something like 5fps on Radeon9700pro. So yeah, pixel shader to render a sea surface would be fine.
  10. Quote:Original post by Conner McCloud EverIce, please don't take this post as a suggestion, because I'm fishing for ideas myself. But doesn't defining a friend class provide the same basic functionality of an inner class in Java? The only real difference that I see is that A is publically available in C++, whereas in Java it is only accessible through X. CM Not quite. In the Java code I showed, instances of class A are always tied to instances of class X. Therefore, they can access instance members of class X without need to specify an instance of X. This is great, because it removes the need to keep around (not to mention initialize) that annoying mOuter variable. Sure, it is pretty much just "syntactic sugar", but it tastes very good. Java also has an excellent "anonymous inner class" concept.
  11. This is one of the things that I really like in Java: inner classes solve this problem very nicely. [source lang = "java"] class X { class A { void calcSomething() { int i = num(); ... } } int num() { ... } }
  12. Painless

    How well you know your c++?

    Undefined behavior, I think - accessing *p after deleting it could just give you 4 anyways (if the OS doesn't mind you accessing memory you don't own), or it might open a gateway to inferno, requiring space marine tech support. Iostream.h is also undefined by the standard, so who knows?
  13. I think that only applies to the relative comparisons ( < <= > >= ), not == and !=. Note that even for those, there might be problems if you're using multiple inheritance (I think casts can change pointer values).
  14. Painless

    Int to Char?

    Couldn't some of this stuff be added to the FAQ? I think this, as well as "NULL or 0?" and "HN - good/bad?" gets asked every month, and the FAQ could at least contain links to those threads.
  15. Painless

    Turning a Positive into a Negative

    Quote:Original post by iMalc This thread is absurd! a = -a; Done! You have not properly documented the preconditions and postconditions and the complexity of this "function", and thus your solution is worthless.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!