18

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* is 1 draw call. The simple cases of drawing quads (assuming the GL version you use hasn't removed quads) or triangles are not a good example for comparing ...


16

The problem with using texture atlases and adjacent texels leaking has to do with the way linear texture filtering works. For any point in the texture that is not sampled exactly at the center of a texel, linear sampling will sample 4 adjacent texels and compute the value at the location you asked as the weighted (based on distance from the sample point) ...


15

You propose running each separate "system" in parallel. The problem with this is that you will have to lock every single piece of shared state. CLARITY EDIT: When you have two parallel operations using all of the same data, lock contention and synchronization is going to slow things down so that you're not gaining many benefits from the parallelization. ...


13

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 imagine that we have window that has a dark color as back ground, and we have white as the clear color. The most common case is having viewport and scissor cover ...


13

TL; DR: If you multiply stuff together, you need to start with a 1 Forget about matrices for a second, let's talk about numbers. Suppose to rotate by 90, you multiply by 90. So P' = 90*P Now you do other transforms - a rotation R, a translation T, a scale S and so on. So P' = T*R*S*P Since you will apply all these transforms to a lot of points, you want ...


10

The performance cost of branching can be not trivially small too. In your case all vertices and fragments being drawn will be taking the same path through your shaders, so on modern desktop hardware it would not be as bad as it could be, but you're using ES2 which implies that you're not using modern desktop hardware. The worst case with branching will go ...


9

I'd like to add another answer to this that was passed on to me a year or two back by Chris Pruett (Replica Island, Wind-Up Knight, etc). It's especially useful here in 2013 since setPreserveEglContextOnPause(true) doesn't seem to work on 4.3. (I could be wrong about that but that's how it looks to me right now as I update game code last touched in 2011). ...


8

The way most drivers operate is by using a "lazy state changes" model. What this means is that the vast majority of your gl* calls will actually do nothing much more than recording a state, storing off some parameters, then return immediately. This works perfectly fine up until a gl* call is made that actually needs to do something with all that state (or ...


7

I solved the problem with the EGLConfigChooser. I have no idea what that is doing... but it works very fine. I just copyed the code from here: http://code.google.com/p/gdc2011-android-opengl/source/browse/trunk/src/com/example/gdc11/MultisampleConfigChooser.java in a new class and made as it told me: To use this, call myGLSurfaceView....


7

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 than the threshold, the material is colored, and where the texture is higher than the threshold the material is blank. You animate the threshold value from 0 ...


7

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 absolutely nothing about the backing storage for a texture, i.e the memory used for it. From that we can infer that behaviour is entirely up to the GL implementation....


7

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 mobile hardware, while desktop GL runs primarily on desktop hardware. The core/compatibility distinction only exists for desktop GL, not OpenGL ES. Raspberry ...


6

USE GLES2 AndEngine is a little tricky to get configured properly the first time you try. I recommend installing the version stored at RealMayo's github, which is a stable version. That's a version of GLES2 and yes, it's definitely worthwhile to use GLES2 over GLES1. Many new features were added that make life easier, improve performance, and add great ...


6

Instead of using an ImageView and transparent GLSurfaceView you should instead render your background using a fullscreen quad (just like you do with your sprites, but sized to fit the entire screen). Render this fullscreen background first (very important) and then also remove the gl.glClear(GL10.GL_COLOR_BUFFER_BIT); call in from onDrawFrame. You no longer ...


6

Any drawing API function called from the CPU will be submitted to the GPU command ring buffer to be executed later by the GPU. This means that OpenGL functions are mostly non-blocking functions. So the CPU and the GPU will be working in parallel. The most important thing to note is that your application can be CPU or GPU bound. once you call glFinish the ...


5

glScissors accomplishes clipping of geometry against a portion of the screen. You would want this, for example, if you were rendering a GUI box that had smoothly scrolling text inside it. You want to clip all geometry outside the portion of the screen covered the by the GUI, but keep partial text or polygons which are still inside. glViewport maps the ...


5

Identity matrix does nothing. It looks like this: 1,0,0,0 0,1,0,0 0,0,1,0 0,0,0,1 And that just multiplies everything by 1 if applied to other matrices or vectors. Read more about matrices An identity matrix could be used as a starting point for some calculations, or if your object is at the origo of the world with no rotations, then you would apply ...


5

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 as the alpha value while drawing. Using a texture had the benefit of having anti-aliasing built into the mask (ie. at the borders of your circle, the pixels can ...


5

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 not need your ES setup to run natively on Windows machines, e.g. when your game goes to market. If you do need to the code to run natively on Windows, you ...


5

texture2D is the same as texture, but it's used in the older versions of glsl. Between glsl 120 and 130 they changed the function to texture and made it accept every kind of samplers, not just a sampler2D. There's no difference between them, so the problem is probably in your code.


4

I worked on adding Apple's GLKMath to the this test (actually forked this fork) Here's the result on my 4 Generation iPod Touch: Eigen: Additions: 77624 milliseconds. Multiplications: 227179 milliseconds. GLM: Additions: 23935 milliseconds. Multiplications: 80599 milliseconds. CML: Additions: 102390 milliseconds. Multiplications: 161059 milliseconds. ...


4

RENDERMODE_WHEN_DIRTY means "do not call onDrawFrame() unless something explicitly requests rendering with requestRender()". Your code snippet is calling requestRender() from within onDrawFrame(), so nothing will ever happen. The idea behind requestRender() is that nothing is drawn until some other thread has decided that rendering needs to happen. The ...


4

It's not going to be easy. I don't know much about AndEngine, but I've developed some GLES 2 apps, and it is possible to run and test them inside an AVD (in the Android world, "Virtual Device", or AVD is the correct term, not "emulator"). Looking at the logcat, I can see that there is a first exception: 02-23 15:18:50.983: D/AndEngine(636)...


4

Yes, interleaved is worth it. Interleaved VBOs has no effect on the size of data. Even with separate VBOs for each attribute, you only have a single index buffer, so you need to duplicate any vertex attributes appropriately. That means that you have a single value of an attribute shared by multiple vertices, you must duplicate it for each vertex, no ...


4

Here's some guesses for you to experiment with: Batch count is mainly a CPU load optimization, and not a GPU one. Try measuring CPU performance instead, for example by adjusting the positions so everything get clipped off screen. I wouldn't be surprised if the driver realizes that each batch is actually pointing into a contiguous array and merges them all ...


4

First you'll need to be able to setup OpenGL ES for 2D rendering. Have a look at this answer on SO for some basic introductory info on how to setup and get a texture loaded and ready for 2D rendering. Once you have that going it is a simple matter of changing the bound texture at some interval. First, you will need some class members (globals): // these ...


4

OpenGL never updates the screen, technically. There is a window system API that is separate from GL (e.g. GLX, WGL, CGL, EGL) that does this. Buffer swaps using these APIs generally implicitly invoke glFlush (...) but in some implementations (e.g. the GDI rasterizer on Windows) it does a full glFinish (...):       *On the left ...


4

I agree that option 2 (two render threads running at different frequencies) would be the most "logical" way to deal with this kind of situation, but it makes a big assumption: the GPU and driver have to support—or rather, simulate—pre-emptive multitasking. What you want is that the UI drawing commands from thread 1 should get high priority and get finished ...


4

I'm not too familiar with what features aren't supported by OpenGL ES but the way I see it you have a couple options. A quick and easy way to get a black outline effect around an object is to scale the object up slightly and render it completely black. You can then render the regular version of the model again. Another way would be to use an edge ...


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