Automatic commit of irc logs
[ipdf/documents.git] / irc / #ipdf.log
index 3470f59..e88900a 100644 (file)
 00:26 <@matches> I am not good at OpenGL/SDL
 00:26 <@matches> I am the master of producing a black screen
 00:26 <@matches> Also we have FILLED and OUTLINE the wrong way round still
+14:01 < sulix> Bunch of bugfixes incoming.
+14:01 < sulix> I'm not proud of what I did to glReadPixels, but it works.
+14:02 <@matches> Uh oh
+14:02 <@matches> I just worked it out!
+14:03 <@matches> The dreaded merge begins
+14:03 <@matches> I'm tempted to just delete my changes and merge yours but I should probably do a real merge
+14:04 <@matches> I fixed it (on my machine at least) by: Using GL_BGRA instead of GL_RGBA (should probably detect which one to use from the screen's format)
+14:04 <@matches> And calling glReadBuffers and glPixelStorei before glReadPixels
+14:05 < sulix> glPixelStorei is probably nicer than what I'm doing.
+14:05 < sulix> I tried just giving SDL a negative pitch and a pointer to the bottom-right corner of the buffer, but somehow it didn't like that much.
+14:07 <@matches> You do actually check the byte order which is good
+14:08 <@matches> I worked that out but basically just changed it to match my machine :S
+14:08 < sulix> There are a bunch of endian problems in the load-save code anyway if we want it to run on big-endian machines.
+14:09 < sulix> (Well, big-endian documents don't load with little-endian code and vice-versa)
+14:10 <@matches> http://szmoore.net/ipdf/code/src/screen.cpp
+14:10 <@matches> Is the merge
+14:10 <@matches> Which one is better?
+14:11 < sulix> I think yours will still get the bitmaps upside down?
+14:11 <@matches> Ah yes they do tend to be upside down
+14:12 < sulix> I'm not sure you should need the front buffer stuff anymore with mine, so if you just keep mine (which is doing the flipping), everything should work.
+14:12 <@matches> Woah you fixed the FILLED vs OUTLINE
+14:12 < sulix> I did test overlaying bitmaps and it was fine.
+14:12 <@matches> Good
+14:12 <@matches> Does this seem like a better way to compare approaches than using a template and having View<float> View<double> etc?
+14:13 <@matches> It means recompiling
+14:13 <@matches> But it means a lot less templates
+14:13 <@matches> Pretty much the entire thing has to be templatified that way
+14:13 <@matches> And then there's the issue of what type the document is saving with
+14:13 < sulix> I think, long term, it'd be worth just extending the view to have a "bounds" and a "high_precision_bounds" or something.
+14:14 < sulix> But that is kind-of ugly.
+14:14 <@matches> I think it's probably nicer to just have real.h contain nothing but a typedef
+14:14 <@matches> And just recompile with a different typedef and overlay the images
+14:15 < sulix> Yeah, but there are some artefacts that really show better in motion, so it's probably worth supporting that at some point.
+14:15 <@matches> True
+14:15 <@matches> But including a video in the pdf will be difficult anyway
+14:16 < sulix> (Clearly, we should add embedded videos to ipdf)
+14:16 <@matches> You could also make a movie using ffmpeg
+14:16 <@matches> Haha
+14:16 < sulix> (I've got some OpenGL video playback code somewhere...)
+14:17 <@matches> In fact, if you can output a video you can just overlay two videos
+14:17 < sulix> Oh... my... god!
+14:17 <@matches> I don't know if there's a better way to make a video but I'd just be saving a .bmp every frame and then combine them all with fmpeg
+14:17 < sulix> Nope, that's probably a good way.
+14:18 < sulix> With some MAGIC it wouldn't even be slow.
+14:20 <@matches> Whoops your code isn't giving me a second bmp anymore
+14:20 <@matches> At least, not one that has pixels that aren't white
+14:20 <@matches> Does my glReadBuffer thing work for you?
+14:21 < sulix> Hmm...
+14:21 <@matches> Can fix the upside-downness some other way
+14:21 < sulix> Did you make clean
+14:21 < sulix> Because main.cpp/main.h won't recompile otherwise.
+14:21 < sulix> And I moved the glClear() calls.
+14:22 <@matches> I did make clean
+14:22 < sulix> Which is a less hacky way of solving the problem than reading the front buffer.
+14:23 <@matches> So the problem is that the texture rendered by Screen::RenderBMP isn't in the buffer that glReadPixels reads from?
+14:23 <@matches> (Even though it gets shown on the screen fine)
+14:25 < sulix> Hmm... it works fine here with or without glReadBuffers.
+14:27 < sulix> Try changing it to save the screenshot before calling scr.Present() in main.h
+14:29 <@matches> That works
+14:29 <@matches> But why?
+14:29 < sulix> Because when you call Present(), it allocates a new buffer to render into.
+14:30 <@matches> Right
+14:30 < sulix> This is so that you can start rendering the new frame immediately, rather than having to wait for the window manager to actually re-render the screen.
+14:31 <@matches> I have merged it
+14:33 < sulix> Excellent.
+14:33 < sulix> This is much more fun than literature!
+14:33 <@matches> :S
+14:35 <@matches> It's important
+14:35 <@matches> It's part of the timeline
+14:35 <@matches> Just you know
+14:35 <@matches> It comes after the Literature Review
+14:37 < sulix> Strictly speaking the Lit Review deadline is past, now, isn't it... :/
+14:38 <@matches> Well technically it was never a deadline for me... :P
+14:38  * sulix sighs
+14:38 < sulix> I'm special.
+14:39 <@matches> I need to read that last paper on FPUs more
+14:39 <@matches> It was talking about how there are all these software techniques from the 1960s that can actually be done on the FPU itself
+14:40 <@matches> I'll probably just work on getting our / jop's FPU working for different sized floats instead
+14:40 <@matches> In theory that will teach me how they actually work
+14:40 <@matches> Then I can actually understand the papers
+14:40 < sulix> But can you write about it in a Lit Review?
+14:42 <@matches> Maybe not so much the Lit Review, but it means I can write the Background section that explains how they work
+14:43 <@matches> There's probably some early papers on them that I can reference at the same time if I try hard enough to find them
+14:44 <@matches> The modern papers all have a lot of assumed knowledge
+15:59 <@matches> Instead of reading papers I have progressed towards compiling different types and then overlaying them
+16:02 <@matches> I didn't know you could do such cool things with Makefiles and flags to the compiler
+16:02 <@matches> If people knew more about this maybe we wouldn't have to have python
+16:03 <@matches> I will learn to do all my highlevel programming using Make
+19:48 <@matches> Our Render/Screenshot combo for overlaying bitmaps and $$$ only works the first time it is done
+19:49 <@matches> Or maybe it's RenderBMP that only works once
+19:49 <@matches> Hmm
+19:52 <@matches> I swear the format was BGRA earlier and now it's RGBA
+19:53 <@matches> This can probably get fixed after some Literature Review
+20:09 <@matches> Anyway you can now set the type of Real with `make DEF=-DREAL=X`
+20:09 <@matches> Or `make single` and `make double`
+20:09 <@matches> 0 and 1 respectively
+20:09 <@matches> I tried a little bit too hard to get it working with actual C strings
+21:32 <@matches> Minutes now have less "~*" in them
+21:32 <@matches> Wrong channel
+21:32 <@matches> Very wrong channel
+--- Day changed Mon Apr 21 2014
+12:32 <@matches> Literature Review O'Clock
+12:36 < sulix> I have just returned from my Easter holiday and have some horrible code for you to scream at while I have lunch. :P
+12:43 <@matches> Uh oh
+12:44 <@matches> stb_truetype ?
+12:44 <@matches> DejaVuSansMono.ttf ?!
+12:44 <@matches> Is this going to render a font...
+12:45 <@matches> Woah
+12:47 <@matches> Looks good
+12:48 <@matches> I think I will avoid looking at stb_truetype too closely...
+12:48 <@matches> Too late
+12:48 <@matches> Why are all the implementations in the .h file
+12:48 <@matches> And the .cpp file just has some defines...
+12:48 <@matches> shudder
+12:53 <@matches> I particularly like #define STBTT_assert(...) do {} while(0)
+12:53 < sulix> That's a standard way of doing that. SDL_assert does the same thing.
+12:54 < sulix> It lets you put a semicolon after it or use it in an if() statement without braces, etc, without things breaking horribly.
+12:56 <@matches> But... your assert doesn't actually assert anything?
+12:56 < sulix> That's because you generally only want it enabled in debug builds.
+12:56 <@matches> I guess
+12:57 < sulix> So typically you'd have it as do {} while(0) in release builds, and something like a function call in debug builds.
+12:57 <@matches> So what is this "more code" going to do :P
+12:57 < sulix> Slightly more modern opengl.
+12:58 <@matches> Yeah, that would be a good idea
+12:58 < sulix> In particular, uploading the content of a document to a VBO, and just re-rendering from that when needed.
+12:58 <@matches> Cool
+12:58 < sulix> Jumps from 9 fps -> 37 fps with 1024^2 objects.
+12:59 < sulix> I've been without internet, though, so it's pretty broken in many ways, still.
+12:59 < sulix> Like outline rects don't work.
+12:59 < sulix> And it still uses a bunch of OpenGL 1.0 stuff.
+12:59 < sulix> And for some reason the glPrimitiveRestartIndex() function isn't working.
+13:00 < sulix> Also I need to write shaders at some point, which will be work.
+13:00 <@matches> I just found the best comment in an IEEE email list
+13:00 <@matches> We should totally use it
+13:01 <@matches> "It is too late now to repair the mistakes of the past that are present in millions of installed systems, but it is good to know that careful research before designing hardware can be helpful"
+13:01 < sulix> Oh man, that's basically the thesis in one sentance.
+13:02 <@matches> Dibs!
+13:02 <@matches> Although I doubt anyone will care if we both quote it
+13:03 < sulix> One thing I did discover reading my OpenGL book is that I think we can get OpenGL to use doubles with some shader hackery.
+13:03 <@matches> :O
+13:03 < sulix> Then again, the book was (partly) written by (one of) the authors of fglrx, so take it with the requisite salt.
+13:04 <@matches> Ah, so how many goats were required?
+13:05 < sulix> Just the two, I think.
+13:06 <@matches> This email message seems sort of vaguely relevant? It's the "infamous double rounding problem"
+13:06 < sulix> I take it that you worked out how to swap between CPU and GPU transforms with right-click.
+13:07 <@matches> I read it in the commit message
+13:08 < sulix> I was quite happy with how much nicer things ran with CPU transforms and doubles.
+13:08 <@matches> I think I can see a difference zooming in far enough
+13:08 <@matches> Yeah that's a huge difference
+13:08 <@matches> I had a tester that was going to automatically make images of the difference when you zoomed in really far
+13:09 <@matches> But there were issues with the screen shot / bmp rendering
+13:09 <@matches> Probably the bmp rendering
+13:09 < sulix> .bmp files suck.
+13:10 <@matches> They are nice and simple though?
+13:10 <@matches> At least, the SDL API is nice and simple
+13:10 < sulix> That's more a triumph of SDL than of the .bmp file format.
+13:10 <@matches> After looking through gm6 files with a hex editor to try and extract sprites...
+13:11 <@matches> Well we could always just fwrite the pixel buffer and fread it back
+13:11 <@matches> If you want no one to be able to use our files without compiling our program :P
+13:12 < sulix> I'm personally a fan of LodePNG, but I'm too lazy to hack it in at the moment: http://lodev.org/lodepng/
+13:13 < sulix> I'm probably going to get around to fixing all of the warnings in stb_truetype one day.
+13:13 <@matches> Haha
+13:13 <@matches> What about implementing an Oct-tree?
+13:14 <@matches> So .bmp is just a header and then the raw pixel data? What's disgusting about that? No compression?
+13:16 <@matches> Wait png is also just a header and then an IDAT section
+13:17 <@matches> Oh well you can put lodepng in if you want I guess
+13:17 <@matches> As long as I can open the images in eom
+13:18 <@matches> Ah so PNG is compressed. I missed that
+13:19 <@matches> Meh
+13:19 <@matches> Oh and alpha channel
+13:19 <@matches> Yeah
+13:19 <@matches> I remember that now
+13:20 <@matches> xpaint is the least shitty of the shitty sprite editors in debian, but it only stores RGB because it was designed around bmp and I guess they just hacked on exporting to other formats later
+13:21 <@matches> If you open things with alpha it gets really confused
+13:23 < sulix> You can put alpha in .bmp files, but then they sometimes crash KDE.
+13:26 <@matches> We can just run all our bmp files through image magick
+13:26 <@matches> convert a.bmp a.png
+13:26 <@matches> Done
+13:27 <@matches> Hmm, maybe if I opened the data from the gm6 files as png they would work, I was assuming they were bmps -_-
+13:27 <@matches> Actually gif
+13:27 <@matches> Probably
+13:28 <@matches> Since it has "Save as gif"
+13:28 <@matches> But that is not relevant to this project
+13:33 < sulix> Damn, just discovered that the opengl feature I was using for rectangle outlines is not supported by my laptop's hardware.
+13:34 < sulix> (This explains one of the bugs I've been seeing, but sadly only one)
+13:47 < sulix> Okay, remaining code pushed.
+13:47 < sulix> I am sorry.
+13:53 <@matches> I'm messing around trying to do something evil so I'll merge later
+13:53 <@matches> But you don't seem to call ToggleGPUTransform when there is a right click
+13:54 <@matches> Oh wait, I need to make clean
+13:54 <@matches> Cool
+13:54 <@matches> (So much for our Makefile magically tracking the header files :S)
+13:58 < sulix> It does it for every header file except ones included by main.cpp because of the weird main.cpp swapping stuff.
+13:59 <@matches> That main swapping stuff is amazing
+13:59 <@matches> It is worth it
+13:59 <@matches> Except main.cpp ends up eventually including all the header files
+14:00 <@matches> I think there is an alternative Makefile that just has every single header file in the current directory as a dependency for each .o file
+14:01 <@matches> But I'm normally used to running make clean anyway
+14:22 <@matches> Eh I was going to make a video of the difference between GPU and CPU coord transforms but it's not that great
+14:23 <@matches> Whatever you have done does not look happy
+14:24 < sulix> It takes like 5 minutes to DebugDumpObjects with a million objects, but it works okay* after that.
+14:24 <@matches> Yeah ok
+14:24 < sulix> *well, sort-of.
+14:25 < sulix> If you just want to show off the precision, getting rid of most of those objects is probably the right thing to do.
+14:25 <@matches> Interesting things happen when you zoom out really far
+14:25 <@matches> Do we care about that
+14:25 < sulix> I'm going to go with "no".
+14:26 <@matches> Ah, but the rectangles are not all the same size
+14:26 < sulix> This is a product of rounding to the nearest pixel. They'd be fine with antialiasing.
+14:29 <@matches> I have pushed a single line contribution
+14:29 <@matches> I decided not to bother with all the changes I made to make the video prettier
+14:29 <@matches> Since I can't actually capture my desktop properly anyway
+14:30 <@matches> I suppose I could make it render bmps and ffmpeg them all but that is way too much effort
+14:31 <@matches> So
+14:31 <@matches> Literature Reviews
+14:31 <@matches> They are a thing
+14:38 <@matches> I probably should not reference an email thread
+14:53 <@matches> In other news, I think this jvm FPU doesn't actually implement sqrt
+14:57 <@matches> It always gives 0x0 on sqrt ops
+14:57 <@matches> I certainly hope there isn't a jvm somewhere that just doesn't do square roots
+14:58 <@matches> They probably hacked it into some other part of their project instead of putting it in the FPU
+16:08 <@matches> So fprintf style formatting isn't very clever when it comes to floats vs doubles vs long doubles
+16:11 <@matches> Eg: %lf will work for either floats or doubles and %f will work for either floats or doubles (by truncating) but %llf is the only thing that works for long doubles and it only works for long doubles
+16:12 <@matches> s/truncating/casting whatever
+16:52 <@matches> We can compile with long double
+16:52 <@matches> I suspect this may break things but whatever
+16:52 <@matches> Running calculatepi on motsugo to see how much difference it actually makes...
+17:08 <@matches> Charles Babbage seems like an interesting fellow
+17:09 <@matches> "e sought to prove the
+17:09 <@matches> reality of the devil by drawing with his blood a
+17:09 <@matches> circle on the floor and repeating the Lord’s prayer
+17:09 <@matches> backward"
+17:09 <@matches> The things one does for science
+17:44 <@matches> Reading about Charles Babbage counts as Literature Review...
+17:44 <@matches> Actually I'm trying to find a paper written *by* him
+17:44 <@matches> Since apparently he came up with Floating Point representations
+22:11 <@matches> Found an actual paper talking about floating points on GPUs
+22:12 <@matches> It says they don't conform to IEEE and also the manufacturers don't like to tell people what they do do
+22:12 <@matches> So they wrote a version of Paranoia, which was a test program for computers in the 1980s before IEEE, to work out the characteristics of flops on various GPUs
+22:13 <@matches> This is probably of interest
+22:14 <@matches> So far one of the best papers I have on algorithms in software is actually one talking about implementing those algorithms in hardware instead
+22:15 <@matches> I also have a random obituary to Charles Babbage just because
+22:16 <@matches> Unfortunately UWA directs me to some useless website that just tells me the citation details and doesn't give me a download for any of Babbage's papers
+22:17 <@matches> He has some books but they are mostly about economics
+22:18 <@matches> Would have been nice if he'd written something that says "I have invented floating point" but I guess not
+22:18 <@matches> That's only really of historical interest but it'd be nice

UCC git Repository :: git.ucc.asn.au