0

I'm a novice in OpenGL ES 1.1(for IOS) texturing and I have a problem with making the effect of motion blur. During googling, I found that I should render my scene in different time moments to several textures and then draw all these textures on the screen with different alpha values. But the problem is that I don't know how to implement all this!So,my questions are:

  1. How to draw a 2D texture on the screen? Should I make a square and put my texture on it?Or may be, there is a way to draw a texture on the screen directly?
  2. How to draw several textures(one upon another) on the screen with different alpha values?

I've already come up with some ideas, but I'm not sure if they are correct or not. Thanks in advance!

Alex
  • 31
  • 5

1 Answers1

2

Well, of course the first advice is, understand the basics before trying to do advanced stuff. Other than that:

  1. Yes indeed, to draw a full-screen texture you just draw a textured screen-sized quad. An orthographic projection would be a good idea in this case, making the screen-alignment of the quad and its proper sizing easier. For getting the textures in the first place (by rendering into them), FBOs might be of help, but I'm not sure they are supported on ES 1 devices, otherwise the good old glCopyTexSubImage2D will do, too, albeit requiring a copy operation.

  2. Well, you just draw multiple textured quads (see 1) one over the other. You might configure the texture environment to scale the texture's color with the quad's base color (glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)) and give your quads a color of (1, 1, 1, alpha) (of course lighting should be disabled). Additionally you have to enable alpha blending (glEnable(GL_BLEND)) and use an appropriate blending function (glBlendFunc(GL_SRC_ALPHA, GL_ONE) should do).

But if all these terms don't tell you anything, you should rather first learn the basics using a good learning resource before delving into more advanced effects.

Christian Rau
  • 45,360
  • 10
  • 108
  • 185
  • Thanks a lot, Christian! I'll try to follow your pieces of advice!...But one more thing.I've heard about multitexturing.Is it better to draw one multitextured quad instead of drawing multiple textured quads? – Alex Mar 14 '12 at 12:19
  • @Alex If you get to configure the texture environment to use additive blending for combining the individual stages it might be an idea, although I'm not sure if that would buy you much, but it's worth a try. – Christian Rau Mar 14 '12 at 12:57