Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3615932
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:26:07+00:00 2026-05-18T22:26:07+00:00

I am atempting to draw text to a textured mesh object. The mesh is

  • 0

I am atempting to draw text to a textured mesh object. The mesh is basically a cube which has been pasted up to the front of the screen. (overall I’m aiming for a menu system). After a bit of googling I’ve found surprisingly little information on how to draw a text to a texture. I’ve read that it should be as simple as making a texture, setting it as a render source and then drawing to it, yet I cannot figure this one out.

Any ideas, suggestions or skeleton code with the necessary function calls to give me a jump start?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:26:08+00:00Added an answer on May 18, 2026 at 10:26 pm

    When you need to render text into texture, you should setup rendering to texture as Adam suggested, to actually render some text you can do this

    Create font and sprite

    D3DX10CreateFont(device, 16, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Verdana", &font);
    D3DX10CreateSprite(device, 256, &sprite);
    

    and render

    hr = sprite->Begin(0);
    left = L"Some text to render";
    RECT r;
    r.top = 0;
    r.bottom = window->height;
    r.left = 0;
    r.right = window->width;
    hr = font->DrawTextW(sprite, left.c_str(), -1, &r, DT_LEFT | DT_TOP | DT_CALCRECT, D3DXCOLOR(0.0f, 1.0f, 0.0f, 1.0f));
    hr = font->DrawTextW(sprite, left.c_str(), -1, &r, DT_LEFT | DT_TOP, D3DXCOLOR(0.0f, 1.0f, 0.0f, 1.0f));
    //hr = sprite->Flush();
    hr = sprite->End();
    device->OMSetBlendState(NULL, 0, 0xffffffff);
    

    Beware, sprite rendering changes blend state, so be sure to set it to default. If you need only “text on plain surface” (no texture mapping on mesh) you could render sprite into main scene instead of texture.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting to do SetData() on Texture2D that has been recently Draw()-n by SpriteBatch leads
I'm attempting to draw text to the screen using GLUT in 2d. I want
I'm attempting to draw a text box on the screen. If I assign width
Attempting to build a C# project which has numerous references to assemblies in NuGet
I am attempting to draw the medal overlaying the corner of the score screen
I'm attempting to draw to screen with a bunch of colors that I have
I am currently attempting to draw images on the screen at a regular rate
I've been attempting to render text onto an openGL window using SDL and the
I'd like to draw a piece of TEdit.Text using Font.Color different from the default.
I'm attempting to draw this image on screen: This is the code: CALayer* dullLayer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.