Text not appearing in button

I have this Button2D class and everything works fine except that the text isn´t drawn in the button.
Discovered the problem, the font color is always White because of this line

Globals.normalEffect.Parameters["filterColor"].SetValue(tempColor.ToVector4());

How can I fix it?

 public class Button2D : Basic2D
    {
        protected bool pressed, hovered;
        protected string text;
        protected Color hoverColor;
        protected SpriteFont font;
        protected object info;
        protected PassObject buttonClicked;

        public Button2D(string _path,Vector2 _position, Vector2 _dimensions,string _font,string _text,object _info,PassObject _buttonClicked) 
            : base(_path,_position,_dimensions)
        {
            text = _text;
           
            buttonClicked = _buttonClicked;

            if (_font != null)
            {
                font = Globals.content.Load<SpriteFont>(_font);
            }

            pressed = false;
            hoverColor = new Color(200, 230, 255);

            info = _info;
        }

        public override void Update(Vector2 _offset)
        {
            if (Hover(_offset))
            {
                hovered = true;

                if (Globals.mouseControl.LeftClick())
                {
                   
                    hovered = false;
                    pressed = true;
                }

                else if (Globals.mouseControl.LeftClickRelease())
                {
                    RunButtonClicked();
                    GameGlobals.score = 0;
                }
            }
            else
            {
                hovered = false;
            }

            if(!Globals.mouseControl.LeftClick() && !Globals.mouseControl.LeftClickHold())
            {
                pressed = false;
            }

            base.Update(_offset);
        }

        public virtual void Reset()
        {
            pressed = false;
            hovered = false;
        }

        public virtual void RunButtonClicked()
        {
            if (buttonClicked != null)
            {
                Debug.WriteLine("BUTOON CLICKED NAO E NULO");
                buttonClicked(info);
            }
            else
            {
                Debug.WriteLine("Button CLICKED IS NULL");
            }

            Reset();
        }

        public override void Draw(Vector2 _offset)
        {
            Color tempColor = Color.White;

            if (pressed)
            {
                tempColor = Color.Gray;
            }
            else if (hovered)
            {
                tempColor = hoverColor;
            }
            Globals.normalEffect.Parameters["xSize"].SetValue((float)GetModel().Bounds.Width);
            Globals.normalEffect.Parameters["ySize"].SetValue((float)GetModel().Bounds.Height);
            Globals.normalEffect.Parameters["xDraw"].SetValue((float)((int)dimensions.X));
            Globals.normalEffect.Parameters["yDraw"].SetValue((float)((int)dimensions.Y));
            Globals.normalEffect.Parameters["filterColor"].SetValue(tempColor.ToVector4());
            Globals.normalEffect.CurrentTechnique.Passes[0].Apply();

            base.Draw(_offset);

            Vector2 strDims = font.MeasureString(text);
            Debug.WriteLine("Text:" + text);
            Globals.spriteBatch.DrawString(font, text, position + _offset + new Vector2(-strDims.X / 2, -strDims.Y / 2),Color.Black);
        }
    }

Seems that you dont have Begin()/End().

Try
Globals.spriteBatch.Begin();
Globals.spriteBatch.DrawString(font, text, position + _offset + new Vector2(-strDims.X / 2, -strDims.Y / 2),Color.Black);
Globals.spriteBatch.End();

Change:

    Color tempColor = Color.White;

To:

    Color tempColor = Color.Black;

I tried that. I used a fx file with a style.Basically , the line that I put in the top of my question puts both the background and the text the same color. Is there any other way to draw a button?

I’m not familiar with the framework that you are using for buttons so I can’t say. What are you using?

I´ll try to explain.
First I declared this attribute in my Globals class

Then in my main class I loaded the file

This is my effect file

// Our texture sampler

float xSize;
float ySize;
float xDraw;
float yDraw;

float4 filterColor;


texture Texture;
sampler TextureSampler = sampler_state
{
    Texture = <Texture>;
};

// This data comes from the sprite batch vertex shader
struct VertexShaderOutput
{
    float4 Position : SV_POSITION;
	float4 Color : COLOR0;
	float2 TextureCordinate : TEXCOORD0;
};

// Our pixel shader
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR
{
	float4 texColor = tex2D(TextureSampler, input.TextureCordinate);
	
	float vertPixSize = 1.0f/ySize;
	float horPixSize = 1.0f/xSize;
	
	float4 color;
	if(xDraw/xSize < .6f || yDraw/ySize < .6f)
	{
		if(xDraw/xSize < .4f || yDraw/ySize < .4f)
		{
			vertPixSize = 2.0f/ySize;
			horPixSize = 2.0f/xSize;
		}
	
		float4 aboveColor = tex2D(TextureSampler, (input.TextureCordinate) + float2(0, -vertPixSize));
		
		float4 belowColor = tex2D(TextureSampler, (input.TextureCordinate) + float2(0, vertPixSize));
		
		float4 leftColor = tex2D(TextureSampler, (input.TextureCordinate) + float2(-horPixSize, 0));
		
		float4 rightColor = tex2D(TextureSampler, (input.TextureCordinate) + float2(horPixSize, 0));
		
		//float greyscaleAverage = (texColor.r + texColor.g + texColor.b)/3;
		
		 color = float4((texColor.r + aboveColor.r + belowColor.r + leftColor.r + rightColor.r)/5,
		 (texColor.g + aboveColor.g + belowColor.g + leftColor.g + rightColor.g)/5, 
		 (texColor.b + aboveColor.b + belowColor.b + leftColor.b + rightColor.b)/5, 
		 (texColor.a + aboveColor.a + belowColor.a + leftColor.a + rightColor.a)/5);
	}
	else
	{
		color = float4(texColor.r, texColor.g, texColor.b, texColor.a);
	}
	
	

	return color * filterColor;
}

// Compile our shader
technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_3_0 PixelShaderFunction();
    }
}

It looks like your shader always returns the same color so the button texture and the text are tinted the same color. Unless there is a specific reason you need to draw text with the shader don’t. I’ve found drawing textures and text in separate calls to Begin and End reduces text render issues.

I don´t think I have a shader. At least I don´t remember create one

It’s your effect file, they are shaders. The pixel shader is always returning the same color.

I think I solved it, but it ´s not 100% correct because the letters are a little cutted below. Anyway, how can i Draw the button without the shaders? I didn´t intend to use the fx file but the only tutorial I found that I could understand used it

Really it is just drawing text over a texture. Draw the texture like you would draw a sprite then draw the text in the same position. The tricky part is telling if it has been selected in some way. I don’t have a sample handy that is easy to reuse. The only sample I have requires 4 classes to work completely.