5.010 What's a good source for Win32 OpenGLprogramming information?
- Download Opengl 2.1 Software Windows Software Update
- Download Opengl 2.1 Software Windows Software Latest
Unfortunately both Intel and Microsoft ain't making any new version of the drivers for Windows 10. Everyone is asking for them to do it but all pretty negative. Download opengl 2.1 driver - OpenGL 4.5: A Free Solid Graphics Engine for Everyone to Use. A free Software utilities program for Windows. Chipset is OLD for their standard I guess. Opengl 2.0 download windows 7 - Best answers Opengl download windows 7 32 bit - Best answers Pixel shader 2.0 download windows 7 32 bit - Forum - Hardware. Trusted Windows (PC) download Mali OpenGL ES Emulator 2.2.1. Virus-free and 100% clean download. Get Mali OpenGL ES Emulator alternative downloads.
Samuel Paik has created a large repository of links to OpenGL information on MicrosoftWeb sites.
5.020 I'm looking for a Wintel OpenGL card in aspecific price range, any suggestions?
The consumer-level 3D graphics marketplacemoves fast. Any information placed in this FAQ would be soonoutdated.
You might post a query on this topic to thecomp.graphics.api.opengl newsgroup, or one of the manynewsgroups devoted to Wintel-based 3D games. You might alsodo a Web search.
Tom'sHardware Guide and FastGraphics have a lot of informationon current graphics cards.
5.030 How do I enable and disable hardwarerendering on a Wintel card?
Currently, OpenGL doesn't contain a switchto enable or disable hardware acceleration. Some vendorsmight provide this capability with an environment variable orsoftware switch.
If you install your graphics card, but don'tsee hardware accelerated rendering check for the following:
- Did you install the device driver /OpenGL Installable Client Driver (ICD)? (How do I do that?)
- Is your desktop in a supported colordepth? (Usually 16- and 32-bit color are accelerated.See your device vendor for details.)
- Did your application select anaccelerated pixel format?
You might also have acceleration problemsif you're trying to set up a multimonitor configuration.Hardware accelerated rendering might not be supported on all(or any) devices in this configuration.
To force software rendering from yourapplication, choose a pixel format that is not hardwareaccelerated. To do this, you can not use ChoosePixelFormat(),which always selects a hardware accelerated pixel format whenone is available. Instead, use DescribePixelFormat() toiterate through the list of available pixel formats. Anyformat with the PFD_GENERIC_FORMAT attribute bit setwill not be hardware accelerated.
Ron Fosner has a source code snippetthat shows how to select a software-only pixel format, andhow to select a pixel format based on other weightingcriteria.
An example of iteratingover available pixel formats can be found here.
A less tasteful method to disable hardwareacceleration is to move or rename your OpenGL ICD.
Also, check your device's documentation tosee if your device driver supports disabling hardwareacceleration by a dialog box.
5.040 How do I know my program is using hardwareacceleration on a Wintel card?
OpenGL doesn't provide a direct query todetermine hardware acceleration usage. However, this canusually be inferred by using indirect methods.
If you are using the Win32 interface (asopposed to GLUT), call DescribePixelFormat() and check thereturned dwFlags bitfield. If PFD_GENERIC_ACCELERATED isclear and PFD_GENERIC_FORMAT is set, then the pixel format isonly supported by the generic implementation. Hardwareacceleration is not possible for this format. For hardwareacceleration, you need to choose a different format.
If glGetString(GL_VENDOR) returns somethingother than 'Microsoft Corporation', it means you'reusing the board's ICD. If it returns 'MicrosoftCorporation', this implies you chose a pixel format thatyour device can't accelerate. However, glGetString(GL_VENDOR)also returns this if your device has an MCD instead of an ICD,which means you might still be hardware accelerated in thiscase.
Another way to check for hardwareacceleration is to temporarily remove or rename the ICD, soit can't be loaded. If performance drops, it means you werehardware accelerated before. Don't forget to restore the ICDto its original location or name. (To find your ICD file name,run the regedit utility and search for a key named 'OpenGLdrivers'.)
You can also gather performance data byrendering into the back buffer and comparing the resultsagainst known performance statistics for your device. Thismethod is particularly useful for devices that revert tosoftware rendering for some state combinations or OpenGLfeatures. Seethe section on performance for moreinformation.
5.050 Where can I get the OpenGL ICD for aWintel card?
If your device supports OpenGL, themanufacturer should provide an ICD (commonly referred to asthe device driver) for it. After you install the ICD, yourOpenGL application can use the device's hardware capabilities.
If your device didn't come with an ICD ondisk, you'll need to check the manufacturer's Web page to seewhere you can download the latest drivers. The chipmanufacturer will probably have a more current ICD than theboard manufacturer. Find the device driver download page, getthe latest package for your device, and install it per theinstructions provided.
GLsetup is a free utility. Although the authors website no longer exists, you can still download a copy of the program from MajorGeeks.com.GLSetup is supposed to detect auser's 3D graphics hardware and install the correct devicedrivers.' Windows 2000 device drivers might not besupported. You can still get it from http://www.majorgeeks.com/GLSetup_d383.html.
5.060 I'm using a Wintel card, and an OpenGLfeature doesn't seem to work. What's going on?
It could simply be a bug in your code.However, if the same code works fine on another OpenGLimplementation, this implies the problem is in your graphicsdevice or its ICD. See the previous question forinformation on obtaining the latest ICD for your device.
5.070 Can I use OpenGL with DirectDraw?
Moxing OpenGL rendering calls withrendering calls from other APIs (such as DirectDraw) in thesame window won't work on some drivers, and is thereforeunportable. I don't recommended it.
5.080 Can I use use DirectDraw to change thescreen resolution or desktop pixel depth?
You can create a window and use DirectDrawto change the display resolution and/or pixel depth. Then,get the window's DC and create an OpenGL context from it.This is known to work on some devices.
While we're on the subject, Microsoft doesn'trequire, and consequently does not test for, the ability torender OpenGL into a DirectDraw surface. Just because you canget a surface's DC does not mean that OpenGL rendering issupported. Always check for error returns when creatingcontexts or maiing them current.
5.090 My card supports OpenGL, but I don't getacceleration regardless of which pixel format I use.
Are you in 8bpp? There are few 3Daccelerators for PCs that support acceleration in 8bpp.
5.100 How do I get hardware acceleration?
The pixel format selects hardwareacceleration. Pay attention to the flags GENERIC_FORMATand GENERIC_ACCELERATED. You want both of them on if you'reusing a 3D-DDI or an MCD and neither on if you are using anICD. You may have to iterate using DescribePixelFormat()instead of only using ChoosePixelFormat().
5.110 Why doesn't OpenGL hardware accelerationwork with multiple monitors?
Download Opengl 2.1 Software Windows Software Update
In Windows 98, Microsoft decided to disableOpenGL hardware acceleration when multiple monitors areenabled. In Windows NT 4.0, some drivers supportmultiple monitors when using identical (or nearly identical)cards. I don't believe multiple monitors and hardwareaccelerated OpenGL work with different types of cards. I don't know the story with Windows 2000, but it's likely tobe similar to Windows NT 4.0.
5.120 Why does my MFC window flash, even thoughI'm using double buffering?
Your view class should have an OnEraseBkgnd()event handler. You can eliminate flashing by overriding thisfunction and returning TRUE. This tells Windows that you'vecleared the window. Of course, you didn't really clear thewindow. However, overriding the function keeps Microsoft fromtrying to do it for you, and should prevent flashing.
5.121 Why does my doublebuffered window appear incomplete or contain black stripes?
This is a problem with MS OpenGL. The bug is in thegeneric code, or possibly in MS Windows itself, because itoccurs even with pure software rendering.
Microsoft's product support page contains information onthis issue: ClippingProblems with Generic Implementation of OpenGL for Windows2000
To work around the bug, try one of these two methods:
- Create the OpenGL drawing window, but don't make itvisible immediately. Get the screen size andset the window's size to be the same as the screen. Now set the pixel format and create the HGLRC. Set the window's size back to whatever it should beand make the window visible. This hack is invisibleto the user, but doesn't always work.
- When the window is resized larger, destroy and re-createthe window. This is really ugly and visible tothe user, but it seems to always work.
5.130 What's the differencebetween opengl.dll and opengl32.dll?
According to OpenGL Reference Manualeditor Dave Shreiner:
'Unless there's an absolutelycompelling reason ... I really would suggest using opengl32.dll,and letting the old opengl.dll thing die.
'opengl.dll comes from the nowtotally unsupported OpenGL for Windows release of OpenGLfor Microsoft Windows by SGI. We stopped supportingthat release over two years -- like no one ever touchesthe code. ...
'Now, why use opengl32.dll? For the most part, SGI provides Microsoft with the ICDkit, sample drivers, and software OpenGL implementationthat you find there. Its really the same code base(with fixes and new features) as the opengl.dll, its onlythat we got Microsoft to ship and support it (in a mannerof speaking).'
More information onlinking with opengl.dll can be found here.
5.140 Should I use Direct3D orOpenGL?
A good comparison of the two can be found here.
5.150 What do I need to know touse OpenGL with MFC?
You need to be familiar with both OpenGL and the MicrosoftFoundation Class (MFC). An online MFC reference is available,the MFC FAQ. Youdon't need to be an MFC guru to add OpenGL to an MFCapplication. Familiarity with C++ can make mastering MFCeasier, and the more you know about MFC, the more you canconcentrate on your OpenGL code. If you have only arudimentary knowledge of MFC, look at the downloadablesource code example below, and look at the stepsnecessary to recreate it.
Joel Parris'OpenGL/MFC web site contains lots of useful information.
Samuel Paik's repository of links toOpenGL information on Microsoft Web sites also hasinformation on using OpenGL and MFC.
Here's a list of books that might be helpful.
OpenGL Programming for Windows 95 and Windows NT,by Ron Fosner. This is also known as the white book. Itcontains good information on using OpenGL in MicrosoftWindows. Much of the information in it can be found onthe MSDN Web site, but the book presents the informationin a more logical and easily digestable format, and comeswith good demos.
Opengl Superbible: The Complete Guide to OpenglProgramming for Windows NT and Windows 95, byRichard S. Wright and Michael Sweet. This book contains achapter on OpenGL and MFC.
MFC Programming with Visual C++ 6 Unleashed,by David White, et al. The book contains a short chapteron OpenGL and focuses more on DirectX.
5.160 How can I use OpenGL withMFC?
To add OpenGL to an MFC application, you need to do atleast the following:
- Add glu32.lib opengl32.lib to the list of object/librarymodules to link with.
- When your View class's OnInitialUpdate() function iscalled, set the pixel format and create a renderingcontext as you would for a Win32 application.
- Render your OpenGL scene when the View needs to beupdated, or add a Run message handler to yourApplication class that updates when idle.
You can render OpenGL into any CWnd object, includingframe windows, dialog boxes, and controls.
Downloadthis example, which demonstrates OpenGL in a CStatic formcontrol. This code uses a CGlView class that takes anyCWnd as a parameter to its constructor. Rather than create aView derived from a CFormView, you could just as easilycreate an SDI application, and pass 'this' (aninstantiation of a CView) as a parameter to the constructor.Follow these steps to recreate this sample code usingMicrosoft Visual C++ v6.0:
- If you haven't done so already, download the example.You'll need to borrow code from it in the steps thatfollow.
- Create an MFC application using the AppWizard. Usedefaults, except derive your View class from aCFormView. The project will open in the resourceeditor. Add a FORM control to the open CFormView.Call it IDC_OPENGLWIN.
- Select Project->Settings...->Link, and add glu32.libopengl32.lib to the list of objects/library modules.
- Select Project->Add To Peoject->Files... andadd the CGlView.cpp OpenGL view class source filefrom the above example code.
- From the class view, right click your application'sView class and select Add Member Variable... Set thevariable type to CGlView *, the name to m_pclGLView,and the access to Private.
- In your application's View class header file, add #include'CGlView.h' just before the classdefinition.
- Find the global declaration of 'theApp'.Immediately after this declaration, add two newglobal variables:
CGlView *g_pclGLView = NULL;MSG msg;
- In the wizard bar, set the application's View class,set the filter to All Class Members, and select theOnInitialUpdate member function.
- For the CGlView class to work, it needs a CWnd toinitialize OpenGL for that window. For this example, our CWnd is the CStatic FORM control we added in step1. After the existing code in this function, add thefollowing:
CStatic pclStatic = (CStatic *)GetDlgItem(IDC_OPENGLWIN);m_pclGLView = new CGlView(pclStatic);
- Open the class wizard with View->ClassWizard. Fromthe message map tab, select your project'sApplication class. Add a function handler for the Runmessage. Replace the generated code with the Runmessage handler from the downloaded example.
5.170 Is OpenGL inherentlyslower when used with MFC?
Nothing in MFC guarantees a slow-running OpenGLapplication. However, some poorly written MFC applicationsmight run slowly. This is a possibility in any developmentenvironment and is not specific to OpenGL. Here are somethings to look out for:
- Build the application as Release instead of Debug.Disable the TRACE debugging feature.
- Avoid MFC classes such as CArray, CMap, and CListthat perform inefficient data copies.
- You may be able to improve performance by avoidingthe WM_PAINT message. See thequestion above for example source that does this.
- MFC classes are general purpose. For maximumperformance, write a tuned implementation of an MFCclass.
- Use standard efficient programming techniques such asavoiding redundant calls, etc.
5.180 Where can I find MFCexamples?
This FAQ contains an example.
Alan Oursland, Using OpenGL in Visual C++ Version 4.x,DevCentral Learning Center, http://devcentral.iftech.com/learning/tutorials/mfc-win32/opengl/.This is good but dated. It will get you started with aSDI MFC OpenGL application.
Download Opengl 2.1 Software Windows Software Latest
Opengl Superbible: The Complete Guide to OpenglProgramming for Windows NT and Windows 95, byRichard S. Wright and Michael Sweet. This book contains achapter on OpenGL and MFC.
MFC Programming with Visual C++ 6 Unleashed,by David White, et al. The book contains a short chapteron OpenGL and focuses more on DirectX.
5.160 How can I use OpenGL withMFC?
To add OpenGL to an MFC application, you need to do atleast the following:
- Add glu32.lib opengl32.lib to the list of object/librarymodules to link with.
- When your View class's OnInitialUpdate() function iscalled, set the pixel format and create a renderingcontext as you would for a Win32 application.
- Render your OpenGL scene when the View needs to beupdated, or add a Run message handler to yourApplication class that updates when idle.
You can render OpenGL into any CWnd object, includingframe windows, dialog boxes, and controls.
Downloadthis example, which demonstrates OpenGL in a CStatic formcontrol. This code uses a CGlView class that takes anyCWnd as a parameter to its constructor. Rather than create aView derived from a CFormView, you could just as easilycreate an SDI application, and pass 'this' (aninstantiation of a CView) as a parameter to the constructor.Follow these steps to recreate this sample code usingMicrosoft Visual C++ v6.0:
- If you haven't done so already, download the example.You'll need to borrow code from it in the steps thatfollow.
- Create an MFC application using the AppWizard. Usedefaults, except derive your View class from aCFormView. The project will open in the resourceeditor. Add a FORM control to the open CFormView.Call it IDC_OPENGLWIN.
- Select Project->Settings...->Link, and add glu32.libopengl32.lib to the list of objects/library modules.
- Select Project->Add To Peoject->Files... andadd the CGlView.cpp OpenGL view class source filefrom the above example code.
- From the class view, right click your application'sView class and select Add Member Variable... Set thevariable type to CGlView *, the name to m_pclGLView,and the access to Private.
- In your application's View class header file, add #include'CGlView.h' just before the classdefinition.
- Find the global declaration of 'theApp'.Immediately after this declaration, add two newglobal variables:
CGlView *g_pclGLView = NULL;MSG msg;
- In the wizard bar, set the application's View class,set the filter to All Class Members, and select theOnInitialUpdate member function.
- For the CGlView class to work, it needs a CWnd toinitialize OpenGL for that window. For this example, our CWnd is the CStatic FORM control we added in step1. After the existing code in this function, add thefollowing:
CStatic pclStatic = (CStatic *)GetDlgItem(IDC_OPENGLWIN);m_pclGLView = new CGlView(pclStatic);
- Open the class wizard with View->ClassWizard. Fromthe message map tab, select your project'sApplication class. Add a function handler for the Runmessage. Replace the generated code with the Runmessage handler from the downloaded example.
5.170 Is OpenGL inherentlyslower when used with MFC?
Nothing in MFC guarantees a slow-running OpenGLapplication. However, some poorly written MFC applicationsmight run slowly. This is a possibility in any developmentenvironment and is not specific to OpenGL. Here are somethings to look out for:
- Build the application as Release instead of Debug.Disable the TRACE debugging feature.
- Avoid MFC classes such as CArray, CMap, and CListthat perform inefficient data copies.
- You may be able to improve performance by avoidingthe WM_PAINT message. See thequestion above for example source that does this.
- MFC classes are general purpose. For maximumperformance, write a tuned implementation of an MFCclass.
- Use standard efficient programming techniques such asavoiding redundant calls, etc.
5.180 Where can I find MFCexamples?
This FAQ contains an example.
Alan Oursland, Using OpenGL in Visual C++ Version 4.x,DevCentral Learning Center, http://devcentral.iftech.com/learning/tutorials/mfc-win32/opengl/.This is good but dated. It will get you started with aSDI MFC OpenGL application.
Download Opengl 2.1 Software Windows Software Latest
Mahesh Venkitachalam, OpenGL Code, http://home.att.net/~bighesh/ogl.html.Mahesh presents OpenGL in a no application wizard, minimalMFC program along with some OpenGL techniques.
Roman Podobedov, Skeleton of OpenGL program for Windows (MFC).http://madli.ut.ee/~romka/opengl/demos/win32_eng.htm.This is a minimal MFC program with no controls or applicationwizard.
Paul Martz, Generating Random Fractal Terrain. http://www.gameprogrammer.com/fractal.html. Thisis a good example of the MFC SDI approach. However, theprimary focus of the example is terrain, to which OpenGL andMFC take a back seat.
[5] Pierre Alliez, Starting OpenGL in a Dialog. http://codeguru.earthweb.com/opengl/texture_mapping.shtml.
Pierre Alliez, Starting Rendering Modes. http://www.codeguru.com/opengl/start.shtml.This is a splitter window example.
Pierre Alliez, How to snap an OpenGL client and send it tothe clipboard, http://codeguru.earthweb.com/opengl/snap.shtml.
Pierre Alliez, A small VRML viewer using OpenGL and MFC. http://www.codeproject.com/opengl/wrl_viewer.asp.
Uwe Kotyczka, OpenGLSample.zip, http://www.virtue.nu/kotyczka/opengl_en.html.This rather large and impressive MFC contributiondemonstrates, multiple OpenGL views, rubber banding, colorramp, mouse trackball type control, OpenGL printing, etc., ina MFC MDI and SDI framework. This was built with VC++ 6.0(SP4) .
5.190 What do I need to knowabout mixing WGL and GDI calls?
On the Win32 platform a number of platform specificfunction calls are duplicated in the OpenGL ICD mechanism andthe GDI. This may cause confusion as they appear to befunctionally identical, the only difference being whether wglprecedes the rest of the function name. To ensure correctoperation of OpenGL use ChoosePixelformat,DescribePixelformat, GetPixelformat, SetPixelformat, andSwapBuffers, instead of the wgl equivalents, wglChoosePixelformat, wglDescribePixelformat,wglGetPixelformat, wglSetPixelformat, and wglSwapBuffers. Inall other cases use the wgl function where available. Usingthe five wgl functions is only of interest to developers run-timelinking to an OpenGL driver. Not using the functions asdescribed may result in a black OpenGL window, or a correctlyfunctioning application in Windows 9x that produces a blackOpenGL window on Windows NT/2000.
5.200 Why does my code produce a black screen underWindows NT or 2000 but run fine under 9x?
Incorrect mixing of GDI and wgl functions may result inOpenGL functioning correctly under Windows 95 and notfunctioning correctly under Windows NT/2000. Incorrectfunctioning will result in a black OpenGL window underWindows NT/2000.
5.210 How do I properly use WGL functions?
As described in section 5.190, ChoosePixelformat,DescribePixelformat, GetPixelformat, SetPixelformat, andSwapBuffers, are used when going through the OpenGL ICDmechanism. wglChoosePixelformat, wglDescribePixelformat,wglGetPixelformat, wglSetPixelformat, and wglSwapBuffers, areused when run-time linking to the OpenGL driver. The wglfunctions specific to outline and bitmap fonts requirespecial attention only by developers linking directly to theOpenGL driver. All other developers should usewglUseFontBitmaps and wglUseFontOutlines as per Microsoftplatform documentation. wglUseFontBitmaps andwglUseFontOutlines come in two flavours, depending on whethera unicode or non-unicode platform is being targeted.When run-time linking use wglUseFontBitmapsW andwglUseFontOutlinesW for unicode platforms. wglUseFontBitmapsAand wglUseFontOutlinesA for non-unicode platforms. All otherwgl functions may be used freely as per Microsoft platformdocumentation.
Charles E. Hardwidge has tutorial articles andexamples for download that address these issues. The ideais to use WGL, GDI, and OpenGL functions such that theMicrosoft OpenGL ICD mechanism isn't assumed.