Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3322042
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:08:06+00:00 2026-05-17T23:08:06+00:00

I have an windowless IViewObject object. I want to call its Draw function to

  • 0

I have an windowless IViewObject object.

I want to call its Draw function to render into Opengl PBO memory (alternatively OleDraw is simpler).

Right now i first create an HBITMAP using CreateDIBSection (which allocates its own memory) and then copy from this into my PBO memory. However, I’d like to avoid this extra copy. I believe this should be possible in theory as mapped PBOs live in page-locked memory.

This is what I do today simplified:

hdc = CreateCompatibleDC(nullptr); // Get current DC
HBITMAP bitmap = CreateDIBSection(... hdc, &bitmap_data_...); // Create Bitmap
SelectObject(hdc, bitmap);
m_spViewObject->Draw(... hdc ...); // IViewObject->Draw to bitmap
memcpy(pbo_ptr, bitmap_data_, size);

My question is if its possible to have the Draw function to somehow draw to memory which i have specified (in this case the PBO) instead of memory allocated by the win32 api (CreateDIBSection)?

One way might be if it is possible to create a device independent bitmap from user specified memory? However, I have found no function that does this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:08:07+00:00Added an answer on May 17, 2026 at 11:08 pm

    What you’re trying to do is very logical IMHO. However unfortunately AFAIK there’s no conventional way to do this.

    According to WinAPI DIB sections either allocate their own memory or work with the file mapping. OTOH OpenGL manages its memory in its own way.
    There exists an option to create a DIB from any memory block, but it’s for video drivers only, not accessible to the user-mode applications.

    There’s actually a very complex possibility to avoid this extra-copy. You may create a virtual video driver (not to be confused with mirror video driver), obtain its HDC. Then in you ‘custom’ way tell it where it should draw (via Escape). And then you may pass this HDC to whatever you want to do the drawing, your virtual video driver will draw directly on the memory you want.

    Moreover, to do the actual drawing you will be able to use the OS functions. Wrap your memory by GDI-recognizable bitmap (EngCreateBitmap), and draw on it using OS (EngXXXX), so that you’ll have to implement only the minimum functionality in your driver.

    However this is a driver development anyway. I believe that copying a memory block is fast enough (comparison to the actual drawing), so that you can leave your code as-is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have a windowless OpenGL context (on both GNU/linux with Xorg
I have an embedded IWebBrowser2 control using straight C++ (windowed, not windowless) and when
I have the following Silverlight control defined: <object id=objImageViewer data=data:application/x-silverlight-2, type=application/x-silverlight-2 width=100% height=500px> <param
Have you seen library for flexible working with terminal(Unix like)? I want to implement
have a table that dynamically generates text boxes in run time. I want to
I want to have generalised email templates. Currently I have multiple email templates with
have a wierd issue. for the life of me can't trace this back (its
Have just started to get into CakePHP since a couple of weeks back. I
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.