PDA

View Full Version : Utilizing Windows 7 style windows and fonts through OGL



baule025
07-14-2012, 01:30 PM
Hello

I recently have been learning about OpenGL and am using it as a graphics library to interface between LPA-WinProLog and Windows/Apple OS. Let me give you a bit of backstory so that you understand my questions a bit more clearly.

I am a 2nd year Game Design student who has primarily used Microsoft Visual Studios to write programs in C# utilizing the XNA development library(which uses the DirectX graphics api...I think). However, for my summer job I am working on my grandfathers architectural program. Now my grandfather is a bit of a maverick when it comes to programming so he has been using WinProLog to write the program and about 10 years ago worked on something that allows ProLog to use OpenGL to handle the applications graphics.

Now the problem, many people who use the program say it looks "old". My understanding is that this is because the OpenGL(and excuse my incorrect use of terminology here) libraries that he incorporated into ProLog, are using an older form of Window GDI. In order to update the look of the interface, dialogues, fonts etc. I am tasked with finding a way to incorporate the newer Windows graphics library, through OpenGl, into the application written in ProLog.

My guess is that libraries that make Windows 7 applications look the way they do, are available in OpenGL or at least in some form of tool-kit like GLFW.

If anyone could clear up how this whole thing works, or could point me in the correct direction as to how OpenGL libraries can make Windows 7 style windows I would greatly appreciate it. I will try to help out as much as I can, but like I said I am really only used to using the Windows development api that is built into languages like C#.

Alfonse Reinheart
07-14-2012, 01:47 PM
What is a "Windows 7 style window?" I use Windows 7, and I don't know what you mean by this.

baule025
07-14-2012, 01:49 PM
I guess what I'm trying to say is what OGL library will allow me to make windows that "look" like an application running on Windows 7.

I.e._A window, button or other interface feature that has similar 2D graphical features (transparency, font style etc) as an application running on Windows 7.

Like I said I don't really have a handle on what I am talking about but I'll give it a shot:

From my understanding, the Windows GDI is the 2D graphics API that handles the creation of windows, fonts, buttons etc. However, OpenGL is the open-source version of GDI, but has calls that windows to be opened depending on the OS being used. However, now Windows 7 uses Direct2D which built atop the old GDI. OpenGl is still an alternative, but there are libraries that can be used to acheive the same visual style in 2D. Is this right?

Alfonse Reinheart
07-14-2012, 03:36 PM
From my understanding

OK, I see where the problem is now. Let's look at each statement in turn.

the Windows GDI is the 2D graphics API that handles the creation of windows, fonts, buttons etc: The Windows Graphics Device Interface (GDI) (http://en.wikipedia.org/wiki/Graphics_Device_Interface) is a system for drawing to a device (which may be a window, or a printer, or other things). That's all it is.

It has nothing to do with the "Look & Feel" of Windows; that's determined by however the Win32 API is implemented on a particular system. The GDI is about low-level drawing calls. Win32 and the various Windows setting determines things like what a button looks like. That's why it can be changed.

OpenGL is the open-source: OpenGL is not open-source. (http://www.opengl.org/wiki/FAQ#Is_OpenGL_Open_Source.3F)

OpenGL is the open-source version of GDI: OpenGL has nothing to do with the GDI or Windows. The creation of an OpenGL context (http://www.opengl.org/wiki/OpenGL_context) on Windows requires using GDI calls (specifically creating a device context and setting a pixel format). But once you have a context, the GDI is irrelevant.

OpenGL has nothing to do with the Windows Look&Feel for various GUI elements. There are no buttons, scroll-bars, etc in OpenGL. You could try to draw buttons that have a particular style, but there's no function that will do it for you.

Windows 7 uses Direct2D: No it doesn't. It has Direct2D, but it doesn't use it explicitly for window drawing. You can choose to use D2D to do drawing in your application, but Win7 doesn't do it behind your back.

You're confusing D2D with the Desktop Window Manager (http://en.wikipedia.org/wiki/Desktop_Window_Manager), which does window composition.

Windows 7 uses Direct2D which built atop the old GDI: D2D is no more built on GDI than OpenGL is.

Now that we're all on the same page here, what's your question?

baule025
07-14-2012, 04:41 PM
Is there a tool-kit or some additional api/library for OpenGL (I've been reading about GLFW and the GLUT-like toolkits) that has calls for fancier button and window creation?

Alfonse Reinheart
07-14-2012, 07:19 PM
You seem to be confusing "window creation" and "widget (buttons, sliders, etc) creation". They're not the same thing (even though Win32 gives them a full HWND). So which are you looking for? The ability to create new full windows, or the ability to create widgets within your OpenGL window? Because if it's the latter, I'd suggest CeGUI.