• Welcome to Dark Bit Factory & Gravity.
 

4k - TextPrint and SinusScroller

Started by va!n, April 05, 2007

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

va!n

hi... as some of you may know, i am working on a 4k intro for breakpoint... i think i will start driving to the party around 8:00am (german time)... first i have to thanks rbraz for trying to help me and converting my code to C... thanks!

Sadly rbraz dont have so much time atm... so i still try to ask the last hours before going to the party, if someone of you guys can/may help me as 4k OpenGL newbie ^^

I want to draw text on screen and use the same font for a sinus scroller... The font i want to use should be generated at runtime and is called "Times New Roman" ^^ If someone can help me, this would be great...

Btw, here are the routines i did a few days ago but i think the routines still suxx... printing text on screen, makes problems on two friends PCs (only a few fames/sec O.O) ... here it works smooth... but when printing text i see that the intro slow down a lot.. (dont know why)

Another thing... i think the best way would be to use a big texture (where all chars are available) and clipping each char for the TextPrint and SinusScroller as Texture...(even, each char of the sinus-scroller should transform in y axis to realize a wave on each char like the wave of the sinusscroller...

many thanks in advance...


Btw: Should i finish and release the 4k at BP... you can be sure to find greetz to Shockwave/S!P, rbraz ... ;) 





- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Jim

#1
Can you salvage anything out of this (attached code and exe)?  It creates bitmap fonts from Windows fonts using Windows API.

Jim
Challenge Trophies Won:

va!n

Ahhhh... sorry... forgot to post my actual code...


// -------- Create Font --------
HFONT font = CreateFont(48, 24, 0, 0, FW_BOLD, false, false, false, ANSI_CHARSET,
   OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE | FIXED_PITCH,
   "Times New Roman");
SelectObject(hDC, font);
wglUseFontBitmaps(hDC, 0, 255, m_iFontBase);



void Font_DrawText(float x, float y, char *pText)
{
  glPushAttrib(GL_LIST_BIT);
  glListBase(m_iFontBase);

glColor3f  (0.38f,0.45f,0.67f);
glRasterPos2f(x-0.5f, y+1.0f);
  glCallLists(lstrlen(pText), GL_UNSIGNED_BYTE, pText);

  glColor3f  (0.06f,0.12f,0.32f);
  glRasterPos2f(x+1.0f, y-0.5f);
glCallLists(lstrlen(pText), GL_UNSIGNED_BYTE, pText);

  glColor3f  (0.19f,0.27f,0.45f);
glRasterPos2f(x, y);
glCallLists(lstrlen(pText), GL_UNSIGNED_BYTE, pText);

  glPopAttrib();
}


- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Clyde

I've not done a huge amount of OGL Stuff, but as an idea to help you if your still stuck, I wonder if theres anything handy over in the Nehe Tutorials. 
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

va!n

i dont know if there is another (better) way, to create the font using Win32 API for creating a temp bitmap or just doing this stuff with OGL only... however, on nehe i saw a turorial but the source for doing was very long... i need an easy and very small code for doing it in 4k ^^
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Jim

In the code I posted, I create a bitmap you could use as a texture.  The letters (32-127) are arranged in a fixed size grid so you could use GL_QUADS, using the uvs to extract a letter, to draw them which *may* overcome your performance issues with the wglUseFontBitmaps approach.

Jim
Challenge Trophies Won:

va!n

ahhh... thanks for the source.. i dint noticed it before ^^  i will take a look to your source... (have try to install my new notebook with XP... preinstalled vista (dont like it)... searching like hell for XP compatible drivers.. argh.. a looooong night before party :P
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

va!n

result looks very good... i will take a closer look to the source at the party... still having probs finding XP drivers for my vista notebook.. ^^ (the last days dont like me ^^)
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won: