Archived

This topic is now archived and is closed to further replies.

sysmark

OpenGL DX coder trying to use OpenGL...

Recommended Posts

Allright, here''s my problem. When programming Direct3D I always create a class that handles all the system information for me (just as the example apps), like enumerating the display devices, the videomodes, system capabilities, etc. This makes me happy, because I know the program will work on most computers. Allright, now I''m using OpenGL (demo group, but all the others are to dumb to use D3D) (just kidding!). I know GL has to be cross-platform and all, but there has to be a way to find out simple stuff like supported videomodes, or even which render devices are installed (and a way to select them). I mean, it would be nice If I could detect if a videocard can do 8 bits stencil buffering or not... Or maybe even hardware T&L. So does anybody know a way (or documentation explaining it) of how to do any of the above?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Setting up the enviroment is not easy if you want it to work on multiple platforms. I would check out the GLUT sources or better just use the GLUT library.

Most OpenGL programs does not care much about checking the hardware features. You just ask for some features and the system should give you the best, closest enviroment available. The common way with Direct3D is as you wrote to do a lot of enumeration and try to take full advantage of the card. I guess this is because of the different backgrounds. OpenGL comes from a hardware rich enviroment but Direct3D has the opposite background.

I think the OpenGL approach is much more relaxed and fun but if you really wants to worry about the hw can you do it but D3D is probably your kind of API.

Share this post


Link to post
Share on other sites
There''s ways to do that using the Win32 API. Like you said, OpenGL has no platform specific things within itself. There are Windows specific extensions however. I don''t personally know how to do it with the Win32 API, I just know it is technically possible.

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://druidgames.cjb.net/

Share this post


Link to post
Share on other sites
GetSystemMetrics(parameter)

check it out in vC++ docs

there''s a way to check hardware configurations too in OGL I just forget what it is...

-----------------------------------------------------------
"If I wanted to hear the pitter patter of little feet I would put shoes on my cat"

Share this post


Link to post
Share on other sites
There are a number of functions that will prove useful to that end:


EnumDisplaySettings
ChangeDisplaySettings
SetDeviceGammaRamp


Of course, these are all Win32 API functions, so you''ll find them documented in MSDN.

Share this post


Link to post
Share on other sites
That just proves what an idiot I really am, I never even thought about checking the win32 specs.... Thanks loads guys!

Oh and yes, D3D IS my kinda API, but GL is ok too.

Share this post


Link to post
Share on other sites
my personal opinion says that OpenGL is better for begginer and D3D not (my own experience- i''m begginer)

Share this post


Link to post
Share on other sites
I started 3D with directX but recently changed to OpenGL. The reason was that my D3D programs worked well on my macine but it used to crash on others computers. I think OpenGL is very nice, clean. Well, DirectX8 is by far getting near to OpenGL. Initialization can be done by one call, before it ned many numerations.

In WinAPI you can use EnumDisplaySettings,EnumdisplayDevices and changedisplaySettings... or use GLU.

One thing I hated Direct3D was resource invalidating and restoring and surface losts (Is it really to be implemented?).

Share this post


Link to post
Share on other sites
OpenGL may be easy to pick up (NeHe helps a lot), but it sure isn''t for beginners. I wrote a Quake2 model viewer in 2 days using D3D8, but it took me about a week to convert it to OpenGL!!! It''s just that I had a little trouble understanding the logic behind OpenGL. OpenGL just hides to much from me, and the way the matrices are handled is just plain scary. D3D8 in combination with D3DX8 is way better if you ask me, as you have total control over what Direct3D does.

Share this post


Link to post
Share on other sites
How does the way matrices are handled scare you? You can pull it off the way D3D does if you really want to using glLoadMatrixf and your own Matrix class. I personally prefer to use glPopMatrix, glPushMatrix, glTranslate, glRotate, glScale, glMultMatrix, and glLoadIdentity to having to deal with the matrices on my own in more than half of the cases. And, remember than OpenGL is a state machine, which is a little different to what you''re used to (I think state machines are actually really cool ).

Resist Windows XP''s Invasive Production Activation Technology!
http://druidgames.cjb.net/

Share this post


Link to post
Share on other sites
I learned 3D maths, 3D hardware, then Direct3D6 (nobody''s perfect), it was boring and not really nice IMO.
When the 7 was released I''d to change much of my code, I find this even more boring, then thought about OpenGL.

I bought red and blue books, and discovered how well OpenGL fits with the hardware and how logic it is.

In fact OpenGL is far better designed than Direct3D ever was or is (I checked D3D8), it''s more logical (for people having knowledge) and it''s not windows only. [This point is very important now that I know many OS and only use BeOS]

I suspect that most Direct3D coders don''t really know about the hardware, 3d techs and maths, and only rely on ''tutorials'', which make them think they know, while it''s not really the truth.

(Don''t get me wrong, I don''t mean that all D3D coder don''t fully understand what he does.)

The more I know about 3d (I still need to buy and read some books to be at a ''good'' level IMO), the more I feel confortable with OpenGL.

This is a personnal point of view, feel free to disagree, but don''t flame.

-* So many things to do, so little time to spend. *-

Share this post


Link to post
Share on other sites