Click here to Skip to main content
Licence 
First Posted 24 Oct 2001
Views 93,654
Bookmarked 23 times

How to draw OpenGL to a window you created in a dialog box with the resource editor

By | 24 Oct 2001 | Article
How to draw OpenGL to a window you created in a dialog box with the resource editor without manually using CreateWindow.

Sample Image - screenshot.jpg

Introduction

This example code I created explains and shows how you can draw OpenGL into a window that you created with the resource editor, without having to call CreateWindow. In my example, I used VC 6's New project creator wizard to start my project and then created a dialog box. In the dialog box, I have created 4 edit style windows. The technique used is simply retrieve the handle of the edit windows, retrieve the HDC for each window and pass them into your regular OpenGL initialization and rendering. What is important to note in my example is you have to set the current rendering context to the desired window before painting to it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Chong Hin Ooi



United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralPlease check this article PinmemberSharjith12:16 9 Nov '10  
GeneralBUG: This code is unsafe without CS_OWNDC PinmemberMember 122382915:03 17 Nov '09  
Questionbackground color Pinmemberlabs13247:16 23 Aug '06  
GeneralRe: background color PinmemberGita.Bairavi20:52 12 Mar '08  
QuestionHow to run 2 different(or same) OpenGL objects in one DialogBox? Pinmemberwerter121:20 3 May '04  
QuestionHow to make a multi-viewport in OpenGL with MFC? PinmemberVicher1:41 21 Apr '04  
QuestionHowto Draw something in an edit box? Pinmemberszlivkab@freemail.hu23:55 25 Oct '03  
Generalmouse events PinsussAnonymous10:24 21 Jan '03  
GeneralRe: mouse events PinsussAnonymous1:33 8 Jun '03  
GeneralRuns well the first time . . . PinmemberAnonymous8:34 4 Apr '02  
GeneralRe: Runs well the first time . . . PinmemberAnonymous12:27 21 Apr '02  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 25 Oct 2001
Article Copyright 2001 by Chong Hin Ooi
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid