Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

owl

Fonts in Warcraft3. How they keep them the same size on different resolutions?

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

And how would you go to render fonts like they do on the heros description and hit point that apear on the screen while you play, all this in openGL. I render my fonts with the Freetype lib in ortho mode, but I think ortho would be a bitch in order to make the text be in a certain/moving area of a 3D rendered scene... I'm using ortho mode because is the only way I can make the font be rendered with the appropiate size (in pixels). Besides, in Warcraft3's menu, when you change the resolution, the fonts in the buttons and everything else remain with the same size, no matter what resolution you pick. I'm blank. I don't know how to do it. help? Thanks EDIT: I know Warcraft3 runs with DirectX. [edited by - owl on June 4, 2004 2:44:31 AM]

Share this post


Link to post
Share on other sites
Advertisement
We have that in Eternal Lands too (but for us it is a little easier, given the fact we have an Ortho perspective (but we do have to adjust the text size for zoom in and out). Our client is OpenSource, so you can look on how we do it (I didn''t write that specific code, and I am too lazy to check the math behind it, but feel free to look).

Share this post


Link to post
Share on other sites
I have not player war craft, but does the font size stay the same in pixel size or in proportion to the screen size?

If you want your text to stay in same pixel size regardless of your resolution (that is, when in higher resolution, the text will look smaller on screen), then use your window size as the bounds you set with the glOrtho.

For example:
int iWidth = pEngine->GetWindowWidth();
int iHeight = pEngine->GetWindowHeight();
glOrtho( 0, iWidth, 0, iHeight, -1, 1 );


In the other case pick fixed width or height (say width=640), and scale the other dimension depending the window aspect ratio. Then feed that dimension to the glOrtho.

For example:
int iWidth = pEngine->GetWindowWidth();
int iHeight = pEngine->GetWindowWidth();
float fW = 640.0f;
float fH = fW / (float)iWidth * (float)iHeight;
glOrtho( 0, fW, 0, fH, -1, 1 );

Share this post


Link to post
Share on other sites
I think they rendered it as textured quad. But I don''t know how they make it still look good even in different resolutions.

Share this post


Link to post
Share on other sites
you may set the ortho mode as:
glOrtho( 0, 1, 0, 1, -1, 1 );

and when rendering fonts (as a texture on a quad) you can use for example:

glVertex2f(0.00f , 0.00f);
glVertex2f(0.10f , 0.00f);
...

in every resolution the size of the 2D object will be same just like you wanted.





What we do in life, echoes in eternity!

Share this post


Link to post
Share on other sites
quote:
Original post by alnite
I think they rendered it as textured quad. But I don''t know how they make it still look good even in different resolutions.


by making the default resolution insanly high. Make a font bitmap set like 64 pixels high. THen on higher resolutions you always size it smaller, and it still looks nice

--------------------------------------------------------
Life would be so much easier if we could just get the source code.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
My guess is that they use orthogonal projection with "resolution" set to 1024x768, and when they draw menu and fonts, they just assume that screen is 1024x768. That would explane, why fonts look crappy when resolution is smaller than 1024x768, but of course I''m not exactly sure what ortho resolution they are using.

Share this post


Link to post
Share on other sites
Thank you everyone!

quote:
Original post by emreture
you may set the ortho mode as:
glOrtho( 0, 1, 0, 1, -1, 1 );

and when rendering fonts (as a texture on a quad) you can use for example:

glVertex2f(0.00f , 0.00f);
glVertex2f(0.10f , 0.00f);
...

in every resolution the size of the 2D object will be same just like you wanted.



That''s what I''m thinking, but how would you do to make some text match the position of an object that was positioned using another cartesian space?

Anyway I''m afraid that the scaled font may look quite crappy... Maybe making the bitmap font insanely high as vampire says could work...

Share this post


Link to post
Share on other sites
Just draw the text in the perspective mode, above the actor''s head. Of course, rotate it so it faces the camera.
Calculate the distance from camera to actor, and modify the text size accordingly.

Share this post


Link to post
Share on other sites

  • 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!