Seriously strange things - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Seriously strange things (/thread-1794.html)
Seriously strange things - Talyn - Feb 5, 2009 08:25 PM
Been working on a point sprite particle engine for quite a while now and it's thrown me yet another curve ball. I can draw the particles just fine. But I can't draw anything else. If I draw the other stuff, I can't draw the particles. Why? Simply, in code:
Taking out the drawParticles call draws the object as I expect, but obviously no particles. Leaving in the call doesn't draw the object, but draws the particles just fine. WTF?
Seriously strange things - maximile - Feb 5, 2009 11:48 PM
What happens in [ps drawParticles]? Is it changing the blend function, binding the wrong texture, enabling/disabling states, transforming off screen etc.?
Seriously strange things - Talyn - Feb 7, 2009 10:47 AM
maximile Wrote:What happens in [ps drawParticles]? Is it changing the blend function, binding the wrong texture, enabling/disabling states, transforming off screen etc.?
The following is called on creation of the particle engine:
And the following happens when [ps drawParticles] is callled:
Keep in mind, my texturing loading is still giving me issues (see my other new thread) so that may be one of the major stumbling blocks at the moment. However, as I said before, if I try to draw both the particle source (a simple green quad) and the particles in the same frame, one of them does not display (usually source).
Seriously strange things - ThemsAllTook - Feb 7, 2009 12:41 PM
-drawParticles changes GL state by leaving a texture enabled and bound, GL_BLEND enabled, and potentially changes the current color. All of those are likely to affect subsequent drawing.
Seriously strange things - Talyn - Feb 7, 2009 09:00 PM
will solve my problems?
Seriously strange things - arekkusu - Feb 8, 2009 11:28 AM
Try my tips on how to debug. Here, you want to set a breakpoint in OpenGL Profiler on your draw call that doesn't work, and inspect all of the state. Profiler lets you save the state to a text file, so you can keep it around. Then change your app so the draw call works, and repeat. Compare the two sets of state-- what's different?