From b17539df71843a2d782fd789407e52b8414bb09f Mon Sep 17 00:00:00 2001 From: C R Onjob Date: Thu, 17 Apr 2014 01:00:02 +0800 Subject: [PATCH] Automatic commit of irc logs Q: What's the difference betweeen USL and the Graf Zeppelin? A: The Graf Zeppelin represented cutting edge technology for its time. --- irc/#ipdf.log | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/irc/#ipdf.log b/irc/#ipdf.log index cdc8608..3470f59 100644 --- a/irc/#ipdf.log +++ b/irc/#ipdf.log @@ -337,3 +337,95 @@ 00:52 < sulix> (I guess you could have a "high-precision viewport" as well.) 00:52 < sulix> - The actual upload of graphics data to OpenGL is done as 32-bit floats, no matter the type of real, as that's all OpenGL supports. 00:53 < sulix> (At some point we'll have to actually do some view transforms on the CPU rather than just passing all of the bounds and viewport straight to OpenGL) +01:02 <@matches> Yeah I don't want to replace Real with templates +01:02 <@matches> That'd be horrible +01:03 <@matches> By the way, the introduction of SDL_Renderer in SDL2 is confusing +01:05 <@matches> I thought it was replacing Surface with Renderer and Texture +01:05 <@matches> But Surface seems to still be a thing +01:13 < sulix> Yeah: basically Surfaces are in CPU memory, textures in GPU memory. +01:13 <@matches> Right +01:14 <@matches> And renderers magically put stuff on surfaces/textures +01:14 < sulix> Yeah. +01:14 < sulix> So it basically represents the graphics card. +01:15 < sulix> But if you want to just use OpenGL yourself, you don't need to create a renderer at all. +01:15 <@matches> Ah, but the plot thickens +01:15 <@matches> I'm saving the window to a bmp +01:16 <@matches> Which requires a renderer +01:16 < sulix> Hmm... I'm not sure if that will work. +01:16 <@matches> It does +01:16 <@matches> It seems rather convoluted though to be honest +01:16 < sulix> (In theory, it shouldn't, but it probably actually does) +01:16 <@matches> I seem to remember it not being this convoluted in SDL1.2 +01:16 <@matches> -_- +01:16 <@matches> So the procedure is +01:17 <@matches> 1. Get a surface associated with the window +01:17 <@matches> 2. Allocate buffer of unsigned char for the pixels +01:17 < sulix> Yeah, TBH I prefer SDL1.2's rendering API, but I generally just use OpenGL anyway. +01:17 <@matches> 3. Get renderer from the window (NB: Don't use SDL_CreateRenderer, only the (undocumented) SDL_GetRenderer works because the Window already has a Renderer because it has been created with an OpenGL flag)... +01:18 < sulix> In theory we should probably use glReadPixels. +01:18 <@matches> 4. Use the magical renderer power to put pixels into the pixel array +01:18 <@matches> 5. Create an RGB surface from the pixel array +01:18 <@matches> 6. Now you can call SDL_SaveBMP, congratulations +01:18 <@matches> What's this about a glReadPixels +01:18 <@matches> I was just about to commit this +01:19 < sulix> Well, you can use glReadPixels instead of steps 1,3 and 4. +01:19 < sulix> (This is what SDL is doing behind the scenes) +01:20 < sulix> Unfortunately, the SDL wiki is still down thanks to heartbleed. :/ +01:20 <@matches> :O +01:20 <@matches> It was up when I looked at it before +01:20 <@matches> Throwing python exceptions when I tried the search function though +01:21 < sulix> Ryan said that it was up, but I'm still getting revoked certificate errors. +01:22 <@matches> Hmm, I needed to do step 1 in order to know the size of the pixel array in step 2... +01:23 < sulix> Screen::ViewportWidth(), Screen::ViewportHeight() +01:26 <@matches> Yeah this is looking a lot shorter than what I had +01:33 <@matches> It doesn't seem to work though +01:35 <@matches> I'm getting a segfault +01:35 <@matches> And of course valgrind automatically exits when it gets more than 1000000 errors from the flgrx driver +01:38 <@matches> First call to glReadPixels is OK but the bmp is just white, second call segfaults +01:39 < sulix> Hmm... what's the call? +01:44 <@matches> Segfault was due to me forgetting about the pixels needing 4 bytes for RGBA +01:44 <@matches> Still white though +01:45 < sulix> (That was going to be my guess) +01:45 <@matches> The advantage of getting the SDL_Surface +01:45 <@matches> Was that you just pass all the surf->format->format->stuff +01:45 <@matches> Everywhere +01:45 <@matches> Also makes it rather verbose +01:46 < sulix> The white screen might just be an fglrx bug. +01:46 <@matches> There we go +01:47 <@matches> No, it helps to remember that the pixels need 4 bytes for RGBA +01:47 <@matches> I have very selective memory +01:47 <@matches> I had to remember it for each line individually +01:47 <@matches> Right I guess it is slightly nicer now +01:47 <@matches> Although it has a bunch of magical "*4" everywhere +01:48 <@matches> I'm going to put this on Stack overflow as an alternative to the answer I was originally following +01:48 < sulix> Well, I'm going to attempt to sleep... +01:48 <@matches> Thank you for fixing my bug without seeing it :S +01:49 < sulix> I have far too much experience breaking glReadPixels... +01:53 <@matches> We need an easy way to compare our document rendering the same thing using a different Real and/or view representation +01:53 <@matches> Templates would only solve changing the Real and really they probably wouldn't actually solve it +01:53 <@matches> They'd just create nightmares +01:53 <@matches> Hmm +01:55 <@matches> Um +01:55 <@matches> Just looking at View::Render +01:55 <@matches> Why is there a seperate loop for each type of object... +01:56 <@matches> With "continue" statements for the other types in each loop +01:56 <@matches> Is this so you can just make one call to glBegin and glEnd... +01:56 <@matches> I am suitable scared +01:57 <@matches> suitably scared and also suitable scared +22:05 <@matches> Ok, trying again. This is the sort of thing a template is supposed to be used for... I just seem to always end up suddenly having to make everything all the way back to Document into a template class :S +22:07 <@matches> blergh +22:07 <@matches> trying again +22:07 <@matches> After getting coffee +22:07 <@matches> I think +22:30 <@matches> Ok, templates is way too complicated +22:30 <@matches> I am going to do the following instead: +22:31 <@matches> 1. Allow a "save this region to bmp" argument +22:31 <@matches> 2. It reads the specified bmp, saves a new bmp with the current view overlayed in a different colour or something +22:32 <@matches> 3. Makefile hacks to recompile the program using a different typedef of Real and then do 1. and 2. for them all +22:32 <@matches> 4. Realise I probably should have used templates +23:02 <@matches> So, according to my timeline that I haven't looked at since submitting the proposal, I will have done a draft literature review by tomorrow... +23:02 <@matches> Hah +--- Day changed Thu Apr 17 2014 +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 -- 2.20.1