• ### Announcements

#### Archived

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

# 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 on other sites
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 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

http://druidgames.cjb.net/

##### 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 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 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 on other sites
my personal opinion says that OpenGL is better for begginer and D3D not (my own experience- i''m begginer)

##### Share on other sites
I have to strongly agree with kren (I am a beginner too).

##### 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 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 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 ).

http://druidgames.cjb.net/

##### 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. *-

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627682
• Total Posts
2978614
• ### Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 13
• 12
• 10
• 12
• 22