I promised I was going to do a follow up on the Volumetric Lines episode, so here it is.
Like I said, it was very easy to change from regular lines, to using volumetric lines in PewPew. In fact, I already changed once the way lines are drawn: the early versions of PewPew used SDL without OpenGL, so the lines were drawn in software using the good old Bresenham. Switching to OpenGL forced me to reduce the coupling between the renderer, and the game engine. Here is all I had to do to make the switch to volumetric lines, besides the initialization:
#ifdef USE_VOLUMETRIC_LINES
for (int index=0; index < numberOfVertex; index+=6)
VolumeLineRenderer::getInstance().renderLine(
&vertexes[index],&vertexes[index+3]);
#else
glVertexPointer(3, VERTEX_TYPE, 0, vertexes);
glDrawArrays(GL_LINES, 0, numberOfVertex);
#endif
Here are some new screenshots comparing the regular render to Sebastien Hillaire's one with different line width.
Now this is running on a PC, not on an iPhone. I previously said that I could maybe port this glowing effect to a real iPhone/iPod Touch, but it requires programmable shaders, which are only available on the iPod Touch 3G and the iPhone 3GS. I only have an iPod Touch 2G, so I wouldn't be able to test it.
Anyway, if you do not like the glowing effect do not worry, because if I do manage to get this effect to work on a real device at a decent frame rate, I would put an option to keep the classic look :-)
Like I said, it was very easy to change from regular lines, to using volumetric lines in PewPew. In fact, I already changed once the way lines are drawn: the early versions of PewPew used SDL without OpenGL, so the lines were drawn in software using the good old Bresenham. Switching to OpenGL forced me to reduce the coupling between the renderer, and the game engine. Here is all I had to do to make the switch to volumetric lines, besides the initialization:
#ifdef USE_VOLUMETRIC_LINES
for (int index=0; index < numberOfVertex; index+=6)
VolumeLineRenderer::getInstance().renderLine(
&vertexes[index],&vertexes[index+3]);
#else
glVertexPointer(3, VERTEX_TYPE, 0, vertexes);
glDrawArrays(GL_LINES, 0, numberOfVertex);
#endif
Here are some new screenshots comparing the regular render to Sebastien Hillaire's one with different line width.
Now this is running on a PC, not on an iPhone. I previously said that I could maybe port this glowing effect to a real iPhone/iPod Touch, but it requires programmable shaders, which are only available on the iPod Touch 3G and the iPhone 3GS. I only have an iPod Touch 2G, so I wouldn't be able to test it.
Anyway, if you do not like the glowing effect do not worry, because if I do manage to get this effect to work on a real device at a decent frame rate, I would put an option to keep the classic look :-)
Hihi,
ReplyDeleteIts possible to get the glowing line effect using standard opengl, by drawing the lines as a rectangle with alpha add blend mode. You can see the effect here:
http://1.bp.blogspot.com/_nv4ljJGt1-A/S-c0xenKUxI/AAAAAAAAACc/J6u6cl_d7RA/s1600/editor1.jpg
haha, that's very true!
ReplyDeleteBut if you rotate the camera, the lines will look flat, right? It's not a problem if the camera is static, but in PewPew the camera can move.
Totally unrelated, but I subscribed to your blog :)