View Full Version : How to include a OpenGL graphics area into a "standard MS Windows windows"
06-13-2005, 10:25 AM
I use the following commands to create a OpenGL graphics window (implemented into C++ / Borland C++ Builder):
Works great, but actually I do not want a separate windows.
Do you know, how this can be done :
I want to create a normal console (I call it windows windows *g*) and want part of it to be the active OpenGL area. You get the clue what I mean, my English is limited.
I would appreciate your help a lot!!
06-13-2005, 10:31 AM
i am working in a very similar thing... and i found a very good (and free) component for c++ builder:
With this, you just have to insert the Object in the Form, and start working ;)
PD: do you speak spanish?
06-13-2005, 09:49 PM
If by console window you mean command window then I do not think you will get what you want without significant code writing.
However, if what you want is to have something like the screensaver preview box under the control panel, then it's quite doable. Remember that just about any discrete rectangular (or even nonrectangular these days) portion of the screen (and some invisible) in actually a window to Windows. Many of these windows, if you can get a copy of their window handles (HWNDs) you can go through your normal OGL startup routine and see if it works. The problem is changing the settings of the HWND and getting device contexts to play nicely since in this case you are insistently fooling with someone else's (in terms of processes) property.
However if you create an application, and define a rectangular region of your client area as a plain flat, detailless window, you should be able to get a handle of its device context, and then create a rendering context to do your OGL work.
I did this once in Visual BASIC as a "I wonder if" project and used a VB Picture Box as my base window; oddly it would only work if I did things in a certain order, but oh well.
06-14-2005, 03:44 AM
You don't do this with a console. A console window is 'special' it's a shell, a program in itself and you cannot alter it. What you're asking to be able to do is alter the windows graphics output of a running program, don't even go there.
However in Windows you don't or need a shell to run programs, and you are asking for the wrong thing. What you really want is to know how to write a normal windows program that doesn't launch a shell.
Edit: I had suggested that using WinMain instead of main will stop the creation of a console (this has been my experience from old memory), but maybe you can do this via a project setting I'm unsure and I don't want to give faulty advice. I usually roll my own apps and don't use GLUT, and main never gets a lookin on anything I write for Windows. Anyhoo, WinMain is my final answer :-).
So try the WinMain route (You may want to dispense with args to glut init but who cares, none of it's business and very X-like philosophy IMHO, just make sure you send in valid pointers and an arg count of 1, "the program name").
What does this thing do? I don`t want to install it, right now. Is it a own programm, or is it something I can include into my cpde?
What I want, is something like in the screenshot of Carlos link. I create a environment, and part of that environment is a graphics area, where I can use all OpenGL commands on it.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.