opengl-es

How to group multiple objects for purpose of rotating them as a unit?

主宰稳场 提交于 2019-12-21 17:24:58
问题 I need some pointers on the best approach for a rotation task in OpenGL. I know how to rotate objects in 3D space using quaternions, I can translate them, all well and good. But I want to know the best way to treat a collection of different objects as a single entity for the purpose of rotation. For example, suppose you have a desk with objects on it. Each has its own translation and rotation, but now I want to rotate the entire desk and everything on it, while keeping other objects in the

First steps in creating a chroma key effect using android camera

拟墨画扇 提交于 2019-12-21 17:07:59
问题 I'd like to create a chroma key effect using the android camera. I don't need a step by step, but I'd like to know the best way to hijack the android camera and apply the filters. I've checked out the API and haven't found anything super definitive on how to manipulate data coming from the camera. At first I looked into using a surface texture, but I'm not fully aware how that helps or how to even use it. Then I checked out using a GLSurfaceView, which may be the right direction, but not

Is iOS glGenerateMipmap synchronous, or is it possibly asynchronous?

我的梦境 提交于 2019-12-21 17:02:35
问题 I'm developing an iPad app that uses large textures in OpenGL ES. When the scene first loads I get a large black artifact on the ceiling for a few frames, as seen in the picture below. It's as if higher levels of the mipmap have not yet been filled in. On subsequent frames, the ceiling displays correctly. This problem only began showing up when I started using mipmapping. One possible explanation is that the glGenerateMipmap() call does its work asynchronously, spawning some mipmap creation

WebGL: How do I get the position of every pixel in fragment shader?

大城市里の小女人 提交于 2019-12-21 13:48:13
问题 I know I could use gl_Position to get every vertex's position, but if it's possible to get every pixel's position in fragment shader ? I want to change the alpha value of some pixel area. 回答1: vec2 gl_FragCoord It will return you position of the fragment on the screen in pixels. If you pass uniform vec2 screenResolution then you could play with that two values to determine where exactly on the screen is pixel, in which part and such. This is a built-in variable, so you can use it whenever you

Is it bad to set glTexParameteri() during render time?

Deadly 提交于 2019-12-21 12:51:15
问题 I am facing issues with texture wrapping. which is causing artifacts. Since my codebase has grown huge the only way that I can think of is to perform certain checks to see if certain textures fall under the category which are causing artifacts and change the parameters before drawing onto the renderbuffer. So is it generally ok? to set parameters like glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);

CABasicAnimation not changing its position property after animation completes

依然范特西╮ 提交于 2019-12-21 12:31:31
问题 i am applying CABasicAnimation for position property of a layer it is animating well but after animation complete its coming back to original position how to avoid that and to make image to stay in animated position only? 回答1: There are a few different ways to solve this. My favorite is to set the object at the end of the animation, and use fromValue instead of toValue to create the animation. You can also set both fromValue and toValue to create this effect. ie CABasicAnimation *animation =

OpenGL ES 2.0 PNG alpha channel

梦想与她 提交于 2019-12-21 12:06:09
问题 I am just learning to work with OpenGL ES 2.0 for Android. I have been trying to simply display a texture on the middle of the screen, which was easy enough, but I cannot seem to get the PNG alpha to work properly. The image will either show with a black background, or the entire image will be blended into the background color slightly, depending on the settings I use. The actual tutorials I have followed to get to this point never worked with transparency, so I have tried to work in code I

glGenTextures returns zero in background thread

霸气de小男生 提交于 2019-12-21 11:03:56
问题 I need to load textures in background thread in OpenGL ES. But glGenTextures always returns zero when called in background thread. -(void) someMethodInMainThread { [self performSelectorInBackground:@selector(load) withObject:nil]; } -(void) load { GLuint textureID = 0; glGenTextures(1, &textureID); } textureID is zero. If i change code to [self performSelector:@selector(tmp) withObject:nil]; it will work correct and return 1. How should i load textures in background thread? 回答1: This is a

Understanding iPhone OpenGL Profiling

自闭症网瘾萝莉.ら 提交于 2019-12-21 10:48:17
问题 My app is up and running and now I am looking to improve the rendering performance. Using 'Instruments' I have collected some data. I am working with an old iPhone 3G as a worst case senario. Time Profiler: -30% CopyVertexElementsMultipleSequential -11% mach_msg_trap -4% _semwait_signal -2% ValidateState However using the Open GL ES Driver, the Sampler reads: -70% _semwait_signal -24% CopyVertexElementsMultipleSequential -0.7% mach_msg_trap Poking around the docs I haven't been able to come

a lot of GREEN Color at YUV420p --> RGB in OpenGL 2.0 Shader on iOS

不打扰是莪最后的温柔 提交于 2019-12-21 06:28:09
问题 I want to make a movie player for iOS using ffmpeg and OpenGL ES 2.0 but I have some problem. Output RGB image has a lot of GREEN color. This is code and images 480x320 width & height: 512x512 Texture width & height I got a YUV420p row data from ffmpeg AVFrame. for (int i = 0, nDataLen = 0; i < 3; i++) { int nShift = (i == 0) ? 0 : 1; uint8_t *pYUVData = (uint8_t *)_frame->data[i]; for (int j = 0; j < (mHeight >> nShift); j++) { memcpy(&pData->pOutBuffer[nDataLen], pYUVData, (mWidth >> nShift