OpenGL Light!

Hi there,

I just want to make an interest effect: my mouse will do moving in a circle, and follow my mouse i want there
is a blue “light” moves with the circle’s edge.

I saw this effect on some products. I dont know how to program the effect and whether the blue “light” is an
OPENGL light or something else(maybe it is just a picture).

Now i want to konw if this effect can be implemented with the OpenGL light? if yes, how to do the following:

  1. show a blue “light” in a very small area (ie, in rect(0,0,10,10))
  2. rotate the “light” around a circle’s center.

I also want to know if there are any easy methods to make this?
Thanks!

Sorry but I am not sure to understand what you want.

Can you show a picture or a video showing this effect ?

Hi ZbuffeR,

Sorry for that i dont know how to upload videos in this forum.
Thanks!

Hi ZbuffeR,

Here it is!
<embed src=“http://us.i1.yimg.com/cosmos.bcst.yahoo.com/player/media/swf/FLVVideoSolo.swf” flashvars=“id=http://video.yahoo.com/watch/7942812/21030181” type=“application/x-shockwave-flash” width=“425” height=“350”></embed>

sorry it seems cannt work!

Could you give me your email? so i can email it to you.

You can not upload here, but you can link an existing picture.
I will not give you an email.

Hi ZbuffeR,

video

The above is the video linker!

Thanks!

Well just draw a bunch of very transparent blue dots with additive blending, on the 60 or 120 last known positions of the mouse cursor.
Feel free to search for implementation details.

Hi ZbuffeR,

Thanks very much!

“draw a bunch of very transparent blue dots”
Sorry, i dont know how to do this.

Could i load it from a picture or do it as follow:

BYTE buf[32324];
for (int i=0; i<32*32; i+=4)
{
buf[i] = 0; //R
buf[i+1] = 0; //G
buf[i+2] = 255; //B
buf[i+3] = 128; //A
}



glTexImage2D(…, …, …, …, …, …, …, …, buf);

I dont know if this can work and will try later.
Are there any easy methods to do this job in OPENGL ES.
Thanks!

Yeah you can draw textured quad to draw the dots.
But make sure you draw a blue circle on black background :slight_smile:


BYTE buf[8*8*4] = {
0,0,0,0,	0,0,0,0,	0,0,0,0,	0,0,0,0,	0,0,0,0,	0,0,0,0,	0,0,0,0,	0,0,0,0,
0,0,0,0,	0,0,0,0,	0,0,0,0,	32,128,255,16,	32,128,255,16,	0,0,0,0,	0,0,0,0,	0,0,0,0,
0,0,0,0,	0,0,0,0,	32,128,255,16,	32,128,255,16,	32,128,255,16,	32,128,255,16,	0,0,0,0,	0,0,0,0,
0,0,0,0,	32,128,255,16,	32,128,255,16,	32,128,255,16,	32,128,255,16,	32,128,255,16,	32,128,255,16,	0,0,0,0,
0,0,0,0,	32,128,255,16,	32,128,255,16,	32,128,255,16,	32,128,255,16,	32,128,255,16,	32,128,255,16,	0,0,0,0,
0,0,0,0,	0,0,0,0,	32,128,255,16,	32,128,255,16,	32,128,255,16,	32,128,255,16,	0,0,0,0,	0,0,0,0,
0,0,0,0,	0,0,0,0,	0,0,0,0,	32,128,255,16,	32,128,255,16,	0,0,0,0,	0,0,0,0,	0,0,0,0,
0,0,0,0,	0,0,0,0,	0,0,0,0,	0,0,0,0,	0,0,0,0,	0,0,0,0,	0,0,0,0,	0,0,0,0,
}

Hi ZbuffeR,

Thanks for your help!

Finally i tried to get a blue circle from a picture. Now i meet a
new problem.

My problem is:
I get a blue circle texture from a picture, but when i draw the texture, i found that it is a little different from the picture.

It looks like some ripples.(with the center is blue circle and the outer is black circle), and the blue pixels are all at the center(blue pixels bulk). I want them to be scatter. Maybe it is
because my picture is not good.

Any suggestions would be appreciated!

Be sure to use :

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);

And sorry about that, but the alpha coefficients must be the same for both black parts and blue parts, my array was wrong.

Hi ZbuffeR,
I did the blend as the same as you, but it has no effect. Thanks very much!

Screenshot ?

Sorry, after screenshot i found that i got a wrong picture. I got wince’s screen picture and not OpenGL’s picture. In my program OpenGL and GDI use different layer. OpenGL layer is beyond GDI. Thanks!