Results 1 to 8 of 8

Thread: HDC, HWND and GLUT

  1. #1
    Senior Member Frequent Contributor
    Join Date
    Nov 2002
    Location
    Latvia
    Posts
    626

    HDC, HWND and GLUT

    I'd like to use wglFontOutlines & wglFontBitmaps, but they require HDC. To get HDC I must have HWND of the window I'm rendering to, but I have 2 windows in GLUT. Is there some way to get HWND of rendering window?

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Nov 2002
    Location
    Latvia
    Posts
    626

    Re: HDC, HWND and GLUT

    ??
    I know that I could get dc by caling hDC=GetDC(hWnd), but hwnd is usually assigned value by function CreateWindowEx(...., in glut I window is allready created
    Do I have to get hdc by parsing all active windows & checking their titles??? What do you people do when you have to set up pbuffer, hdc is needed too...

  3. #3

    Re: HDC, HWND and GLUT

    Why do you use GLUT then? If you use Windows specific code (wgl..) you may as well set up your OpenGL window (and rendering context) yourself.

    You could search the GLUT source, where window handles are stored, GLUT won't expose these, however (I think), since this would mean to lose cross platform compatibility.

  4. #4
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: HDC, HWND and GLUT

    Platform independence is out of the way if you use wgl functions, means you can also use:
    HGLRC wglGetCurrentContext(void);
    HDC wglGetCurrentDC(void);

    Hint, it sometimes helps if you have a look at a function reference list.

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Nov 2002
    Location
    Latvia
    Posts
    626

    Re: HDC, HWND and GLUT

    Don't want to jump to pure w32 app right now, but will do that. About function list, havn't found a place to find them all together.

    Anyway, thanks

  6. #6
    Senior Member Regular Contributor
    Join Date
    Mar 2003
    Location
    Slovakia
    Posts
    108

    Re: HDC, HWND and GLUT

    Try GetActiveWindow() maybe it will work

  7. #7
    Senior Member Frequent Contributor
    Join Date
    Nov 2002
    Location
    Latvia
    Posts
    626

    Re: HDC, HWND and GLUT

    wglGetCurrentDC works like it should, thanks.

  8. #8
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: HDC, HWND and GLUT

    Originally posted by M/\dm/\n:
    [B]About function list, havn't found a place to find them all together.
    B]
    For any Windows related programming question MSDN is the first choice.

    E.g. wgl functions are here: http://msdn.microsoft.com/library/de...pnglo_4e7n.asp

Similar Threads

  1. retrieve HWND from HDC
    By robtherich in forum OpenGL: Windows
    Replies: 4
    Last Post: 01-09-2008, 01:28 PM
  2. How to get HWND of GLUT window?
    By brcain in forum OpenGL: Windows
    Replies: 3
    Last Post: 02-23-2005, 06:26 AM
  3. Replies: 1
    Last Post: 02-01-2001, 06:59 AM
  4. Can an HWND be obtained from a GLUT window?
    By imported_vishnu in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 06-20-2000, 12:27 PM
  5. Getting an HWND for a glut window
    By imported_Rob in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-09-2000, 02:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean