Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

OpenGL and wchar_t

morninigpigmorninigpig Member Posts: 3
How can I draw a unichar string (or variable wchar_t*) on OpenGL surface?
(may be as texture or something else)

Comments

  • CroWCroW Member Posts: 348
    : How can I draw a unichar string (or variable wchar_t*) on OpenGL surface?
    : (may be as texture or something else)
    :
    :


    1. create a win32-bitmap (CreateBitmap(..))
    2. write your string with TextOut(..)
    3. copy the bitmap-bits to a buffer and use it as a texture(maybe second texture/multitexture) or draw it to the screen-buffer with glDrawPixels

    note: the gdi-stuff is very slow,so its better you prepare your strings at load-time.
  • morninigpigmorninigpig Member Posts: 3
    : 1. create a win32-bitmap (CreateBitmap(..))
    : 2. write your string with TextOut(..)
    : 3. copy the bitmap-bits to a buffer and use it as a texture(maybe second texture/multitexture) or draw it to the screen-buffer with glDrawPixels
    :
    : note: the gdi-stuff is very slow,so its better you prepare your strings at load-time.
    :

    I. e. (see questions below)

    HBITMAP bitmap = CreateBitmap(256, 256, 1, 32, NULL);
    TextOut(_?_,0,0,word,len); // how to receive a first argument?
    BitBlt(_?_, 0, 0, 256, 256, _?_, 0, 0, SRCCOPY);
    // and these hdc?

    BITMAP bm;
    GetObject(bitmap , sizeof(bm), &bm);
    gluBuild2DMipmaps( GL_TEXTURE_2D, 3, bm.bmWidth, bm.bmHeight,
    GL_BGR_EXT, GL_UNSIGNED_BYTE,bm.bmBits);


Sign In or Register to comment.