View Full Version : Rotating Font...
09-09-2003, 06:25 PM
Would anyone know where I could find some tutorial explaining how to rotate (windows) font using VB 6.0 code language along with OpenGL. Acknowledge this, I am trying to avoid create font using bmp, jpg, gph or any graphic related files.
If you know any of it, care to share me the webpage and I'd be so much appreicated.
09-09-2003, 09:16 PM
you must use wglUseFontBitmaps to create font in this way
------ STOLEN FROM MSDN ------
// create a rendering context
hglrc = wglCreateContext (hdc);
// make it the calling thread's current rendering context
wglMakeCurrent (hdc, hglrc);
// now we can call OpenGL API
// make the system font the device context's selected font
SelectObject (hdc, GetStockObject (SYSTEM_FONT));
// create the bitmap display lists
// we're making images of glyphs 0 thru 255
// the display list numbering starts at 1000, an arbitrary choice
wglUseFontBitmaps (hdc, 0, 255, 1000);
// display a string:
// indicate start of glyph display lists
// now draw the characters in a string
glCallLists (24, GL_UNSIGNED_BYTE, "Hello Win32 OpenGL World");
but, just before the calllist call glRotate() to rotate the text.
09-09-2003, 09:24 PM
But this is a C++ Language, I would need Visual basic 6.0 language... I wouldn't know what or how to declare varbles in VB6 language. Would you happen to know how to convert it? let me know...
09-10-2003, 12:48 AM
You must download OpenGL for VB type library... just go on (altavista, yahoo...) and perform a search... sorry I don't remember the website..
Then keep in mind that HDC and HGLRC are Long variables. The other functions you don't have in standard VB are included inthe type library....
09-10-2003, 07:04 PM
I have already downloaded OpenGL before I started to get more into it. As far I am somewhat proficent in visual basic 6. i don't see how C++ language can run in VB otherwise it would encountered some bug problems or the varibles name error. Unless you can propose something you know about VB such as converting C++ into VB runtime. Let me know. http://www.opengl.org/discussion_boards/ubb/smile.gif
09-10-2003, 10:02 PM
Hope I will be of help now:
create the window and a rendering context and make it current.
SelectObject Me.hdc, GetStockObject(SYSTEM_FONT)
this will select the default font, if you want another one read about CreateFontIndirect. I don't remember what SYSTEM_FONT must be replaced with.
wglUseFontBitmaps Me.hdc, 0, 255, 1000
now your setup phase is over.
setup projection and view matrix.
glTranslate to where you want start writing.
glRotate of n degrees around the z axis
glRotatef 45, 0, 0, 1 for example
glCallListsString 24, GL_UNSIGNED_BYTE, "Hello Win32 OpenGL World"
Replace the constant GL_UNSIGNED_BYTE with its corresponding in VB. 24 is the string length.
Add this somewhere if the type library does not support strings:
Public Declare Function glCallListsString Lib "opengl32" Alias "glCallLists " (ByVal n As Long,ByVal type As Long,Byal lists As String)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.