opengl-es-2.0

OpenGL or OpenGL ES [duplicate]

﹥>﹥吖頭↗ 提交于 2019-12-04 02:52:41
This question already has answers here : Closed 3 years ago . OpenGL ES versus OpenGL (12 answers) What should I learn? OpenGL 4.1 or OpenGL ES 2.0? I will be developing desktop applications using Qt but I may start developing mobile applications in a few months, too. I don't know anything about 3D, 3D math, etc and I'd rather spend 100 bucks in a good book than 1 week digging websites and going through trial and error. One problem I see with OpenGL 4.1 is as far as I know there is no book yet (the most recent ones are for OpenGL 3.3 or 4.0), while there are books on OpenGL ES 2.0. On the

why does binding a GL_ELEMENT_ARRAY_BUFFER to 0 produce a memmove error?

点点圈 提交于 2019-12-03 22:15:21
I had a bug that took me quite some time to fix. I kept getting EXC_BAD_ACCESS and a reference to a memmove error without any further description until I commented the following line: [self loadShaders]; glGenVertexArraysOES(1, &_vao); glBindVertexArrayOES(_vao); // Vertex Buffer glGenBuffers(1, &_vertexBuffer); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW); glEnableVertexAttribArray(ATTRIB_VERTEX); glVertexAttribPointer(ATTRIB_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0); glEnableVertexAttribArray(ATTRIB_TEXTURE);

Android OpenGL ES 2, Drawing squares

放肆的年华 提交于 2019-12-03 22:14:46
EDIT: Problem solved! So I've been going through the official OpenGL ES 2 tutorials for Android, and I've gotten to the part that involves drawing shapes, but I can't seem to get a square to work. It draws a right triangle instead. I've included the code that I'm using to define and draw the shape, which is copied almost exactly from the tutorial. The Renderer class simply creates an instance of this shape and calls the draw method. For some reason, the tutorial does not give the values/declaration for vertexStride and vertexCount, so the ones I have in there are educated guesses. I've tried

Where is the documentation for OpenGL ES 2.0 on Android?

孤街浪徒 提交于 2019-12-03 20:19:07
The only place I can find documentation on OpenGL ES 2.0 for android is at https://developer.android.com/reference/android/opengl/GLES20.html and at the tutorials on their website. Where can I find an api that explains what the GLES20 methods do? The current api just lists them without any explanation. I've run several internet searches and have had no luck. OpenGL ES is managed by the Khronos Group and documentation can be found on their site here: http://www.khronos.org/opengles/sdk/docs/man/ It may not be Java/Android specific, but it is the 'official' documentation for OpenGL ES 2.0. You

OpenGL ES 2.0 : Seeking VBO Performance/Optimisation Tips For Many Moving Vertices

馋奶兔 提交于 2019-12-03 17:43:51
问题 In my ongoing attempt to convert to OpenGL ES 2.0 from ES 1.x I'm currently converting some code to use Vertex Buffer Objects ('VBOs') rather than the existing unbuffered glDrawArrays calls. I've set up the VBOs and got them working, but have hit a design dilemma and would be grateful the advice of someone more experienced with OpenGL ES 2.0. I want to draw a bunch of polygonal sprites which move often. This is because they're dynamic Box2D bodies, if you're familiar with Box2D. These polygon

How do I properly update a vertex array in OpenGL Es 2.0?

耗尽温柔 提交于 2019-12-03 16:58:51
问题 When I update my vertex array on iOS in OpenGL 2.0, the original vertex data is staying on the screen -- ie the 1st flush is persistent (the initial set of points I sent down to the GPU gets rendered every frame), but the 2nd, 3rd, 4th, .. nth flushes all seem to overwrite the same memory. So I'm doing: vector<VertexType> rawDynamicData ; glGenVertexArraysOES( 1, &va ) ; CHECK_GL ; glBindVertexArrayOES( va ) ; CHECK_GL ; glGenBuffers( 1, &vb ) ; CHECK_GL ; glBindBuffer( GL_ARRAY_BUFFER, vb )

Loading 4-channel texture data in iOS

不羁岁月 提交于 2019-12-03 16:10:43
I want to load 4-channel texture data from a file in iOS, so I consider the texture as a (continuous) map [0,1]x[0,1] -> [0,1]x[0,1]x[0,1]x[0,1] If I use the fileformat .png , XCode/iOS consider the file as an image, and so multiplies each component rgb with a (premultiplied alpha), corrupting my data. How should I solve this? Examples may be use two textures with components rgb (3-channel) postdivide alpha use another file format Of these, I consider the best solution to be to use another file format. The GL-compressed file format (PVRTC?) is not Apple-platform independent and seems to be of

Implementing GLSurfaceView.Renderer Issues

别来无恙 提交于 2019-12-03 15:54:23
问题 Code derived from the tutorial I am beginning some OpenGL-ES 2.0 for the Android system. I took the following code from: http://developer.android.com/training/graphics/opengl/environment.html#renderer public class MyRenderer implements GLSurfaceView.Renderer { public void onSurfaceCreated(GL10 unused, EGLConfig config) { GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f); } public void onDrawFrame(GL10 unused) { GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); } public void onSurfaceChanged(GL10 unused,

Why does GLSL's arithmetic functions yield so different results on the iPad than on the simulator?

岁酱吖の 提交于 2019-12-03 15:32:33
I'm currently chasing some bugs in my OpenGL ES 2.0 fragment shader code which is running on iOS devices. The code runs fine in the simulator, but on the iPad it has huge problems and some of the calculations yield vastly different results, I had for example 0.0 on the iPad and 4013.17 on the simulator, so I'm not talking about small differences which could be the result of some rounding errors. One of the things I noticed is that, on the iPad, float1 = pow(float2, 2.0); can yield results which are very different from the results of float1 = float2 * float2; Specifically, when using pow(x, 2.0

Full screen background texture with OpenGL performance issue (iPad)

谁都会走 提交于 2019-12-03 14:28:39
I am quite puzzled with the poor performance I'm seeing when drawing a full screen background using a textured triangle mesh in OpenGL: drawing just the background and nothing else maxes out at 40 fps using the most basic shader, and 50 fps using the default pipeline. While 40 fps doesn't seem too bad, adding anything else on top of that makes the fps drop, and considering I need to draw 100-200 other meshes on top of that, I end up with a paltry 15 fps that is simply not usable. I have isolated the relevant code into an XCode project available here , but the essence of it is the canonical