Hey there. I’m doing a project with OpenGL, and I have a question. I’m rotating a cube, and am using a simple glRotate command to do it. Is there any command to force hardware/software rendering, if the chipset supports it? BTW, I’m using MS VC++ 6.0 Standard
Are you using WIN32 to create a device context and rendering context, or an abstraction layer like glut?
If you are using WIN32, you can force software rendering. Search for posts about it on this board.
If you are using glut, AFAIK, there isn’t a way to force software or choose, 'tween the two.
If you want to find out who’s rendering use this:
vendorInfo.Format(“The GL Renderer is %s”, glGetString(GL_RENDERER));
// use whatever method to display the info
MessageBox(m_hWnd, vendorInfo, “This is who’s rendering”, MB_OK);
Also, check out the other string you can get. Extensions, version and vendor can be attained similarly.
What do I need to include, to do the CString? I’ve been having problems getting it to work, and it’s saying “undeclared identifier”
Yes, it is Win32. I did that little registry hack, and that is exactly what I needed. I’m in no way proficient enough to do the other way I saw, making a ComparePixelFormat class…
LOL, I was happy I even got a cube to rotate! Is there any way to change the registry, from inside VC++ 6.0? If I could just create a simple “Yes, No” box, and ask to enable hardware acceleration… If “yes” then have the registry entry for Opengl point to my ATI Driver. If no, point to OpenGL32.dll. Any ways anyone can think of?
Ok, I found some CRegKey thingy… hehe, I’m very new at this still, guys and gals.
Can someone give me an example of how this regkey editing works? All I want is somethign like this…
if (MessageBox(NULL,“Would You Like To Run In Software Mode?”, “Software Rendering?”,MB_YESNO|MB_ICONQUESTION)==IDYES)
basically, if you hit “Yes” It’ll change the opengl driver to OpenGL32.dll, before rendering. I’ll to go back to my ATI, after the drawing is finished.
AFAIK, including windows.h will give you CString access.
OK… but… . I don’t need CString, do I? I’m wanting to just use the CRegKey class, but well… I’m still not too sure of how to load the class, and use the commands and all. The syntax in the MSDN reference guide is incredibly confusing!
Okay, wait a second. I was replying to the thread without really paying attention to what you are trying to do. Here’s what you need to do:
When the app starts, fire off a message box requesting if the user wants hardware acceleration. If yes, then set up the pixel format descriptor as you normally would; if no, then add PFD_GENERIC_FORMAT to the dwFlags bit (which forces software).
Back up, are you creating your own PFD or using glut/aux or something?
Yeah, I am using one a friend of mine helped me with. I figured out how to get the registry to switch between OpenGL32.dll and my atio9xaa.dll, effectively switching hardware and software rendering modes. But this is kind of a temporary thing, switching between the drivers. I really need to just buy an OpenGL Reference guide, probably the SuperBible, lol! The way I have it will work for now, but later, I need to build one that will switch on any card… This works for now, but thanks guys!
CString is an MFC class. Same with CRegKey. I’m not sure what registry values exactly you are trying to change, but you basically just open a key then set a value. I’ve usually used the API functions for registry stuff, but you can do the same thing with the CRegKey class by doing something like so…
reg.Open(HKEY_CURRENT_USER, // the root you want to work from
“Some\key\value”); // whatever key value you need to change
reg.SetValue(something, valueName); // 3 different overloads for this for different types of values