Results 1 to 7 of 7

Thread: Pbuffer without a visible window

  1. #1
    Member Newbie
    Join Date
    Mar 2001
    Posts
    44

    Pbuffer without a visible window

    Is it possible? I am not very familiar with windows gdi but I am getting non-zero DC's from either createdc or createcompatabledc but both throw an invalid handle error when I try to set the pixel format. Pbuffers work just fine when I have a visible window.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Sep 2002
    Location
    Nanjing,China
    Posts
    116

    Re: Pbuffer without a visible window

    Yes, it's possible.try hard again.
    Do you reuse the hdc and hglrc . In my app,i create new hdc and hglrc .

  3. #3
    Member Newbie
    Join Date
    Mar 2001
    Posts
    44

    Re: Pbuffer without a visible window

    It is good to know it is possible. I have only tried making my own DC's since I am going in through java so I don't have access to any pregenerated dc's. GetDC(0), CreateDC("DISPLAY",null,null,null) and CreateCompatableDC(0) all return non-zero DC's but all return invalid handle errors when I call SetPixelFormat. If you could post just a snippit of code that you know works I would appreciate. I am sure part of it is because of java but hopefully it is something I am doing wrong with windows gdi.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Sep 2002
    Location
    Nanjing,China
    Posts
    116

    Re: Pbuffer without a visible window

    The code reading can be very boring .More often than not, they are useless. I know code tinkering is brain exhausted but would do you good .however if you insist ,please drop me your e mail address.

    the problem may lay how you get DC
    Why you get DC that way ,why not get DC from window,like GetDC(hwnd).CreateDC("DISPLAY") is little like CreateIC is to get the profiler of the current DC. man ,you can not use the DC created that way.

    Another to check out is, don't forget to put the choosePixelFormat api before setPixelFormat.'Cause the return value of the choosePixelFormat is one important parameter in the setPixelFormat.

  5. #5
    Member Newbie
    Join Date
    Mar 2001
    Posts
    44

    Re: Pbuffer without a visible window

    I would use GetDC(hwin) but I don't have access to any window handles since I am using java. That is why I am trying to create a device context from scratch. Like I said in the first post I don't know much about windows gdi. I do get valid pixel formats from choosePixelFormat. If creating DC's with CreateDC is wrong maybe you could point me in the right direction, that would seem to be the problem since I am getting invalid handle errors when I call setPixelFormat. Any help is much appreciated.

  6. #6
    Senior Member Regular Contributor
    Join Date
    Sep 2002
    Location
    Nanjing,China
    Posts
    116

    Re: Pbuffer without a visible window

    The reason that you can not use CreateDC("DISPLAY",NULL,NULL,NULL),is that for such created DC , your opengl app would never know what your DC's info like resolution ,width,height,etc . However ,GetDC(hwnd) is a more sure bet , the passed-into hwnd parameter make sure the DC is appropriately setted.

    If you stick to use the CreateDC
    don't use NULL for the second and fourth parameters
    ,you can try to use <EnumDisplayDevice> get the devicename and <DocumentProperty> to get the DEVMODE for the CreateDC.

    This kind of code can get you very dirty.
    And i suspect for the java-GL environment ,is it worth to go that far to do what the java itself is supposed to do --i.e. init GL window for you.

    If i were you, i would either use Java to init window ,or use window api to init window. ,mix java and window api in code simply not proper way to do for my taste.
    My two cents.

  7. #7
    Member Newbie
    Join Date
    Mar 2001
    Posts
    44

    Re: Pbuffer without a visible window

    I will give that a try. Thanks for the info.

Similar Threads

  1. Share rendering context between window / pbuffer
    By imported_muratmat in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 09-16-2009, 12:44 AM
  2. copy pixels from visible buffer to pbuffer?
    By codemonkey76 in forum OpenGL: Advanced Coding
    Replies: 9
    Last Post: 12-16-2004, 03:03 PM
  3. hidden window, pbuffer
    By djik in forum OpenGL: Windows
    Replies: 8
    Last Post: 08-02-2004, 11:41 AM
  4. Create pbuffer without getting gl driver from window.
    By ben harper in forum OpenGL: Windows
    Replies: 3
    Last Post: 06-11-2004, 11:40 AM
  5. copying from pbuffer to window
    By richk in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 04-07-2004, 01:44 PM

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