25 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*...
Maximus Minimus's user avatar
21 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 ...
tuket's user avatar
  • 475
9 votes
Accepted

OpenGL - texture releasing

If I call glDeleteTextures, will it release memory immediately? glDeleteTextures After a texture is deleted, it has no contents or dimensionality, and its name is free for reuse. This says ...
Maximus Minimus's user avatar
7 votes

Difference between "texture" vs "texture2d" in OpenGL ES?

texture2D is the same as texture, but it's used in the older versions of glsl. Between glsl 120 and 130 they changed the ...
Bálint's user avatar
  • 14.8k
7 votes
Accepted

Is Opengl 2.x still usable?

First of all, you are very confused. There is OpenGL ES 2.0, and there is desktop OpenGL 2.0 and 2.1. These are very different things, which run on entirely different platforms. ES runs on primarily ...
Nicol Bolas's user avatar
6 votes
Accepted

Any fast alternative to sine in GLSL?

ATI made an announcement that the sine / cosine instructions in their newest GPUs now requires only a single clock cycle... in 2004! Modern GPUs in fact have special function units specifically for ...
Philipp's user avatar
  • 118k
5 votes

How to compile with OpenGL ES on Windows?

I suggest you save yourself a lot of pain and grab the ARM Mali OpenGL ES Emulator, or the PowerVR Graphics SDK v3.3. This way you will be ready to roll in minutes. This of course assumes that you do ...
Engineer's user avatar
  • 29.4k
5 votes
Accepted

How can I determine how widespread support of OpenGL ES 3 is?

The amount of how many devices support different APIs is usually easy to figure out by looking at public hardware stats of popular engines, such as unity and unreal. I recommend using multiple sources ...
Lasse's user avatar
  • 3,241
4 votes
Accepted

OpenGL calculate UV sphere vertices

Let's start by generating all unique vertices. You can then decide whether to index those vertices, or copy them into strips/fans, depending on your needs. Here's some example code showing how to ...
DMGregory's user avatar
  • 132k
4 votes

OpenGL ES 2.0 Shadow Mapping - depth only FBO not working due to GL_FRAMEBUFFER_INCOMPLETE_ATTACHMEN

You will need to implement multiple alternative solutions depending on the GPU. Not only are there many choices (GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT32, ...
Stephane Hockenhull's user avatar
4 votes
Accepted

How to preserve EGL context when pausing Android ndk app

Introduction to terminology and description state transitions are in the Android Understand the Activity Lifecycle guide. There are basicaly three states: First state is CREATED, which is reported ...
Ivorne's user avatar
  • 181
3 votes
Accepted

2D Collision in tilemap - ArrayOutOfBounds

For accessing the array i suggest you make a function like the following: ...
Greffin28's user avatar
  • 989
3 votes
Accepted

Is this the typical approach to modern OpenGL UI & Text rendering, for mobile?

Your points seem reasonable. For static elements that are set up once and never change, you can certainly pack them into a GL_STATIC_DRAW buffer and keep it alive ...
glampert's user avatar
  • 3,057
3 votes
Accepted

How to compile with OpenGL ES on Windows?

It seems like you're having several points where you're confused, so I'll go one by one: Not all LIB files are self contained. It depends on how the DLL is compiled and linked, but it is possible, ...
Panda Pajama's user avatar
  • 13.4k
3 votes

Creating a highlight halo around a selected object

This question popped to the top because of Aeroson's answer (above/below/adjacent/falling in bits around this one) and thought I'd yoink my answer from this question in the event that it was useful to ...
Draco18s no longer trusts SE's user avatar
3 votes
Accepted

GL_CLAMP_TO_BORDER - OpenGL ES 3

GL_CLAMP_TO_BORDER became legal in GL ES 3.2 (link to specification), but may otherwise be available by one (or more) of the following extensions: GL_NV_texture_border_clamp ...
Maximus Minimus's user avatar
3 votes
Accepted

OpenGL ES 1.1: Is it more efficient to use glClear or use glDrawArrays with primitives that render over used frames?

It depends Sometimes glClear can be a signal to the driver and/or GPU that you're done with the prior contents of the framebuffer, which it can then use to optimize internally. Sometimes glClear ...
Maximus Minimus's user avatar
2 votes

Creating a highlight halo around a selected object

The idea is that you extrude the object vertices along their normals. First render highlight: Render the object with disabled z write but enabled z test. Vertex shader: to each vertex add normal * ...
aeroson's user avatar
  • 131
2 votes

Transparency in GLSurfaceView

...
Troy's user avatar
  • 121
2 votes

How to convert from OpenGL to OpenGL ES?

This Qt4 example has some information about porting from OpenGL to OpenGL ES: https://doc.qt.io/archives/qt-4.8/qt-opengl-hellogl-es-example.html
jcoffland's user avatar
  • 121
2 votes

Workaround to losing the OpenGL context when Android pauses?

Some of the answers here are reasonable for early uses of OpenGL ES on Android. The first GLES devices only supported a single context, so GLSurfaceView was designed to aggressively discard state. ...
fadden's user avatar
  • 371
2 votes
Accepted

Luminance 'y' value of surface texture

No, it will not. In GLSL vectors have three sets of swizzle masks: xyzw, rgba and stpq. The ...
kolrabi's user avatar
  • 891
2 votes
Accepted

OpenGL ES 2.0 Without The Use of Shaders

OpenGL ES 2.0 requires you to provide a set of shaders (vertex and fragment). Those examples use the old shader-less OpenGL ES. For an introduction use the old GLES1. Make sure you can draw ...
Stephane Hockenhull's user avatar
2 votes
Accepted

OpenGL Regarding Frame/Buffer Caching

OpenGL doesn't specify this; individual implementations are allowed to cache data and/or results so long as the output is conformant with the specification. Note that this kind of caching is probably ...
Maximus Minimus's user avatar
2 votes
Accepted

Best way to add and remove quads in a VBO?

You don't need a dictionary for this, just use an infinite array (c++ - vector, java - arraylist, c# - list) and store an id in the order they can be found in the vbo. If you want to remove one of ...
Bálint's user avatar
  • 14.8k
2 votes

Can't understand why transformation doesn't work

Usually you should include more details than just "doesn't work" (symptoms, example input-output, etc), but here the errors are pretty obvious: Missing negative sign (for a rotation matrix, your ...
DMGregory's user avatar
  • 132k
2 votes

How can I determine how widespread support of OpenGL ES 3 is?

According to this wiki check... In June 2018, Apple deprecated OpenGL APIs on all of their platforms (iOS, macOS and tvOS), strongly encouraging developers to use their proprietary Metal API, which ...
thatGuy's user avatar
  • 25
2 votes
Accepted

Aligning a weapon model with a first-person camera

One old trick for FPS games is that the player's weapon is rendered separately. What that means in practice is that you render your scene in (at least) two parts: first the world, then the player ...
congusbongus's user avatar
  • 14.8k

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