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*...
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 ...
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
Accepted
OpenGL 2.0 - Texture animation with 'pixelated' effect
It's easy to produce an effect like this in a pixel shader, using threshold animation. The idea is that you have a monochrome texture and apply a threshold value to it; wherever the texture is lower ...
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
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 ...
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
Accepted
How do I draw a circular portion of a texture within LibGDX using an OpenGL ES shader?
Alpha mask texture approach
In case your circle would always be the same size, using a second alpha mask texture would be the way to go. You would make it a grayscale mask texture and use its value ...
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
OpenGL (ES 2.0) Function Dependencies
Well, OpenGL is a state machine, so inorder to plot function dependencies you need to plot a state machine, there is this one that models the most recent versions of OpenGL pipeline including ES2.0 ...
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 ...
3
votes
Accepted
Total Texture memory size iOS / OpenGL ES
On iOS it seems that you are asking for trouble when the total memory usage for your app starts approaching half of the device's total memory (1gb for iPhone 5). But there's not a completely hard ...
3
votes
Accepted
How do I apply a texture over a material in OpenGL ES?
Resolved!
effect.texture2d0.envMode = GLKTextureEnvModeDecal;
It is related to the Texture Environment Parameters, i.e. how OpenGL combines the diffuse color of ...
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
Is it possible to convert vec4 to int in GLSL (using OpenGL ES)
I think you can convert it manually by manipulating the bytes yourself.
...
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
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
2D Collision in tilemap - ArrayOutOfBounds
For accessing the array i suggest you make a function like the following:
...
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 ...
3
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, ...
3
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 ...
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
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
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
How do I "reset" the color in OpenGl ES 1.0/1.1?
Full explanation:
OpenGL's (and GLES') default behavior is to modulate the currently set color with the texture with a simple multiplication. That is, it multiplies the color with the value at the ...
2
votes
Accepted
Weird texture binding bug on Mali-400 MP
That was an issue with the driver not compiling uniform sampler2D u_LightmapTexture[MAX_LIGHTMAPS] correctly.
Unrolling the array of ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
opengl-es × 478android × 149
opengl × 128
opengl-es2 × 75
ios × 49
shaders × 42
textures × 42
glsl × 41
iphone × 34
java × 31
3d × 25
c++ × 20
libgdx × 19
rendering × 16
2d × 14
performance × 14
webgl × 14
graphics-programming × 13
graphics × 11
cocos2d-iphone × 11
mathematics × 10
matrix × 10
objective-c × 9
animation × 8
fragment-shader × 8