[SOLVED]Animating color of object under mouse.

I am trying to make an effect where object under mouse would be colored with some color(green for example).
I want it to animate, so at some point in animation, object would be whole green, and at some other, a bit less green, and you could see a bit of model’s texture

drop.io/grizzlycro/asset/b-7z (87kB)

b/game/picker.py ( codepad.org/8wyRjfvI ) is real code

if line #66 is moved one tab to the left (that way it is not in “if” condition)
setTexture is called every frame, and i get desired effect.

Deal is that such thing destroys framerate.
(i get only about 200 FPS while animating texture on Phenom 2 940 (quad) @ 3.8 and geforce GTS 250)

Do i need to call setTexture on every frame to get this effect?
Is there easier(hardware) way to get same effect.

Wait–you get “only” 200 fps while animating texture? I’d hardly call that destroying your frame rate. Remember, your monitor probably only syncs at 60 fps, so anything faster than that is just wasting CPU anyway.


well, you should take into consideration which hardware i am running on.
I can run most of the games at 200+ FPS.

And here i get simoke plane and cube.

When i dont call setTexture on every frame, i get 1500 FPS, and i am not sure is setTexture needed on every frame, but it wont animate if i dont call it on every frame…

So that is one texture animation for one of total of two objects in scene(They dont make 100 tris together…).

Its not poor performance on my comp thats bothering me that much, but i wonder how fast will this run on slower/weaker rigs…
And i wanted to keep requirements to minimum, so i didnt use shaders.

But if this cant be done faster without shaders, i am going to conquer shader language and rewrite it.

And i want to use this in game, so there will be much more things going on.

When i (or anyone else) make this work, i will comment it properly and post in code snipplets.

thinking in fps is dangerous. cause it leads you to wrong assumtions.

when talking about performance. always use milliseconds cause they are directly proportional to performance. and not inverse proportional like FPS is.

so 1500 fps are 0.666ms
200fps are 5ms
thats a difference of roughly 4.5ms

most monitor refresh-rates are only 60hz. which would be 16.6ms
so you have still lots of time to waste.

from what it looks like. the problem is neither setTexture nor shaders. but the shader generator. i sorta have the bad feeling it is re-creating the shader for your object each time you set the new textures.
if you avoid this somehow things might get better. either by writing your own shader. or not using a texture to color it. but maybe using something like setColor of the model itself or so.

well. from what it looks like… you ARE using shaders.
uncomment the rendersetShaderAuto() call. see if it speeds things up.

Tnx Thomas, i commented setShaderAuto, its about 1ms(a tiny bit more [980 FPS]) now.I didnt use setShaderAuto(), didnt knew what it does, and for some reason turned it on at some point…