Jump to content
  • Advertisement
Sign in to follow this  
fig

OpenGL Use only second texture unit

This topic is 3743 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

To speed up bitmap font rendering, I want to apply the font texture to an unused texture unit (eg. unit 2). Because this texture unit is only ever used by my font, it'll cut down on texture switches dramatically. My state manager will only apply the font texture once, instead of every time some text is rendered. I'm writing an engine that has renderers for both OpenGL and Direct3D (only version 9 so far). In OpenGL, this works fine by only enabling the texture unit I want to use for the font rendering. I tried the same in DirectX 9, but the font is rendered as a big block of white. Is this possible with DirectX? If so, what texture stages etc. would need to be set to activate only the one texture unit that I want to use at that time?

Share this post


Link to post
Share on other sites
Advertisement
You'll want to use SetTextureStageState() (Assuming fixed function). However, this won't give you much of a performance boost (if any), since you'll still be making more DrawPrimitive calls. D3D will cache the textures on the GPU until it needs the space, so a call to SetTexture doesn't necessarily mean the old texture is removed from VRAM and a new one is uploaded.

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!