ricardocabellov5.0balter-egos
trace mr.doob r08028
blogdemoscenefeaturedextrascontact
 *blog... kind of... *rss

« Inspire08 demo log, da...iPhone $399, Dominio 9... »

Inspire08 demo log, day 25
07.05.2008
Status:
1(2) days left until Inspire08
Effects


Here we go with some effects... dots and HypnoRays. The demo is not supposed to look like this btw, I'm just adding effects on top of each other by now.

http://ricardocabello.com/projects/inspire08/07/

I may try to avoid loading images for this prod... I don't know... It's late tho, time to sleep.

Oh, here is the code for the hypnoray, it's just an idea I had on the bus on the way home today (vertex colors power ;D).

package effects;

import javax.media.opengl.GL;

import com.xplsv.utils.Timer;

import core.Vertex;

public class EffectHypnoRays extends Effect
{
	private Vertex[] meshData;
	
	public EffectHypnoRays(GL gl, int start, int duration)
	{
		super(gl, start, duration);
	}
	
	public void init()
	{
		int sides = 200;
		int radious = 4;
		float angle = ( 360.0f / (float)(sides-1) ) * ( (float)Math.PI / 180.0f );
		
		meshData = new Vertex[sides+1];
		
		Vertex v = new Vertex();

		v.position.x = 0.0f;
		v.position.y = 0.0f;
		v.position.z = 0.0f;

		v.colour.r = 0.0f;
		v.colour.g = 0.0f;
		v.colour.b = 0.2f;
		
		meshData[0] = v;
		
		for (int i = 1; i <= sides; i++)
		{
			v = new Vertex();

			v.position.x = (float) (radious * Math.cos(i * angle));
			v.position.y = (float) (radious * Math.sin(i * angle));
			v.position.z = 0;			

			v.colour.r = (float)Math.random() + (float)Math.sin(i*.5) - 1.0f; 
			v.colour.g = v.colour.r;
			v.colour.b = v.colour.r + 0.2f; 

			meshData[i] = v;
		}
	}
	
	public void render()
	{
		if(!active())
			return;
		
		gl.glLoadIdentity();
		gl.glTranslatef(0.0f, 0.0f, - 5.0f);
		gl.glRotatef((float)(Timer.get()*.01f), 0.1f, 0.0f, 1.0f);
		
		gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);
		gl.glBegin(GL.GL_TRIANGLE_FAN);

		for (int i = 0; i < meshData.length; i++)
		{
			gl.glColor4f(meshData[i].colour.r, meshData[i].colour.g, meshData[i].colour.b, 1.0f);
			gl.glVertex3f(meshData[i].position.x, meshData[i].position.y, meshData[i].position.z);
		}

		gl.glEnd();
	}
}
posted by trace at 19:29
0 comment written so far

SORRY!
Is not that I don't care about what you have to say, of course I do, but they are speaking louder and I lost my patience :(
 *profile 



traditional id: Ricardo Cabello Miguel
based in: London, UK
serving to: Hi-ReS!
contact me: click here


 *latest posts 

* How-to unlock your Vodafone UK mobile ... (02.07.2008)
* escena.org DVD #1 / 2008 released (wit... (12.06.2008)
* New Neave.com (12.06.2008)
* Speaking @ Pixel Attack (Valencia, Spa... (10.06.2008)
* That's enough. (10.06.2008)
* Roxik's The Eco Zoo (05.06.2008)
* FlexBuilder3 + Eclipse + Ubuntu = More... (21.05.2008)
* Inspire08 demo log, day 36 (18.05.2008)
* Inspire08 demo log, day 35 (17.05.2008)
* Temps Réel - Breakpoint 08 (14.05.2008)
* Diverter (13.05.2008)
* Inspire08 demo log, day 30 (13.05.2008)
* Inspire08 demo log, day 29 (11.05.2008)
* Inspire08 demo log, day 27 and 28 (10.05.2008)
* Inspire08 demo log, day 26 (part 2) (08.05.2008)


 *latest comments 

* C++, SDL Coding? Maybe.. ;) (Preview) (trace)
* C++, SDL Coding? Maybe.. ;) (Preview) (Joey)
* La picaresca (spt)
* Mr. Slip Up (ricardo)
* La picaresca (ricardo)
* La picaresca (spt)
* La picaresca (sole)
* Demoscene @ Cirsa (sml)
* La picaresca (humphr3y)
* La picaresca (alfio)
* fiver2's new baby: debris (Jcl)
* Barcelona = full of shit(s) (Soli)
* Demoscene @ Cirsa (Scener)
* Rar & unrar with Ubuntu (SethPlate)
* Mindcandy 2 (Jcl)