Archived

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

Diego

OpenGL OpenGL or DirectX

Recommended Posts

NuFAN    122
Hi,
if you want to start easily use OpenGL. It's really easy, but you don't have all the possibilities you can do using Direct3D IM.

Some coders prefer OpenGL, some D3D. Both are really good API's. I learned D3D because I wanted to use DirectSound and DirectDraw in my actual project, too. And that's an advantage, the architecture of all Direct-API's nearly the same, so stepping from one to another is not that hard.

You can get good results with both API's, have a look at Half-Life or Quake 3, both using OpenGL, HL looks even better in OGL in my opinion.

CU

------------------
Skullpture Entertainment
#40842461

Share this post


Link to post
Share on other sites
Cryogen    122
Oh oh, this is one of them dangerous questions to ask, as it regularly spawns flamewars in the newsgroups.

To answer your questions though:
-OpenGL can do 2D graphics, just use an Ortho projection and the various 2D graphic calls. However if you are planning on doing a 2D game you're probably better off using DirectDraw. Using OGL without a 3D accelerator can be a bit slow (although workable - witness my Azteroidz game) unless you are VERY carefull.

-DirectInput and DirectSound etc are all independant from Direct3D, you will probably end up using these regardless of whether you you use OGL or D3d.

-One big advantage of OGL is cross-platform support. Note that due to Slllllooooooooowwwwwww driver updates cross-platform bizarrely includes NT4 support. (which only supports DX3, and no D3d)

-OpenGL definately is easier to work with and is more intuitive (IMHO), but driver support isnt quite as good as for D3d (although not far behind anymore)

l8r
Ryan

Share this post


Link to post
Share on other sites
ScruffyTheCat    122
If you want to do 2d bitmapped graphics (think tile based engine) I would say definitely learn DirectX. OpenGL is easier to do 3d stuff in but the driver support is lacking. Learn both you'll be more marketable as a programmer.

Share this post


Link to post
Share on other sites
WizardUSMC    122
But what about Direct3DRM? Isn't that supposed to be Microsoft's answer to "easy" 3D?

I've started a D3D project and it is going VERY slowly, but that's all the books seem to be for.

Share this post


Link to post
Share on other sites
prauppl    122

Direct3D RM is going to be dead (tell me if itsn't already). Retained Mode is for designing apps where speed is not the issue. For games, it definitely wouldn't suffice.

And, OpenGL needs a bit of getting used to--because its state machine is *so* good, and complex. Direct3D takes a LOT of code to just setup things. But, DX 6.1 SDK comes with D3D Frame work, which simplifies a *lot*. All you need to do is add few app-functions, and start drawing triangles...

- prauppl

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
I would like to know if I should use OpenGL or DirectX to get VoodooII performance on my 3D game. If I can do that with OpenGL, how would I do it?

Thanks,

Share this post


Link to post
Share on other sites
prauppl    122

Well, if you use OpenGL with Voodoos, then you won't get the full performance out of it. There is no OpenGL ICD yet for Voodoos. There is a 3Dfx Mini-GL Driver for Quake2 that you can use... it doesn't support all the features--just what you see in Quake2.

I never tried this Mini-GL driver. But, you normally link w/ OpenGL32.lib, Glu32.lib, Glut32.lib (these two are optional). And, you include GL.H along with optinal files (glut.h, etc.)

- prauppl

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Thanks prauppl,
However, I was looking for a temporary solution to my low fps rate. I just want to accelerate my graphics for a first-person 3D shooter - another one of those - and right now with simple graphs the fps is too low for a large screen.
Is it possible to accelerate my graphs using Voodoo2 or should I switch to DirectX ?

Thanks,

Share this post


Link to post
Share on other sites
mutex    1111
I've never used OpenGL, but am using D3D. IMHO, D3D takes tons of code to setup, but after that it's pretty straight forward and easy. I have written some classes that do the initialization for you, makes it a lot easier. They're part of an opensource game engine: http://members.xoom.com/mutex0/defy

Share this post


Link to post
Share on other sites
Diego    122
I'm a amateur programmer learning to use VC++6. I'm focused mainly on doing fullscreen graphics for games. Should I be using DirectX or OpenGL? I've already got the DirectX6.1 SDK, but have recently been told that OpenGL is easier. Can OpenGL do 2D graphics, or is it 3D only? If OpenGL is better, how do I develop for it? Should I use GLUT or something else? Help is appreciated.

------------------

Added on 9/5: Wow, I really opened a can of worms here. If any one cares, I'm starting with DirectDraw instead of OpenGL for 2D, and it's going well. Also, I have something to say on the topic of 3D stuff. I've been gamer much longer than I've been a game designer, and I have a voodoo2 card. For the most part, the ONLY way to get full performance out of a voodoo2 is to use glide. 3Dfx still think they own the accelerator market and insist on using their own API, from what I hear. But all you developers that are far more advanced then me should keep in mind that voodoo based cards are not the only ones out there anymore, and I think that refusing to use glide is the only way to help 3Dfx wake up and smell the polygons.

[This message has been edited by Diego (edited September 05, 1999).]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
If you are going to make a game in home, neither Direct3DIM nor OpenGl are good choices. These API requires huge time to make a 3d engine. For example, both are low level API, so no animation import capability ready to use. You may NEVER finish making a 3d game from Direct3DIM/GL.

If you want to finish making 3d game, your reasonable choices will be

a: use free or commercial game engine

b: use Retained mode to make an engine, and port it to fahrenheit (DirectX 8) later for speed enhancement

(Retained mode uses the same 3d draw method as IM, so it is not slow until T&L becomes popular.)

Share this post


Link to post
Share on other sites

  • Similar Content

    • By Kjell Andersson
      I'm trying to get some legacy OpenGL code to run with a shader pipeline,
      The legacy code uses glVertexPointer(), glColorPointer(), glNormalPointer() and glTexCoordPointer() to supply the vertex information.
      I know that it should be using setVertexAttribPointer() etc to clearly define the layout but that is not an option right now since the legacy code can't be modified to that extent.
      I've got a version 330 vertex shader to somewhat work:
      #version 330 uniform mat4 osg_ModelViewProjectionMatrix; uniform mat4 osg_ModelViewMatrix; layout(location = 0) in vec4 Vertex; layout(location = 2) in vec4 Normal; // Velocity layout(location = 3) in vec3 TexCoord; // TODO: is this the right layout location? out VertexData { vec4 color; vec3 velocity; float size; } VertexOut; void main(void) { vec4 p0 = Vertex; vec4 p1 = Vertex + vec4(Normal.x, Normal.y, Normal.z, 0.0f); vec3 velocity = (osg_ModelViewProjectionMatrix * p1 - osg_ModelViewProjectionMatrix * p0).xyz; VertexOut.velocity = velocity; VertexOut.size = TexCoord.y; gl_Position = osg_ModelViewMatrix * Vertex; } What works is the Vertex and Normal information that the legacy C++ OpenGL code seem to provide in layout location 0 and 2. This is fine.
      What I'm not getting to work is the TexCoord information that is supplied by a glTexCoordPointer() call in C++.
      Question:
      What layout location is the old standard pipeline using for glTexCoordPointer()? Or is this undefined?
       
      Side note: I'm trying to get an OpenSceneGraph 3.4.0 particle system to use custom vertex, geometry and fragment shaders for rendering the particles.
    • By markshaw001
      Hi i am new to this forum  i wanted to ask for help from all of you i want to generate real time terrain using a 32 bit heightmap i am good at c++ and have started learning Opengl as i am very interested in making landscapes in opengl i have looked around the internet for help about this topic but i am not getting the hang of the concepts and what they are doing can some here suggests me some good resources for making terrain engine please for example like tutorials,books etc so that i can understand the whole concept of terrain generation.
       
    • By KarimIO
      Hey guys. I'm trying to get my application to work on my Nvidia GTX 970 desktop. It currently works on my Intel HD 3000 laptop, but on the desktop, every bind textures specifically from framebuffers, I get half a second of lag. This is done 4 times as I have three RGBA textures and one depth 32F buffer. I tried to use debugging software for the first time - RenderDoc only shows SwapBuffers() and no OGL calls, while Nvidia Nsight crashes upon execution, so neither are helpful. Without binding it runs regularly. This does not happen with non-framebuffer binds.
      GLFramebuffer::GLFramebuffer(FramebufferCreateInfo createInfo) { glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); textures = new GLuint[createInfo.numColorTargets]; glGenTextures(createInfo.numColorTargets, textures); GLenum *DrawBuffers = new GLenum[createInfo.numColorTargets]; for (uint32_t i = 0; i < createInfo.numColorTargets; i++) { glBindTexture(GL_TEXTURE_2D, textures[i]); GLint internalFormat; GLenum format; TranslateFormats(createInfo.colorFormats[i], format, internalFormat); // returns GL_RGBA and GL_RGBA glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, createInfo.width, createInfo.height, 0, format, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); DrawBuffers[i] = GL_COLOR_ATTACHMENT0 + i; glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, textures[i], 0); } if (createInfo.depthFormat != FORMAT_DEPTH_NONE) { GLenum depthFormat; switch (createInfo.depthFormat) { case FORMAT_DEPTH_16: depthFormat = GL_DEPTH_COMPONENT16; break; case FORMAT_DEPTH_24: depthFormat = GL_DEPTH_COMPONENT24; break; case FORMAT_DEPTH_32: depthFormat = GL_DEPTH_COMPONENT32; break; case FORMAT_DEPTH_24_STENCIL_8: depthFormat = GL_DEPTH24_STENCIL8; break; case FORMAT_DEPTH_32_STENCIL_8: depthFormat = GL_DEPTH32F_STENCIL8; break; } glGenTextures(1, &depthrenderbuffer); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); glTexImage2D(GL_TEXTURE_2D, 0, depthFormat, createInfo.width, createInfo.height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthrenderbuffer, 0); } if (createInfo.numColorTargets > 0) glDrawBuffers(createInfo.numColorTargets, DrawBuffers); else glDrawBuffer(GL_NONE); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) std::cout << "Framebuffer Incomplete\n"; glBindFramebuffer(GL_FRAMEBUFFER, 0); width = createInfo.width; height = createInfo.height; } // ... // FBO Creation FramebufferCreateInfo gbufferCI; gbufferCI.colorFormats = gbufferCFs.data(); gbufferCI.depthFormat = FORMAT_DEPTH_32; gbufferCI.numColorTargets = gbufferCFs.size(); gbufferCI.width = engine.settings.resolutionX; gbufferCI.height = engine.settings.resolutionY; gbufferCI.renderPass = nullptr; gbuffer = graphicsWrapper->CreateFramebuffer(gbufferCI); // Bind glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); // Draw here... // Bind to textures glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textures[0]); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, textures[1]); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, textures[2]); glActiveTexture(GL_TEXTURE3); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); Here is an extract of my code. I can't think of anything else to include. I've really been butting my head into a wall trying to think of a reason but I can think of none and all my research yields nothing. Thanks in advance!
    • By Adrianensis
      Hi everyone, I've shared my 2D Game Engine source code. It's the result of 4 years working on it (and I still continue improving features ) and I want to share with the community. You can see some videos on youtube and some demo gifs on my twitter account.
      This Engine has been developed as End-of-Degree Project and it is coded in Javascript, WebGL and GLSL. The engine is written from scratch.
      This is not a professional engine but it's for learning purposes, so anyone can review the code an learn basis about graphics, physics or game engine architecture. Source code on this GitHub repository.
      I'm available for a good conversation about Game Engine / Graphics Programming
    • By C0dR
      I would like to introduce the first version of my physically based camera rendering library, written in C++, called PhysiCam.
      Physicam is an open source OpenGL C++ library, which provides physically based camera rendering and parameters. It is based on OpenGL and designed to be used as either static library or dynamic library and can be integrated in existing applications.
       
      The following features are implemented:
      Physically based sensor and focal length calculation Autoexposure Manual exposure Lense distortion Bloom (influenced by ISO, Shutter Speed, Sensor type etc.) Bokeh (influenced by Aperture, Sensor type and focal length) Tonemapping  
      You can find the repository at https://github.com/0x2A/physicam
       
      I would be happy about feedback, suggestions or contributions.

  • Popular Now