156 reputation
9
bio website
location United Kingdom
age
visits member for 3 years, 8 months
seen 22 hours ago

Click here to edit


Oct
20
comment Avoiding memory allocation in Android game development
@Ben The bullets in my game are objects, not particles, and they can be created/destroyed tens of times per second. I think I'm going to have to bite the bullet, so to speak, and try it. Pre-allocating things is preventing me from using proper OO techniques.
Oct
20
comment Avoiding memory allocation in Android game development
@ratchetfreak A List containing the offsets into the fixed array of objects which are currently dead? I guess a list of ints is pretty cheap.
Oct
19
comment Avoiding memory allocation in Android game development
@Ben So I'm trading the more or less constant time iterating through a number of arrays to create/process the objects they contain against the presumably much more uneven iteration through a list of dynamically allocated objects. I've never allocated memory in C/C++ and subsequently used it from Java (other than with OpenGL FloatBuffers and the like) although I am competent in C++; is it possible (ie to subsequently use the memory as if you'd done it via a call to new?)
Oct
19
comment Avoiding memory allocation in Android game development
@Ben Currently I allocate exactly nothing on the fly. I've pre-allocated an array of objects, and so when I need a new one in game I just iterate through that array for the first "dead" one, set it to "alive" and use it. I do this with particles too. I mean, for particles it would be insane to allocate/free tens/hundreds of 10 or 20 byte objects per frame, but less stupid to allocate a handful of 100 or 200 bytes objects.
Oct
19
comment Avoiding memory allocation in Android game development
@Ben Just updated tags; Java, and OpenGL. Toyed with writing the whole thing in C++ but having seen the performance so far that doesn't seem to be necessary.
Oct
19
revised Avoiding memory allocation in Android game development
edited tags
Oct
19
asked Avoiding memory allocation in Android game development
Sep
29
accepted How to specify colour in a single 32 bit value
Sep
26
awarded  Commentator
Sep
26
comment Making a game engine or using Unity3D?
@doppelgreener Dead link. For now, it's here: web.archive.org/web/20140811041509/http://scientificninja.com/…
Sep
24
awarded  Autobiographer
Sep
24
comment How to specify colour in a single 32 bit value
I guess I have to have an array of ints with which to feed the colour attribute, given that were I to continue to use a float there'd be some corruption to my RGBA int. (When changing my code to take your answer into account I discovered that I had to use ABGR format within my ints (the alpha is in the 8 most significant bits). I guess this is an endian thing - i'm using the native order in my IntBuffer)
Sep
23
comment How to implement color changing fragment shader?
Not sure those first two examples can both be gl_FragColor = vec4(vec3(uv.x),1.0); ? (Not being fussy - this answer helped me too!)
Sep
20
awarded  Critic
Sep
20
awarded  Teacher
Sep
19
comment How to specify colour in a single 32 bit value
@Aralox Thanks, that seems relevant. Seems that what I want would be GL_RGBA8UI. Sadly, it doesn't look like this is available on OpenGL ES 2.0 for Android: developer.android.com/reference/android/opengl/… Or am I misreading that? Should I be worried about trying to use 4 bytes instead of 16 to specify the colour of each particle?
Sep
19
revised Why is the origin in computer graphics coordinates at the top left?
fixed grammar
Sep
19
suggested suggested edit on Why is the origin in computer graphics coordinates at the top left?
Sep
19
comment How to specify colour in a single 32 bit value
@ratchetfreak Not sure what i'd do to the shader/attrib setup. What types do I use? How do I do the colour multiply?
Sep
19
asked How to specify colour in a single 32 bit value