opengl-es-2.0

OpenGL ES 2.0: How to improve frame rate of drawing sprites?

≡放荡痞女 提交于 2019-12-08 12:45:08
问题 I have an animated background layer that is built on top of OpenGL ES 2.0 and I am using GLKView as graphics container and GLKViewController as controller. For drawing I use GLKBaseEffect. I introduced a sprite class that can load png-files as textures, manipulate the sprite (SRT) and some additional properties like alpha blending and so on. I am wondering how I could optimise my program, since the frame-rate drops on my iPhone 4S to about 25 FPS when displaying 50 sprites (all with the same

Writing my own OBJ parser that loads the data in VBOs, how to re-order data to match single index list?

大兔子大兔子 提交于 2019-12-08 12:39:08
问题 I've been trying to convert an OBJ parser that I wrote previously that used display lists to use VBOs instead, and have attempted to see if I could figure out the issue myself without any outside help, but now I think I have been looking at the code too long and am unable to find any errors. This is an Android App, through OpenGLES 2.0, and I end up with some triangles up on the screen, but not in the correct places at all. I have a feeling that my attempt to get all of the elements of each

Android OpenGLES 2.0 Texture Mapping Does Not Work

 ̄綄美尐妖づ 提交于 2019-12-08 09:19:32
问题 I'm trying to texture map some quads. I can render the quads with solid colors just fine. I've been following this page: http://www.learnopengles.com/android-lesson-four-introducing-basic-texturing/ Everything compiles and runs, but the texture is simply not being applied. The only difference between my code and the page linked is that I do not do glBindAttribLocation, and I use glDrawElements instead of glDrawArrays. EDIT: Converting my vertex and tex coord data to use glDrawArrays did not

Positioning objects in a 3D Scene and then figuring out what the user clicked on

China☆狼群 提交于 2019-12-08 08:47:32
问题 I'm building a cross-platform game in C++, using OpenGL ES 2.0. The target is iPhone at the moment. I'm a newbie to coding games, but not a newbie to coding. I'm confused about how to architect the game. But specifically, I'm asking about how to setup the objects needed to position models in the scene. I have an object that represents a scene. There are 5 scenes. Only one scene is shown at a time. A scene is like a game level. Each scene has all the code for rendering, game logic, mouse and

conversion from float to int (weird behavior)

大憨熊 提交于 2019-12-08 07:47:01
问题 I have this shader to implement character animation uniform mat4 u_mVxP; uniform mat4 u_mBlendMatrices[54]; uniform vec4 u_vDLDiffuseColor; uniform vec4 u_vDLAmbientColor; uniform vec3 u_vLightDir; attribute vec4 a_Position; attribute vec3 a_BWeights; attribute vec3 a_BIndices; attribute vec3 a_Normal; attribute vec2 a_TextureCoordinates; varying vec2 v_TextureCoordinates; varying vec4 v_Color; void main() { vec4 vPos; vec3 vNormal; int i=int(a_BIndices.x); int j=int(a_BIndices.y); int k=int

OpenGL ES 2 without GLKit

寵の児 提交于 2019-12-08 07:35:53
问题 I want to make an app that uses OpenGL ES 2.0. Can I do this without using GLKit, since I want to deploy it to iOS 4.3? I can't find any reference on this. Is it even possible to use shaders etc without GLKit? Thanks 回答1: You can develop in OpenGL ES 2.0 with shader support without using GLKit. GLKit is only there to make simple tasks easier but you don't have to use it at all. For starters have a look at the guide provided by Apple that outlines different approaches: https://developer.apple

Use of undeclared identifier 'gl_InstanceID'

一个人想着一个人 提交于 2019-12-08 07:35:41
问题 Hi everyone, i have been trying Instanced drawing in OpenGLES2.0, in IOS platform. My rendering code glEnableVertexAttribArray(...); glVertexAttribPointer(...) glDrawElementsInstancedEXT(GL_TRIANGLES,IndicesCount, GL_UNSIGNED_SHORT, 0, 5); And my Vertex Shader attribute vec4 VertPosition; uniform mat4 mvpMatrix[600]; void main() { gl_Position = (mvpMatrix[gl_InstanceID]) * VertPosition; } I'm getting ERROR: Use of undeclared identifier 'gl_InstanceID' my glsl version is 1.0, if version is the

Does iOS5 support both GL_STENCIL_INDEX and GL_STENCIL_INDEX8?

不想你离开。 提交于 2019-12-08 06:03:42
问题 With the following code: GLuint viewRenderbuffer, viewFramebuffer, viewDepthbuffer, stencilBuffer; // Create the framebuffer object glGenFramebuffers(1, &viewFramebuffer); glBindFramebuffer(GL_FRAMEBUFFER, viewFramebuffer); // Create a render buffer and bind it to the FBO. glGenRenderbuffers(1, &viewRenderbuffer); glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer); [context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer*)self.layer]; glFramebufferRenderbuffer(GL_FRAMEBUFFER,

With OpenGL ES 2.0 on Android, is there a way preserve multisampling when rendering on a framebuffer?

人走茶凉 提交于 2019-12-08 05:15:46
问题 I am developing a 2d game on Android ICS using OpenGL es 2.0 and java. I am trying to use a lighting system and to do that I render all the lights on a framebuffer and the scene on another, with the intent to blend them using the fragment shader to recreate photoshop overlay effect. I encountered a problem though, it seems that the fbo doesn't work with multisampling, so if I draw on the fbo I get jagged lines. I noticed that there is a solution for people using ios, but I didn't find

Flipping OpenGL ES Texture Obtained Through CVOpenGLESTexture

眉间皱痕 提交于 2019-12-08 05:09:28
问题 In the past day of my foray into OpenGL ES 2.0, while attempting to apply two projective textures -- one sprite animation and one video file texture -- to a skybox, I started simply pounding my hands on the keyboard like stubs, and miraculously it all started working. However, the texture created from the video file is flipped upside-down. In other words, the texture coordinates for (0,0) seem to be mapping to (0,1), and vice-versa. The function which creates the video file texture from a