Jump to content

  • Log In with Google      Sign In   
  • Create Account

jujumbura

Member Since 08 Aug 2005
Offline Last Active Oct 27 2015 10:02 PM

Topics I've Started

Manually run IOS UIEvent loop

27 October 2015 - 07:56 AM

I am working on a game, and I want to manually run the main event loop on IOS. That is to say, I want to dequeue the UIEvents myself from the source, and then send them on to the UIApplication.

 

I have found examples on how to do this for OS X, and it works. In that case, it is a matter of calling "nextEventMatchingMask" and then "sendEvent" on the NSApplication object. 

 

However, I cannot find the equivalent means to gather events on IOS with a UIApplication object. I have been reading about an "event queue", but I do not yet see how I could get a reference to this queue object. Does anybody know how I could acquire UIEvents from the source, so that I can send them to the UIApplication?


Data Flow Between Systems

01 September 2015 - 08:08 AM

Hello,

 

I was recently watching Mike Acton's talk at the CPP Con, regarding "Data Oriented Design", and I've been thinking a lot about how I might be able to structure my game code to better take advantage of cache coherency.  The ideal here would be that all major processing is done on contiguous arrays of data, directly in-order.

 

But I've been struggling on one particular aspect of this: the problem is that the ordering requirement between various systems is not the same.  For example, suppose I have a typical flow of data: I have high-level behavior that updates positions/rotations, which then needs to be transformed by collision and collision response, and then converted into matrix transforms for draw calls.  There are distinct ordering requirements for each step here: behavior will want data grouped by type, collision will want it grouped by spatial locality, and rendering will want it grouped by draw order/material/etc.  Beyond that, these requirements will change as the state of my game changes ( not referring to static objects here ).

 

This means that I cannot simply set up fixed arrays and run my processing in the same order across the board.  Somehow, I have to convert between the different orderings as I go.  Specifically I am considering the efficiency of the reads from the source, the writes to the destination, and then the reads at the destination.  I have thought of three possibilities to do this:

 

 

Maintain the data in linked lists per-system

 

- This is what I have done for many years to solve this problem.  It is easy to use, and there is no major processing required to maintain ordering.  But the issue is, you end up iterating ( reads at the destination ) out of order, and you have all the node values filling up your cache.

 

 

Use linked lists for indexing and copy to arrays per-system

 

- I have just recently tried this out.  The iteration at the destination is noticeably faster, but the copy ( writes to the destination ) is now out of order and takes longer.  Overall, it has been only a minor speed boost for me.

 

 

Copy to arrays directly and sort per-system

 

- I have not tried this out yet, but I intend to.  Theoretically this could have the least amount of cache misses as everything is done in order.  It's hard to believe that the cost of running the sort algorithm would not outweigh the gains, but I'll have to test that.

 

 

Does anybody else out there have solutions that I am not thinking of?  I'd be greatly interested to know how people tackle this kind of problem.

 

Thanks for reading!


[Android] - Swapping Apps

04 April 2014 - 11:41 PM

I have been messing around with Android NDK development for a while now, and I just recently got an animation viewer up and running as a NativeActivity App on my Android device.  

 

One thing I was shocked to discover, though, is that when I hit the "Back" or "Home" buttons while running my device, my App is given the "APP_CMD_DESTROY" command, signaling it to exit the thread.  I had assumed that when leaving an App, it retains a memory space which is restored when you return to that App.  But from this behavior, it appears that my App will be restarted from scratch each time I enter and exit.

 

I read up a bit on the Android lifecycle, which seemed to confirm this behavior.  The intent seemed to be using the "savedState" buffer to handle the restore myself.  If this is really the intended flow, I now have a lot more respect for every native App that seamlessly transitions in and out.  But if this is really true, then I'm wondering:

 

1) What is the max limit on the savedState size?  I'm assuming I couldn't copy my entire allocated memory range, for example.

2) Assuming the above answer is fairly small, doesn't that imply that you need to reload all resources again?  This seems like it would involve tons of loading time, even for a brief transition back to the main menu.

 

It just seems like I must be missing something.  I'm curiow now how iOS handles this...

 

Thanks for any advice!


Display Loop with Win32

30 November 2013 - 09:54 AM

Hello all,

 

I've been working on a little OpenGL test recently, and I was trying to set up smooth animation.  I am programming on Windows, using win32 for my application setup, and GLEW for my OpenGL calls.  I apologize in advance if this question is more win32 than OpenGL, but here goes:

 

My window is set up to support OpenGL, but is not full screen.  My main loop is the standard while loop, with a PeekMessage() once per iteration.  If no messages exist, I display and update my scene.  The display functions runs a bunch of OpenGL state changes, a few draw functions, and then calls glFlush().  Now, my expectation was that this loop would be running as fast as it can ( ie: no waits ).  But I noticed that my animations appear to be running at around 60 FPS; I profiled it with QueryPerformanceCounter(), and that does indeed seem to be the case.  

 

Initially, I had thought that perhaps one of my win32 functions was blocking in order to fufill some sort of requirement, but upon closer inspection it looks like it is actually my display function that is taking around 16.6 ms on average.  In that function I only call glFlush() at the end, I do not call glFinish().  

 

Does anybody know why this might be happening?  It's actually kind of what I *want* to happen, but I'd like to know why my loop is mysteriously locked to 60 FPS.  My understanding was that getting VSYNC with OpenGL and win32 requires special use of extensions to configure the swap interval, so I was pretty surprised with this behavior.

 

Many thanks for any advice!


Issue with GLEW, Eclipse, MinGW

11 August 2013 - 11:30 PM

Hello all,

 

I have just recently been trying to set up an OpenGL environment in Windows, using Eclipse as my IDE and MinGW as my compiler.  I am stumbling along so far, but have successfully gotten a simple window up and rendering with freeGlut.

 

However, I started running into problems when attempting to call the function "glGenBuffers()" to allocate a vertex buffer and an index buffer.  I realized then that I needed a utility to get access to the extension functions, which is when I started looking at GLEW.  I downloaded the source and built it with msys ( make ), and I am currently trying to get the library functional in my application.

 

Initially it would fail immediately with dll errors, until I put the built "glew32.dll" in my Path.  Now I can get past the starting point, but as soon as I call "glGenBuffers()", I get another missing dll error.  Specifically it says in my console window:

 

 

Error: dll starting at 0x772f1000 not found.

Error: dll starting at 0x760c1000 not found.

Error: dll starting at 0x772f1000 not found.

Error: dll starting at 0x77411000 not found.

Cannot access memory at address 0x0

 

 

I am a bit confused at this point.  I would assume that if I were still missing the dll file GLEW needed, it would still be crashing on startup.  But maybe the dll is just enough to keep it from crashing initially but not actually compiled correctly for my platform?  I did end up with my msys setup being unable to find MinGW, but it built GLEW all the same ( perhaps with a different, incompatible compiler ? ).

 

Sorry, that's a lot of balls in the air, I apologize.  If anybody has any good advice to track this sort of thing down, I'd appreciate it.

 

Thanks much!


PARTNERS