Click here to Skip to main content
Click here to Skip to main content

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

By , 24 Oct 2001
 

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
No Biography provided

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

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralPlease check this articlememberSharjith9-Nov-10 12:16 
GeneralBUG: This code is unsafe without CS_OWNDCmemberMember 122382917-Nov-09 15:03 
Questionbackground colormemberlabs132423-Aug-06 7:16 
GeneralRe: background colormemberGita.Bairavi12-Mar-08 20:52 
QuestionHow to run 2 different(or same) OpenGL objects in one DialogBox?memberwerter13-May-04 21:20 
QuestionHow to make a multi-viewport in OpenGL with MFC?memberVicher21-Apr-04 1:41 
QuestionHowto Draw something in an edit box?memberszlivkab@freemail.hu25-Oct-03 23:55 
Howto Draw something in an edit box?
 
hEdit=GetDlgItem(hwnd,IDC_DRAW);
hdc = BeginPaint(hEdit, &ps);
SetPixel(hdc,10,10,0);
EndPaint(hEdit, &ps);
that doesn't work

Generalmouse eventssussAnonymous21-Jan-03 10:24 
GeneralRe: mouse eventssussAnonymous8-Jun-03 1:33 
GeneralRuns well the first time . . .memberAnonymous4-Apr-02 8:34 
GeneralRe: Runs well the first time . . .memberAnonymous21-Apr-02 12:27 

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

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