• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

205 Neutral

About incin

  • Rank
  1. Math Problem

    [font=arial, verdana, tahoma, sans-serif][size=2]0-100 gives 101 possible values. So to start out, you can sum & multiply by powers of 101. Suppose { V0,V1, V2, V3 ... } are the sequence of values: Sum = V0 * 101^0 + V1 * 101^1 + V2 * 101^2 ...[/size][/font] Now to unpack the values: V0 = Sum / 101^0 modulo 101 V1 = Sum / 101^1 modulo 101 V2 = Sum / 101^2 modulo 101 ... Of course, doing that would not be very efficient on a computer, not to mention you would need arbitrary precision integers if you wanted to store an arbitrary length list of numbers. If you're interested in compression, you're better off doing something else.
  2. GLSL driver crash

    Update (3): I believe i've tracked down the problem to using too much memory -- but I didn't expect the driver to crash. Essentially, I have an array: vec3[30] abc; If I change the array size to 3, it runs at FPS >1000. If I change to 20, the FPS drops to 500. If I go up to 30, it crashes. I've temporarily rigged the code so there's no difference in processing, it only uses the first array element. Why does using slightly more memory have such an effect on the runtime? Is there a rule-of-thumb memory limit in fragment shaders? Any input is helpful, I'm a noob at this stuff.
  3. GLSL driver crash

    Update (2): I'm still getting crashes when I shouldn't. When I say crash, I mean that i get a black screen for a few seconds, and windows comes back and pops up a message saying the driver stopped responding and has recovered. Now i'm wondering if I should have bought NVidia?
  4. GLSL driver crash

    Update: I checked the driver version, and it wasn't quite at the latest version. So I went to install the new version, and got a BSOD. After getting the driver reinstalled, the shader will run once again. Is it possible that my shader corrupted some memory? Also, if anyone has any ideas about how to best debug these things, that would be great.
  5. I'm writing a fragment shader in GLSL. I'm pretty new to this, but have finally been having some luck getting stuff to work. But now I seem to have uncovered a bug with the driver or shader compiler. In essence, I'm doing this: [code] int myfunc(..., out vec3[4] myarray) { // do some crunching... myarray[0]=vec3(1,0,0); if (some_test) { // ___Uncommenting out this line causes the driver to crash___: // myarray[0]=vec3(1,0,0); } return 0; }[/code] Leaving the line commented out, it runs just fine. Uncommenting it should make no difference. Anyway, the question is: How do I figure this out? Tools, debug modes, log files? I'm using a Radeon HD 6800 -- on what I believe are the latest drivers. Any ideas?
  6. Math prob

    http://www.wolframalpha.com/input/?i=1/2+%3D+40/x http://www.wolframalpha.com/input/?i=1/2+%3D+40/(2+%2B+3x/2) Gotta love wolfram alpha :)

    I have the problem when running both programs on one machine as well.
  8. I'm getting the WSAECONNABORTED error on both sides of a TCP connection. This happens about 1 in 10 times I connect. If I don't get the error in the first second or so, it will stay connected without any problem. Any ideas or similar experiences?
  9. A c++ function to reduce a fraction

    You mean gcd? http://en.wikipedia.org/wiki/Greatest_common_divisor See Euclid's algorithm
  10. a slow 2D array

    I see no flicker doing this. Try printing all at once, and using newlines to clear the screen. import time c='* ' def showgrid(): g='\n'*80 for i in range(40): g+=c*20 print(g) showgrid() time.sleep(1) c='- ' showgrid() time.sleep(1) c='+ ' showgrid() time.sleep(1)
  11. a slow 2D array

    At very least you could create the string representing the grid first, and then call printf only once to print the whole thing.
  12. new typename ListIterator<T>::Link;
  13. C++ template of vector iterators?

    I totally agree this is the wrong way to do it, but here it is anyway: #include <iostream> #include <list> #include <vector> template <int ID> struct RtypePicker; template <> struct RtypePicker<0> { typedef std::vector<int> Container; }; template <> struct RtypePicker<1> { typedef std::list<double> Container; }; class C { public: C() { c0.push_back(1); c1.push_back(2.2); } std::vector<int> c0; std::list<double> c1; template <int ID> typename RtypePicker<ID>::Container::iterator getIterator() { void* containers[2] = {&c0,&c1}; typedef typename RtypePicker<ID>::Container Cont; Cont* c = (Cont*)containers[ID]; return c->begin(); } }; int main() { C myobj; std::cout << *myobj.getIterator<0>() << '\n'; std::cout << *myobj.getIterator<1>() << '\n'; return 0; }
  14. Python Help !

    1 1 2 The first two output 1, the third outputs 2. Don't think that self.x and C.x are equivalent though, they point to the same variable in this example, but x resides on the class, not on the instance.
  15. Python Help !

    What swiftcoder said should work. This works in python 2.6.2. Note that you want to use global only if the variable is global, not part of an object. x=2 class C: x=1 def hi1(self): print self.x def hi2(self): print C.x def hi3(self): global x print x c=C() c.hi1() c.hi2() c.hi3() ==== outputs ==== 1 1 2
  • Advertisement