Ruby, openGL : change texture luminosity -


i have problems opengl , luminosity. let me explain problem :

sprite

i drew "sprite" (it's plane here) code :

sprite.set_active left, right, top, bottom = 0.0, 1.0, 1.0, 0.0 glpushmatrix     gltranslate(@position.x - 16, @position.y, @position.z)     glrotate(-90 -@window.camera.horizontal_angle, 0, 1, 0)     glscale(chara.width, chara.height, 32.0)     begin         glenable(gl_blend)         glbegin(gl_quads)             glcolor4f(1.0, 1.0, 1.0, 1.0)             gltexcoord2d(left, top); glvertex3f(0, 1, 0.5)             gltexcoord2d(right, top); glvertex3f(1, 1, 0.5)             gltexcoord2d(right, bottom); glvertex3f(1, 0, 0.5)             gltexcoord2d(left, bottom); glvertex3f(0, 0, 0.5)         glend         gldisable(gl_blend)     rescue      end glpopmatrix 

my problem line :

glcolor4f(1.0, 1.0, 1.0, 1.0) 

well, can put number lesser 1.0 have darker sprite, can't contrary. how can ? how can make sprite totally white, example ?

to full control on fragment processing, best approach using programmable pipeline, can implement want glsl code.

but there options work case in fixed pipeline. simplest 1 using different gl_texture_env_mode. default value gl_modulate, means color specified glcolor4f() multiplied color texture. found, allows make texture darker, not brighter.

you try using gl_add instead. name suggests, produce final output sum of texture color , color glcolor4f(). example:

gltexenvi(gl_texture_env, gl_texture_env_mode, gl_add); glcolor4f(0.2f, 0.2f, 0.2f, 0.0f); 

would add 0.2 color components read texture.

there more complex functionality in fixed pipeline gives more control on how texture values used generate colors. can find looking "texture combiners". in personal opinion, you're better off moving programmable pipeline if need complex enough require texture combiners.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -