Jump to content
  • Advertisement
Sign in to follow this  
mfawcett

OpenGL fragment shader turns FTGL text black?

This topic is 4696 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using FTGL Textured Fonts for my text output (OpenGL). I just integrated shaders and I'm getting perfect results except my text is always black now. I thought I would test with just a simple passthrough fragment shader, but I still get black text. Everything else shows up fine. Here is the shader (Cg).
struct input
{
	float4 color : COLOR;
	float2 texcoord : TEXCOORD0;
};

struct output
{
	float4 color : COLOR;
};

output main(input fragment, uniform sampler2D texture)
{
	output nrv;
	nrv.color = fragment.color * tex2D(texture, fragment.texcoord);
	return nrv;
}

The rendering for the text is as simple as a glColor4fv call with the text's color, and then font->Render(some_string); The tex2D call always returns black for the text, and the color is correct. If I don't bind the shader, the text shows up with the correct color. Does anyone have any experience with FTGL + fragment shaders, or perhaps similar experiences?

Share this post


Link to post
Share on other sites
Advertisement
Depeding on when you render you text. If your shader is affecting all pixels on screen, which it probably is, then if you render your text before the shader, then most likely it is being affected by the shader. So you want to render all your geometry first w/ your shader. Then turn off your shader going back to fixed-functionality. Then render you text. I believe that sould work.

-Jacob Gardner

Share this post


Link to post
Share on other sites
Yea, that does work, I had tried that. I was just curious. Looking into it more, I think FTGL is generating GL_INTENSITY textures for the fonts, and I don't think my shader handles that correctly. I wouldn't know how to solve it either. I'll just make sure the text uses the fixed function pipeline for now.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!