2022 Developer Survey is open! Take survey.

Hot answers tagged

78 votes

Why do tutorials use different approaches to OpenGL rendering?

OpenGL has four different major versions, not counting the versions for mobile devices and embedded systems (OpenGL|ES) and the Web via JavaScript (WebGL). Just like Direct3D 11 has a different way of ...
user avatar
59 votes
Accepted

Why are all OpenGL function calls prefixed with "q" in the Doom 3 source code?

For reference - Doom3's qgl.h. OpenGL is an odd little API. You must often work with function pointers either because the standard implementation is missing new functionality or because you want to ...
user avatar
54 votes
Accepted

Optimization of rendering of cube world

No high-performance voxel renderer draws individual cubes or cube faces. To get good performance, groups of voxels are assembled together into a single mesh, called a "Chunk". A chunk is typically ...
user avatar
  • 113k
45 votes
Accepted

Camera vs Viewport

Camera is like a camera with which Batman movie is filmed. It exists in a virtual world and can be moved around, targeting different scenes, changing focal length and other camera properties. You can ...
user avatar
  • 10k
41 votes
Accepted

What advantage do OpenGL, SFML and SDL have over software rendering?

It's not just about speed of execution, but also about simplicity. Although the software rendering used in this example would be a lot slower than using hardware acceleration (i.e. a GPU), drawing a ...
user avatar
36 votes
Accepted

Phong lighting - there is something very strange with specular lighting

specular lighting of directional light more area has specular lighting when camera is far from an object Yep, looks right to me. The specular area for directional lights is supposed to be more or ...
user avatar
  • 14.5k
34 votes
Accepted

Why do we use 4x4 matrices to transform things in 3D?

Yes, you can add a vector in the case of translation. The reason to use a matrix boils down to having a uniform way to handle different combined transformations. For example, rotation is usually done ...
user avatar
  • 12.5k
29 votes
Accepted

Why is an engine like Unity3D emphasized over a native library like OpenGL for beginners?

I think you've answered this question yourself already. You said "I'm just a beginner in 3D games". Further you said "... Unity3D and using it's built in features and tools, which I would have to code ...
user avatar
  • 72.7k
29 votes
Accepted

Can I sell a game made with OpenGL?

Yes, you can sell OpenGL-rendered games. The specifics depend on the library you're using. I'll get back to that. First: OpenGL is an open standard and related API-set that establishes the protocol ...
user avatar
27 votes

Why is an engine like Unity3D emphasized over a native library like OpenGL for beginners?

Because beginners, by definition, don't know what they're doing. OpenGL has a huge learning curve. Sure, you can issue a few glBegin commands, get all excited about putting some triangles on the ...
user avatar
25 votes

What is Vulkan and how does it differ from OpenGL?

To elaborate on OpenGL's future: OpenGL might achieve comparable performance to Vulkan, in draw calls per second, but also regarding general driver overhead: The most recent OpenGL extensions ...
user avatar
  • 404
25 votes

What advantage do OpenGL, SFML and SDL have over software rendering?

My question is: why even bother using something like open gl, sfml, sdl when all you have to do is simply allocate some buffer, pass a bitmap and draw it to the screen? Short: Because its fast (...
user avatar
  • 1,840
23 votes
Accepted

What is the advantage of OpenGL's direct state access mechanism?

From the looks of it now each glSet has to include glBind(something) inside of it Not exactly. It's the other way around, as described several paragraphs below. Even if it were true, remember that ...
user avatar
23 votes
Accepted

What state is stored in an OpenGL Vertex Array Object (VAO) and how do I use the VAO correctly?

VAO stores data about vertex attribute locations. (And some other data related to them.) ...
user avatar
  • 1,875
23 votes
Accepted

Does multiple downsampling have a benefit?

There are two main benefits: First, if you downsample by more than a factor of two, some pixels in the original image will have no impact on the result image. Using ...
user avatar
22 votes

Why would you use software rendering over hardware rendering, today?

There are some really good answers here, so just to supplement them. A major driving force behind software rendering is capability. This was touched on in one of the answers, but I'm going to make ...
user avatar
21 votes

Why is an engine like Unity3D emphasized over a native library like OpenGL for beginners?

It really depends on what you want to get out of this project. If your main goal is to focus on game design, then you're probably better off with a pre-built engine, because that will get you to the ...
user avatar
  • 335
21 votes

Difference in glDrawArrays and glDrawElements

Each glDraw* is a draw call. 1 glDrawArrays is 1 draw call. 1 glDrawElements is 1 draw call. It doesn't matter (so far as draw call count is concerned) how many vertices or indices you use, 1 glDraw*...
user avatar
21 votes
Accepted

How do I know if memory isn't being handled right?

Virtual memory is allocated from the OS in large chunks, when even a byte is left still in use in that large chunk it cannot be released back to the OS. Allocation libraries in user-space also keep a ...
user avatar
20 votes
Accepted

What is GLEW and how does it work?

Most compilers give you an OpenGL header that provides support for OpenGL 1.1, but most of the functions provided in that version of OpenGL have been long since deprecated, and lacks important ...
user avatar
  • 1,351
20 votes
Accepted

What are screen space derivatives and when would I use them?

First, it helps to know that GPUs always evaluate fragment/pixel shaders on 2x2 blocks of pixels at a time. (Even if only some of those pixels ultimately need to be drawn, while others are outside the ...
user avatar
  • 113k
19 votes
Accepted

Is it a good option to simultaneously work on a game and a game engine?

Consider using a framework, like MonoGame. It is a kind of a middle ground between "nothing" and a full-blown engine like Unity or Unreal. It saves you from the really finicky implementation details ...
user avatar
18 votes

What is the purpose of glScissor?

I like this kind of things explained visually. In OnpenGL we have 2D coordinates that go from -1 to +1 for both the X and Y axis. Then this image needs to be mapped to window coordinates. Let's ...
user avatar
  • 401
18 votes
Accepted

How can I use the graphics pipeline to render volumetric data based on a density function?

You can absolutely use the GPU to render volumetric data. Since you want to evaluate a set of functions per pixel on the screen, a simple approach is to render a full-screen triangle. This is just a ...
user avatar
  • 33.2k
18 votes
Accepted

Should unbind buffers?

You seem to be doing a lot on unnecessary binding/unbinding. If you are using a VAO, then you should only bind the VAO when you set it up and when drawing the geometry. You only bind the VBO/IBO again ...
user avatar
  • 3,017
17 votes

OpenGL - How come drawing sprites takes so much performance

Your GPU can probably render even 100k sprites without issues, but you need to do it smart. Sprites and other geometry must be supplied to a GPU in batches grouped by the same texture, shader and ...
user avatar
  • 308
16 votes

Why do we use 4x4 matrices to transform things in 3D?

3x3 matrices cannot represent 3D translations, but 4x4 matrices can A simple argument why 3D translations are not possible with 3x3 matrices is that translation can take the origin vector: ...
user avatar
16 votes
Accepted

3D Camera Rotation

What you are looking for can be found in this very good explanation: http://www.songho.ca/opengl/gl_transform.html But since I found it sort of confusing without hand holding I will try to explain it ...
user avatar
  • 2,826

Only top scored, non community-wiki answers of a minimum length are eligible