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*...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
3
votes
Accepted
2D Collision in tilemap - ArrayOutOfBounds
For accessing the array i suggest you make a function like the following:
...
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 ...
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, ...
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 ...
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
...
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 ...
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 * ...
2
votes
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
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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
opengl-es × 480android × 150
opengl × 129
opengl-es2 × 75
ios × 49
textures × 43
shaders × 42
glsl × 40
iphone × 34
java × 32
3d × 25
c++ × 20
libgdx × 19
2d × 14
rendering × 14
performance × 14
webgl × 14
graphics-programming × 13
graphics × 11
cocos2d-iphone × 11
mathematics × 10
matrix × 10
fragment-shader × 9
objective-c × 9
animation × 8