Click here to Skip to main content
15,617,231 members
Articles / Multimedia / OpenGL
Posted 24 Oct 2001


27 bookmarked

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

Rate me:
Please Sign up or sign in to vote.
5.00/5 (9 votes)
24 Oct 2001
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


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.


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

Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

Questionbackground colour Pin
Member 1205870229-Nov-15 20:02
Member 1205870229-Nov-15 20:02 
GeneralPlease check this article Pin
Sharjith9-Nov-10 12:16
professionalSharjith9-Nov-10 12:16 
GeneralBUG: This code is unsafe without CS_OWNDC Pin
Member 122382917-Nov-09 15:03
Member 122382917-Nov-09 15:03 
Questionbackground color Pin
labs132423-Aug-06 7:16
labs132423-Aug-06 7:16 
GeneralRe: background color Pin
Gita.Bairavi12-Mar-08 20:52
Gita.Bairavi12-Mar-08 20:52 
QuestionHow to run 2 different(or same) OpenGL objects in one DialogBox? Pin
werter13-May-04 21:20
werter13-May-04 21:20 
QuestionHow to make a multi-viewport in OpenGL with MFC? Pin
Member 91399621-Apr-04 1:41
Member 91399621-Apr-04 1:41 
QuestionHowto Draw something in an edit box? Pin
Member 66110025-Oct-03 23:55
Member 66110025-Oct-03 23:55 
Generalmouse events Pin
Anonymous21-Jan-03 10:24
Anonymous21-Jan-03 10:24 
GeneralRe: mouse events Pin
Anonymous8-Jun-03 1:33
Anonymous8-Jun-03 1:33 
GeneralRuns well the first time . . . Pin
4-Apr-02 8:34
suss4-Apr-02 8:34 
GeneralRe: Runs well the first time . . . Pin
21-Apr-02 12:27
suss21-Apr-02 12:27 

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

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