Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 15 Jun 2007
Offline Last Active Jan 11 2013 05:32 PM

Topics I've Started

GLSL rounding errors?

07 January 2013 - 10:30 AM

Hey guys,

I've got the following weird issue.

I'm trying to implement multipass lighting and I encountered some sort of Z-fighting issue. I perform one ambient/diffuse pass with glDepthFunc(GL_LESS) and then a additive light pass with glDepthFunc(GL_EQUAL) with depth writes disabled. When I pan my camera around, I get huge flickering artifacts.

The vertex shader for the light pass contains:
uniform mat4 uModel;uniform mat4 uView;uniform mat4 uProjection; void main() {aPosition = uView * uModel * vPosition;gl_Position = uProjection * aPosition;
I'd pass aPosition to the fragment shader to do the lighting with. When I change this to:

aPosition = uView * uModel * vPosition;gl_Position = uProjection * uView * uModel * vPosition;
it suddenly works without flickering. What's going on?
Does an assignment inbetween some math expressions create errors?

Thanks a bunch! smile.png

GL_NV_draw_buffers on Android/Tegra. Where can I find the headers?

04 July 2012 - 05:33 AM


I would like to use the gl_nv_draw_buffers extension, which should be available on all tegra devices. I found the following header file:


However, I'm not sure how to use this, as it is not part of android. The official NDK doesn't contain a version of gl2ext.h which defines gl_nv_draw_buffers.

I would like to know where to get the official headers as used by NVidia. Also, I would like to know how to use these properly. Should I put them in the android-ndk/platform directory somewhere?

Thanks a bunch!

GL_MAX_COLOR_ATTACHMENTS definition on android?

10 June 2012 - 09:21 AM

Hi everybody,

I would like to use FBO's on android. I know it's possible because of GLES20.glGenFrameBuffers() and the other related methods. However, I can't find GL_MAX_COLOR_ATTACHMENTS anywhere?

Do I have to define it myself? Is it contained in some other class which I need to import?


glDelete*** on android/OpenGLES 2

10 June 2012 - 08:49 AM


Do I always need to free every OpenGL resource using glDelete***, when programming for android in java? There is a garbage collector, but does it properly clean up these resources?

Can it hurt to leave everything in VRAM?

Thanks a bunch,

Game loop of an event driven engine

21 November 2010 - 12:32 AM

Hey guys,

I want to go down the event-driven/Observer-pattern path, but I need some advice now:

All the entities in an event-driven engine continously send events to eachother. So when should I go to the next frame?

Let me clarify my problem a bit more:

Consider the following events:

1. User presses CTRL-key
2. InputEntity converts it to an ACTOR_FIRE event and sends it to the actors.
3. The actor responds by sending a Raycast_callback event to the physics engine
4. The physics engine processes the event and sends Raycast_hit events to all the actors that were hit.
5. All the actors that were hit, AND who are human will die and send an ACTOR_DEAD event
6. etc etc...

Where should I stop and say "Hey, now we should render something and move on"?

I will create a single-threaded engine (may change in the future), so therefore I must process the events of my subsystems in a specific order. I've mentioned the steps, as described in the previous scenario.

> Process Input (Step 1 and 2)
> Process Actors (Step 3)
> Process Physics (Step 4.. Step 5 will happen in next frame).
> Process Rendering

So some operations like raycasting may be split into multiple frames because it involves interaction between multiple subsystems.

So what kind of game loop do I need here? What kind of problems do I need to look out for?