Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm making an evil Pacman in OpenGL and I need to make my spheres look like a fireballs, does anyone know how I do that?

And what material colour should I use?

Also, is there a colour palette to change the colour of my materials?

This is how I create a sphere:

GLfloat mat_ambient[] = { 0.25, 0.25, 0.25, 1.0 };
GLfloat mat_diffuse[] = { 0.4, 0.4, 0.4, 1.0 };
GLfloat mat_specular[] = { 0.774597, 0.774597, 0.774597, 1.0 };
GLfloat mat_shine = 0.6;

glMaterialfv (GL_FRONT, GL_AMBIENT, mat_ambient);
glMaterialfv (GL_FRONT, GL_DIFFUSE, mat_diffuse);
glMaterialfv (GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialf (GL_FRONT, GL_SHININESS, mat_shine * 128);

glPushMatrix();
glTranslatef(x,y,0);
glutSolidSphere(size, 20, 10);
glFlush();
glPopMatrix();
share|improve this question
8  
Hmm, before Byte56 will downvote your post, you might want too google for ways of simulating fire. –  teodron Apr 23 '12 at 15:43
    
@teodron 5 votes for that comment... I guess I have a reputation around here :) I also have a reputation for grammar, so you may want to Google the correct usage of 'too'. ;) –  Byte56 Apr 25 '12 at 20:43
    
@gn66 The color you use is entirely up to you. Fireballs in games come in a range of colors. The only questions you ask in the body of your post is about color. You never said if you wanted realistic fireballs, animated fireballs, etc. Not everyone has the same idea of what a fireball is. Try adding an image. So, -1 for lack of research and an unclear question. –  Byte56 Apr 25 '12 at 20:50
    
@Byte56 I swear, I must have been set up by the grammar nazis or the evil alphabet gremlins on that one. Sorry.. :-s –  teodron Apr 26 '12 at 6:42
1  
There's never an easy way with OpenGL –  Luke B. Sep 21 '12 at 19:53

2 Answers 2

up vote 3 down vote accepted

Unless you have a reason for your fireball to be actual geometry, I'd opt for a simple 2d impostor instead.

There's a simple photoshop tutorial for making fireballs here: http://sol.gfxile.net/firey/index.html

The resulting image looks like this:

http://sol.gfxile.net/firey/img10.png

To animate the fire, just overlay a few textures like that with additive blending and rotated around the z axis. Maybe add a particle system for flair.

share|improve this answer
1  
+1 for keeping it simple. –  Cypher Sep 21 '12 at 20:34

Search for "Realistic and Controllable Fire Simulation" on Google.

http://www.cs.sunysb.edu/vislab/wordpress//papers/VoxelsOnFire.pdf is one example

For starters, you should set a simpler object, that you create from triangles (not the GLUT ones) and think of ways of animating fire. There are way too many possibilities: particle effects, voxels, shaders. Google for any of these ways of simulating fire.. your question is more about explaining/doing a tutorial on how to implement such an effect, so it can't be answered here. Good luck in selecting your tools ;)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.