<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How To: Create a Simple Fireworks Effect in OpenGL and SDL</title>
	<atom:link href="http://r3dux.org/2010/10/how-to-create-a-simple-fireworks-effect-in-opengl/feed/" rel="self" type="application/rss+xml" />
	<link>http://r3dux.org/2010/10/how-to-create-a-simple-fireworks-effect-in-opengl/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-create-a-simple-fireworks-effect-in-opengl</link>
	<description>A number-pimping side project from the valleys in *NEW* upside-down flavour.</description>
	<lastBuildDate>Tue, 15 May 2012 23:01:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: Frank</title>
		<link>http://r3dux.org/2010/10/how-to-create-a-simple-fireworks-effect-in-opengl/#comment-6432</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Tue, 25 Jan 2011 18:00:06 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=3525#comment-6432</guid>
		<description>Hi,
with that modification it now works as it should, thanks. 
I think I&#039;ll stay clear of FBOs for the moment, enough other things to understand first - this is my first experiment with openGL, so I still have a good way to go :)

Thank you for your help!

Frank</description>
		<content:encoded><![CDATA[<p>Hi,<br />
with that modification it now works as it should, thanks.<br />
I think I&#8217;ll stay clear of FBOs for the moment, enough other things to understand first &#8211; this is my first experiment with openGL, so I still have a good way to go <img src='http://r3dux.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thank you for your help!</p>
<p>Frank</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r3dux</title>
		<link>http://r3dux.org/2010/10/how-to-create-a-simple-fireworks-effect-in-opengl/#comment-6431</link>
		<dc:creator>r3dux</dc:creator>
		<pubDate>Mon, 24 Jan 2011 22:42:30 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=3525#comment-6431</guid>
		<description>Okay, so if you get all zeros for the accumulation buffer bits on the ATI cards you&#039;re definitely not getting an accumulation buffer, hence no trails. Makes sense ;)

As for other ways of creating the trails, you just need &lt;em&gt;some&lt;/em&gt; kind of buffer that you can use for temporary storage. In essence, we just need somewhere to store a copy of what was on the screen so we can:
- Clear the screen
- Draw what used to be there but with a little less opacity
- Draw the elements of our new frame on top of it

Probably the best way to go about this would be to copy to and from a &lt;a href=&quot;http://www.opengl.org/wiki/Framebuffer_Object&quot; rel=&quot;nofollow&quot;&gt;Frame Buffer Object&lt;/a&gt;, but FBOs can be tricky if you&#039;ve not worked with them before (which I haven&#039;t, although I&#039;ll be learning them soon!).

Another alternative might be to NOT clear the screen, but instead draw a full-screen quad with low opacity over the top of everything just before drawing your new frame... I thought this would work, but wasn&#039;t 100% sure - but guess what? It does =D

Here&#039;s the important stuff to make it happen:

&lt;pre lang=&quot;cpp&quot;&gt;
// Function to set some initial OpenGL state-machine properties
void initGL()
{
    glfwSwapInterval(1); // Lock to vertical sync of monitor (normally 60Hz, so 60fps)

    // ----- Window and Projection Settings -----

    // Set the window title
    glfwSetWindowTitle(&quot;GLFW Fireworks with Trails&quot;);

    // Setup our viewport to be the entire size of the window
    glViewport(0, 0, (GLsizei)windowWidth, (GLsizei)windowHeight);

    // Change to the projection matrix, reset the matrix and set up orthagonal projection (i.e. 2D)
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, windowWidth, windowHeight, 0, 0, 1); // Parameters: left, right, bottom, top, near, far

    // Disable depth testing (because we&#039;re working in 2D!)
    glDisable(GL_DEPTH_TEST);

    // Enable blending (we need this to be able to use an alpha component)
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    glEnable(GL_POINT_SMOOTH); // Smooth the points so that they&#039;re circular and not square

    glPointSize(5.0f);
}

void drawBackground()
{
	// The alpha setting for this (the fourth parameter) is what gives us the trails. The lower the value, the longer the trails!
	glColor4f(0.0f, 0.0f, 0.0f, 0.2f);

	// Draw the background
	// REMEMBER: Window co-ordinates have the origin at the top left.
	glBegin(GL_QUADS);
            glVertex2i(0,           windowHeight);
            glVertex2i(windowWidth, windowHeight);
            glVertex2i(windowWidth, 0);
            glVertex2i(0,           0);
	glEnd();
}

// Function to draw our OpenGL scene
void drawScene()
{
    // Set ModelView matrix mode and reset to the default identity matrix
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    // Displacement trick for exact pixelisation
    glTranslatef(0.375, 0.375, 0);

    // Draw a translucent black quad over the entire scene
    drawBackground();

    // Draw our new firework frame...
    for (int loop = 0; loop &lt; FIREWORKS; loop++)
    {
        for (int particleLoop = 0; particleLoop &lt; FIREWORK_PARTICLES; particleLoop++)
        {

            // Set the point size of the firework particles (this needs to be called BEFORE opening the glBegin(GL_POINTS) section!)
            glPointSize(fw[loop].particleSize);

            glBegin(GL_POINTS);
                // Set colour to yellow on the way up, then whatever colour firework should be when exploded
                if (fw[loop].hasExploded == false)
                {
                    glColor4f(1.0f, 1.0f, 0.0f, 1.0f);
                }
                else
                {
                    glColor4f(fw[loop].red, fw[loop].green, fw[loop].blue, fw[loop].alpha);
                }

                // Draw the point
                //glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
                glVertex2f(fw[loop].x[particleLoop], fw[loop].y[particleLoop]);
            glEnd();
        }

        // Move the firework appropriately depending on its explosion state
        if (fw[loop].hasExploded == false)
        {
            fw[loop].move();
        }
        else
        {
            fw[loop].explode();
        }
    }

    // ----- Stop Drawing Stuff! ------

    glfwSwapBuffers(); // Swap the buffers to display the scene (so we don&#039;t have to watch it being drawn!)

} // End of drawScene function&lt;/pre&gt;

Another thing you might want to try is blurring the entire scene before drawing your new frame, which&#039;ll give you an effect like this: &lt;a href=&quot;http://r3dux.org/2010/01/actionscript-30-per-pixel-collision-detection-inna-peggle-stylee/&quot; rel=&quot;nofollow&quot;&gt;Per-Pixel Collisions&lt;/a&gt; (uses blur filter on the stage instead of clearing it), although I&#039;ve not used any blur filters in OpenGL yet, so you&#039;d be on your own there.

Anyways, hope this helps!</description>
		<content:encoded><![CDATA[<p>Okay, so if you get all zeros for the accumulation buffer bits on the ATI cards you&#8217;re definitely not getting an accumulation buffer, hence no trails. Makes sense <img src='http://r3dux.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>As for other ways of creating the trails, you just need <em>some</em> kind of buffer that you can use for temporary storage. In essence, we just need somewhere to store a copy of what was on the screen so we can:<br />
- Clear the screen<br />
- Draw what used to be there but with a little less opacity<br />
- Draw the elements of our new frame on top of it</p>
<p>Probably the best way to go about this would be to copy to and from a <a href="http://www.opengl.org/wiki/Framebuffer_Object">Frame Buffer Object</a>, but FBOs can be tricky if you&#8217;ve not worked with them before (which I haven&#8217;t, although I&#8217;ll be learning them soon!).</p>
<p>Another alternative might be to NOT clear the screen, but instead draw a full-screen quad with low opacity over the top of everything just before drawing your new frame&#8230; I thought this would work, but wasn&#8217;t 100% sure &#8211; but guess what? It does =D</p>
<p>Here&#8217;s the important stuff to make it happen:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #666666;">// Function to set some initial OpenGL state-machine properties</span>
<span style="color: #0000ff;">void</span> initGL<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    glfwSwapInterval<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// Lock to vertical sync of monitor (normally 60Hz, so 60fps)</span>
&nbsp;
    <span style="color: #666666;">// ----- Window and Projection Settings -----</span>
&nbsp;
    <span style="color: #666666;">// Set the window title</span>
    glfwSetWindowTitle<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;GLFW Fireworks with Trails&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// Setup our viewport to be the entire size of the window</span>
    glViewport<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">0</span>, <span style="color: #008000;">&#40;</span>GLsizei<span style="color: #008000;">&#41;</span>windowWidth, <span style="color: #008000;">&#40;</span>GLsizei<span style="color: #008000;">&#41;</span>windowHeight<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// Change to the projection matrix, reset the matrix and set up orthagonal projection (i.e. 2D)</span>
    glMatrixMode<span style="color: #008000;">&#40;</span>GL_PROJECTION<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    glLoadIdentity<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    glOrtho<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span>, windowWidth, windowHeight, <span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// Parameters: left, right, bottom, top, near, far</span>
&nbsp;
    <span style="color: #666666;">// Disable depth testing (because we're working in 2D!)</span>
    glDisable<span style="color: #008000;">&#40;</span>GL_DEPTH_TEST<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// Enable blending (we need this to be able to use an alpha component)</span>
    glEnable<span style="color: #008000;">&#40;</span>GL_BLEND<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    glBlendFunc<span style="color: #008000;">&#40;</span>GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    glEnable<span style="color: #008000;">&#40;</span>GL_POINT_SMOOTH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// Smooth the points so that they're circular and not square</span>
&nbsp;
    glPointSize<span style="color: #008000;">&#40;</span><span style="color:#800080;">5.0f</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> drawBackground<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	<span style="color: #666666;">// The alpha setting for this (the fourth parameter) is what gives us the trails. The lower the value, the longer the trails!</span>
	glColor4f<span style="color: #008000;">&#40;</span><span style="color:#800080;">0.0f</span>, <span style="color:#800080;">0.0f</span>, <span style="color:#800080;">0.0f</span>, <span style="color:#800080;">0.2f</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #666666;">// Draw the background</span>
	<span style="color: #666666;">// REMEMBER: Window co-ordinates have the origin at the top left.</span>
	glBegin<span style="color: #008000;">&#40;</span>GL_QUADS<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            glVertex2i<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span>,           windowHeight<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            glVertex2i<span style="color: #008000;">&#40;</span>windowWidth, windowHeight<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            glVertex2i<span style="color: #008000;">&#40;</span>windowWidth, <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            glVertex2i<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span>,           <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	glEnd<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #666666;">// Function to draw our OpenGL scene</span>
<span style="color: #0000ff;">void</span> drawScene<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">// Set ModelView matrix mode and reset to the default identity matrix</span>
    glMatrixMode<span style="color: #008000;">&#40;</span>GL_MODELVIEW<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    glLoadIdentity<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// Displacement trick for exact pixelisation</span>
    glTranslatef<span style="color: #008000;">&#40;</span><span style="color:#800080;">0.375</span>, <span style="color:#800080;">0.375</span>, <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// Draw a translucent black quad over the entire scene</span>
    drawBackground<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">// Draw our new firework frame...</span>
    <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> loop <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> loop <span style="color: #000080;">&lt;</span> FIREWORKS<span style="color: #008080;">;</span> loop<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> particleLoop <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> particleLoop <span style="color: #000080;">&lt;</span> FIREWORK_PARTICLES<span style="color: #008080;">;</span> particleLoop<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
            <span style="color: #666666;">// Set the point size of the firework particles (this needs to be called BEFORE opening the glBegin(GL_POINTS) section!)</span>
            glPointSize<span style="color: #008000;">&#40;</span>fw<span style="color: #008000;">&#91;</span>loop<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">particleSize</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
            glBegin<span style="color: #008000;">&#40;</span>GL_POINTS<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                <span style="color: #666666;">// Set colour to yellow on the way up, then whatever colour firework should be when exploded</span>
                <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>fw<span style="color: #008000;">&#91;</span>loop<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">hasExploded</span> <span style="color: #000080;">==</span> <span style="color: #0000ff;">false</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    glColor4f<span style="color: #008000;">&#40;</span><span style="color:#800080;">1.0f</span>, <span style="color:#800080;">1.0f</span>, <span style="color:#800080;">0.0f</span>, <span style="color:#800080;">1.0f</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #0000ff;">else</span>
                <span style="color: #008000;">&#123;</span>
                    glColor4f<span style="color: #008000;">&#40;</span>fw<span style="color: #008000;">&#91;</span>loop<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">red</span>, fw<span style="color: #008000;">&#91;</span>loop<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">green</span>, fw<span style="color: #008000;">&#91;</span>loop<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">blue</span>, fw<span style="color: #008000;">&#91;</span>loop<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">alpha</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #666666;">// Draw the point</span>
                <span style="color: #666666;">//glColor4f(1.0f, 1.0f, 1.0f, 1.0f);</span>
                glVertex2f<span style="color: #008000;">&#40;</span>fw<span style="color: #008000;">&#91;</span>loop<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">x</span><span style="color: #008000;">&#91;</span>particleLoop<span style="color: #008000;">&#93;</span>, fw<span style="color: #008000;">&#91;</span>loop<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">y</span><span style="color: #008000;">&#91;</span>particleLoop<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            glEnd<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #666666;">// Move the firework appropriately depending on its explosion state</span>
        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>fw<span style="color: #008000;">&#91;</span>loop<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">hasExploded</span> <span style="color: #000080;">==</span> <span style="color: #0000ff;">false</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            fw<span style="color: #008000;">&#91;</span>loop<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">move</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0000ff;">else</span>
        <span style="color: #008000;">&#123;</span>
            fw<span style="color: #008000;">&#91;</span>loop<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">explode</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #666666;">// ----- Stop Drawing Stuff! ------</span>
&nbsp;
    glfwSwapBuffers<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// Swap the buffers to display the scene (so we don't have to watch it being drawn!)</span>
&nbsp;
<span style="color: #008000;">&#125;</span> <span style="color: #666666;">// End of drawScene function</span></pre></div></div>

<p>Another thing you might want to try is blurring the entire scene before drawing your new frame, which&#8217;ll give you an effect like this: <a href="http://r3dux.org/2010/01/actionscript-30-per-pixel-collision-detection-inna-peggle-stylee/">Per-Pixel Collisions</a> (uses blur filter on the stage instead of clearing it), although I&#8217;ve not used any blur filters in OpenGL yet, so you&#8217;d be on your own there.</p>
<p>Anyways, hope this helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://r3dux.org/2010/10/how-to-create-a-simple-fireworks-effect-in-opengl/#comment-6430</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Mon, 24 Jan 2011 21:41:45 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=3525#comment-6430</guid>
		<description>Hi,
I tried the same executable on all machines - I emailed it yesterday to my work address just to give it a go, but was sure it will not show trails. Imagine my surprise when I started it and got the trails. All my home PCs have ATI Radeon cards.

I just tried adding the code and I get all zeros. 
At work I spoke to our graphics guy and immediately after I mentioned that I have an ATI card he said he knows the problem.
We use nVidia quadro cards at work because they have the best openGL support. According to him even the ATI FirePro cards have rather sub-par openGL support, never mind the consumer ones.
I had a play with an updated card driver version, but it did not change anything.

However, after knowing this I just made an experiment and undusted my old laptop from the medieval era, which has a nVidia geforce go card. It plays the fireworks with about 1fps (tops), but there are nice trails.

So I fear I am stuck without trails, unless there is a way to get these effects without accumulation buffer?

Thanks 
Frank</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I tried the same executable on all machines &#8211; I emailed it yesterday to my work address just to give it a go, but was sure it will not show trails. Imagine my surprise when I started it and got the trails. All my home PCs have ATI Radeon cards.</p>
<p>I just tried adding the code and I get all zeros.<br />
At work I spoke to our graphics guy and immediately after I mentioned that I have an ATI card he said he knows the problem.<br />
We use nVidia quadro cards at work because they have the best openGL support. According to him even the ATI FirePro cards have rather sub-par openGL support, never mind the consumer ones.<br />
I had a play with an updated card driver version, but it did not change anything.</p>
<p>However, after knowing this I just made an experiment and undusted my old laptop from the medieval era, which has a nVidia geforce go card. It plays the fireworks with about 1fps (tops), but there are nice trails.</p>
<p>So I fear I am stuck without trails, unless there is a way to get these effects without accumulation buffer?</p>
<p>Thanks<br />
Frank</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://r3dux.org/2010/10/how-to-create-a-simple-fireworks-effect-in-opengl/#comment-6426</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Mon, 24 Jan 2011 11:47:06 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=3525#comment-6426</guid>
		<description>Hi,
I&#039;ll add that code when I&#039;m back at home later today. 

I used the very same executable on all machines (built at home, imagine my surprise when I started it here and it looked different).

However, I think you&#039;re right that I don&#039;t have an accumulation buffer, as when I tried to change 
  glClearAccum(0.0f, 0.0f, 0.0f, 1.0f);
at home nothing changed, whereas here at work I get a nice colored background.

Can it be that ATI does not support accumulation buffers on consumer cards? (I found http://forums.amd.com/game/messageview.cfm?catid=260&amp;threadid=123808 which seam to have a similar problem). 

But I&#039;ll try adding your code snippet just to be sure.

Thanks
Frank</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I&#8217;ll add that code when I&#8217;m back at home later today. </p>
<p>I used the very same executable on all machines (built at home, imagine my surprise when I started it here and it looked different).</p>
<p>However, I think you&#8217;re right that I don&#8217;t have an accumulation buffer, as when I tried to change<br />
  glClearAccum(0.0f, 0.0f, 0.0f, 1.0f);<br />
at home nothing changed, whereas here at work I get a nice colored background.</p>
<p>Can it be that ATI does not support accumulation buffers on consumer cards? (I found <a href="http://forums.amd.com/game/messageview.cfm?catid=260&#038;threadid=123808">http://forums.amd.com/game/messageview.cfm?catid=260&#038;threadid=123808</a> which seam to have a similar problem). </p>
<p>But I&#8217;ll try adding your code snippet just to be sure.</p>
<p>Thanks<br />
Frank</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r3dux</title>
		<link>http://r3dux.org/2010/10/how-to-create-a-simple-fireworks-effect-in-opengl/#comment-6425</link>
		<dc:creator>r3dux</dc:creator>
		<pubDate>Mon, 24 Jan 2011 09:30:26 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=3525#comment-6425</guid>
		<description>Hi Frank,

That&#039;s pretty odd - try pasting the following code at the bottom of the &lt;strong&gt;setupScreen&lt;/strong&gt; function to check that you&#039;re getting an accumulation buffer created:

&lt;pre lang=&quot;cpp&quot;&gt;
// Check accumulation buffer bit-depths
int AccRed, AccGreen, AccBlue, AccAlpha;
SDL_GL_GetAttribute(SDL_GL_ACCUM_RED_SIZE,   &amp;AccRed);   // Size of the accumulation buffer red component, in bits.
SDL_GL_GetAttribute(SDL_GL_ACCUM_GREEN_SIZE, &amp;AccGreen); // Size of the accumulation buffer green component, in bits.
SDL_GL_GetAttribute(SDL_GL_ACCUM_BLUE_SIZE,  &amp;AccBlue);  // Size of the accumulation buffer blue component, in bits.
SDL_GL_GetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, &amp;AccAlpha); // Size of the accumulation buffer alpha component, in bits.

cout &lt;&lt; &quot;Accum. Red   : &quot; &lt;&lt; AccRed   &lt;&lt; endl;
cout &lt;&lt; &quot;Accum. Green : &quot; &lt;&lt; AccGreen &lt;&lt; endl;
cout &lt;&lt; &quot;Accum. Blue  : &quot; &lt;&lt; AccBlue  &lt;&lt; endl;
cout &lt;&lt; &quot;Accum. Alpha : &quot; &lt;&lt; AccAlpha &lt;&lt; endl;&lt;/pre&gt;

When I add this code I get 16 bits each for Red, Green, Blue and Alpha - so try it on the machines where the trails don&#039;t work to make sure you&#039;re actually getting an accumulation buffer on &#039;em. 

Also, try the exact same executable that definitely works on your work machine on your home machines to rule out any code issues.

Failing all that, I moved this code over from SDL to GLFW the other day but hadn&#039;t got around to adding that code, but now that I have maybe you&#039;ll have more luck with that =D

Let me know how you get on =D</description>
		<content:encoded><![CDATA[<p>Hi Frank,</p>
<p>That&#8217;s pretty odd &#8211; try pasting the following code at the bottom of the <strong>setupScreen</strong> function to check that you&#8217;re getting an accumulation buffer created:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #666666;">// Check accumulation buffer bit-depths</span>
<span style="color: #0000ff;">int</span> AccRed, AccGreen, AccBlue, AccAlpha<span style="color: #008080;">;</span>
SDL_GL_GetAttribute<span style="color: #008000;">&#40;</span>SDL_GL_ACCUM_RED_SIZE,   <span style="color: #000040;">&amp;</span>AccRed<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>   <span style="color: #666666;">// Size of the accumulation buffer red component, in bits.</span>
SDL_GL_GetAttribute<span style="color: #008000;">&#40;</span>SDL_GL_ACCUM_GREEN_SIZE, <span style="color: #000040;">&amp;</span>AccGreen<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// Size of the accumulation buffer green component, in bits.</span>
SDL_GL_GetAttribute<span style="color: #008000;">&#40;</span>SDL_GL_ACCUM_BLUE_SIZE,  <span style="color: #000040;">&amp;</span>AccBlue<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>  <span style="color: #666666;">// Size of the accumulation buffer blue component, in bits.</span>
SDL_GL_GetAttribute<span style="color: #008000;">&#40;</span>SDL_GL_ACCUM_ALPHA_SIZE, <span style="color: #000040;">&amp;</span>AccAlpha<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// Size of the accumulation buffer alpha component, in bits.</span>
&nbsp;
<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;Accum. Red   : &quot;</span> <span style="color: #000080;">&lt;&lt;</span> AccRed   <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;Accum. Green : &quot;</span> <span style="color: #000080;">&lt;&lt;</span> AccGreen <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;Accum. Blue  : &quot;</span> <span style="color: #000080;">&lt;&lt;</span> AccBlue  <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;Accum. Alpha : &quot;</span> <span style="color: #000080;">&lt;&lt;</span> AccAlpha <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span></pre></div></div>

<p>When I add this code I get 16 bits each for Red, Green, Blue and Alpha &#8211; so try it on the machines where the trails don&#8217;t work to make sure you&#8217;re actually getting an accumulation buffer on &#8216;em. </p>
<p>Also, try the exact same executable that definitely works on your work machine on your home machines to rule out any code issues.</p>
<p>Failing all that, I moved this code over from SDL to GLFW the other day but hadn&#8217;t got around to adding that code, but now that I have maybe you&#8217;ll have more luck with that =D</p>
<p>Let me know how you get on =D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://r3dux.org/2010/10/how-to-create-a-simple-fireworks-effect-in-opengl/#comment-6424</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Mon, 24 Jan 2011 08:03:36 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=3525#comment-6424</guid>
		<description>Hi,
Thanks for this great example. The high number of comments really helps to understand what is going on.
I have one problem though, with the trails. 

At home I tried it at three different computer and none had any trails, not even when I just copied your code. However, now I tried it at work and here everything is as it should be, with nice trails behind the rockets.

Is there any setting that controls this that I did not activate at home? The only obvious difference that I can make out between these PCs is the OS (Win7Home vs. Win7Pro) and of course some hardware (ATI Radeon card vs. nVidia Quadro FX).

Thanks
Frank</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Thanks for this great example. The high number of comments really helps to understand what is going on.<br />
I have one problem though, with the trails. </p>
<p>At home I tried it at three different computer and none had any trails, not even when I just copied your code. However, now I tried it at work and here everything is as it should be, with nice trails behind the rockets.</p>
<p>Is there any setting that controls this that I did not activate at home? The only obvious difference that I can make out between these PCs is the OS (Win7Home vs. Win7Pro) and of course some hardware (ATI Radeon card vs. nVidia Quadro FX).</p>
<p>Thanks<br />
Frank</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r3dux</title>
		<link>http://r3dux.org/2010/10/how-to-create-a-simple-fireworks-effect-in-opengl/#comment-6308</link>
		<dc:creator>r3dux</dc:creator>
		<pubDate>Sun, 07 Nov 2010 01:44:06 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=3525#comment-6308</guid>
		<description>Hi Nikita,

I&#039;m not in the least bit angry - in fact, quite the opposite! I&#039;m really glad that you found the code useful, and I put the source code up in the first place in the hope that it would be.

Thanks for taking the time to post a comment, and for including me/this-post in your modified source. I hope that when you&#039;ve finished it you&#039;ll come back and post a link to the completed game.

P.S. I used to play Nebulus back on the Spectrum when I was a kid (and then later on the Amiga) - great game! I hope you include the &lt;a href=&quot;http://www.gamewinners.com/amiga/Nebulus.htm&quot; rel=&quot;nofollow&quot;&gt;helloiamjmp&lt;/a&gt; cheat! =D</description>
		<content:encoded><![CDATA[<p>Hi Nikita,</p>
<p>I&#8217;m not in the least bit angry &#8211; in fact, quite the opposite! I&#8217;m really glad that you found the code useful, and I put the source code up in the first place in the hope that it would be.</p>
<p>Thanks for taking the time to post a comment, and for including me/this-post in your modified source. I hope that when you&#8217;ve finished it you&#8217;ll come back and post a link to the completed game.</p>
<p>P.S. I used to play Nebulus back on the Spectrum when I was a kid (and then later on the Amiga) &#8211; great game! I hope you include the <a href="http://www.gamewinners.com/amiga/Nebulus.htm">helloiamjmp</a> cheat! =D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikita Zimin</title>
		<link>http://r3dux.org/2010/10/how-to-create-a-simple-fireworks-effect-in-opengl/#comment-6307</link>
		<dc:creator>Nikita Zimin</dc:creator>
		<pubDate>Sat, 06 Nov 2010 15:45:36 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=3525#comment-6307</guid>
		<description>Hi! Thank you for the sample.
I needed some great effect for game ending screen (an SDL clone of Tower Toppler AKA Nebulus), and the post was first in google query &quot;fireworks effect sdl&quot;, so I re-wrote it in non-object manner and without OpenGL. You can see the resulted code here: http://code.google.com/p/nzeemin-opensrc/source/browse/trunk/dingoo/TowerTopplerSdl/src/fireworks.cpp
Hope you will not angry about it?</description>
		<content:encoded><![CDATA[<p>Hi! Thank you for the sample.<br />
I needed some great effect for game ending screen (an SDL clone of Tower Toppler AKA Nebulus), and the post was first in google query &#8220;fireworks effect sdl&#8221;, so I re-wrote it in non-object manner and without OpenGL. You can see the resulted code here: <a href="http://code.google.com/p/nzeemin-opensrc/source/browse/trunk/dingoo/TowerTopplerSdl/src/fireworks.cpp">http://code.google.com/p/nzeemin-opensrc/source/browse/trunk/dingoo/TowerTopplerSdl/src/fireworks.cpp</a><br />
Hope you will not angry about it?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

