opengl-es

How do I grab an image from my EAGLLayer ?

China☆狼群 提交于 2020-01-11 03:41:12
问题 I'm looking for way to grab the content of my opengl (as UIImage) and then save it into a file. I'm now giving glReadPixels a try though I'm not sure I'm doing the right thing as of what kind of malloc I should be doing. I gather that on OSX it's GL_BGRA but on the iPhone that doesn't work... 回答1: All OpenGL|ES complient GL-implementations have to support GL_RGBA as a parameter to glReadPixels. If your OpenGL|Es supports the GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES extension you can also query

How to detect collision in webgl?

☆樱花仙子☆ 提交于 2020-01-11 02:27:29
问题 How to detect collision in webgl, without using any library like three.js? 回答1: How to detect collision in webgl You don't. WebGL, like OpenGL is only for drawing stuff. It doesn't manage a scene, it has no notion of "objects" or such high level things like collisions. It's all about points, lines, triangles and shaders. Anything related to scene management or collisions lies outside the scope of WebGL (and OpenGL). 回答2: A simple approach it to do ray collision detection on the GPU. Checkout

How to measure true FPS performance of OpenGL ES?

◇◆丶佛笑我妖孽 提交于 2020-01-10 15:41:47
问题 I realized that these are two different things: Drawing, and getting it on screen. So while you may draw in every single call from CADisplayLink at a rate of 60 FPS, if your drawing operations take slightly longer than 1/60 seconds you end up with 30 FPS in theory, because you're missing out every other chance to get through the render pipeline. OK; Knowing this, it seems nonsense to remember the start NSTimeInterval and incrementing a frame counter in the run loop, then checking at the end

How to overlay GLSurfaceView over a MapView in Android?

早过忘川 提交于 2020-01-10 02:16:32
问题 I want to create a simple Map based application in android ,where i can display my current position.Instead of overlaying a simple Image on the MapView to represent the position, i want to overlay the GLSurfaceView on the MapView. But i don't know how to achieve this. Is there any way to do that?. Please anybody knows the solution help me. 回答1: I was stuck on a similar problem until I looked at the documentation and realized that MapView extends ViewGroup , so overlaying a GlSurfaceView

ipad 3 - openGL bug with kEAGLDrawablePropertyRetainedBacking and retina?

只愿长相守 提交于 2020-01-09 09:54:09
问题 i have an iOS openGL app which uses the kEAGLDrawablePropertyRetainedBacking property to draw the current frame on top of the previous frame. it's a cheap way of getting effects like motion trails. it works great on all devices (including iPhone w/ retina) and all device simulators, but on the actual iPad 3 device, the previous frame is vertically squished to 75% of its previous size. for example, if i were to draw a 100 x 100 square at the bottom of the screen each frame, then in frame 0 i

OpenGL ES - get 2D pixel coordinate from camera position

两盒软妹~` 提交于 2020-01-07 09:52:08
问题 I'm working with OpenGL ES (IOS) and OpenCV. I would like to know if there is a way to get 2D pixel coordinate from a GLKMatrix4 camera position ? Indeed, I have a specific 3D object displayed with OpenGL which has only its size and its camera pose and I would like to convert it into the OpenCV reference Coordinate i.e 2D pixel. More precisely, I have an IOS app and I stream the camera color. This stream is displayed with OpenGL on my Ipad. On this display, I have a specific overlay which is

OpenGL ES, Changing texture format from RGBA8888 to RGBA4444 will improve fill rate?

安稳与你 提交于 2020-01-07 07:27:09
问题 I'm rendering a lot of big images with alpha testing, and I'm hitting the fill rate. If I change the texture format from RGBA8888 to RGBA4444 will the fill rate improve? EDIT: Hardware is Iphone 3GS and OpenGL version 1.1 回答1: Doing some tests I've found the following: Loading png as RGBA8888 I get 42fps Loading png as RGBA4444 I get 44fps Loading pvrtc2 I get 53 fps (and I had to double the texture size because it was not squared) It seems that changing from rgba8888 to rgba4444 does not

OpenGL Environment mapping Reflection

此生再无相见时 提交于 2020-01-07 07:09:36
问题 my reflections are wrong. I have changed a lot of the code, but I didn't find the error. It would be great if you can help me. Texture generation: Code : m_cubeMap = new int[1]; m_cubeFB = new int[1]; // create the cube map glGenTextures ( 1, m_cubeMap, 0 ); glBindTexture ( GL_TEXTURE_CUBE_MAP, m_cubeMap[0] ); for( int i = 0; i < 6; i++ ) { glTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA, m_cubeMapSize, m_cubeMapSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, null ); } glTexParameteri( GL

Camera frame to UIImage to OpenGL rendering gives an odd image

China☆狼群 提交于 2020-01-07 06:15:46
问题 I'm extracting a UIImage with NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer]; UIImage *image = [UIImage imageWithData:imageData]; then i'm creating an OpenGL texture and render it. then i extract a UIImage from the frame buffer but it comes out wrong as you can see. i tried playing with texture vertices array but it stayed the same. this are the coordinates: const GLfloat squareVertices[] = { -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1

loading multiple textures openGL

和自甴很熟 提交于 2020-01-07 05:47:25
问题 I just started using openGL I need to load allot of bitmaps for animation I can get it to work great for a few frames but run out of memory when I try to load all the frames How can I load just a few frames at a time? This is the code I'm using to load the textures public void loadGLTexture(GL10 gl, Context context) { Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),R.drawable.r1); Bitmap bitmap01 = Bitmap.createScaledBitmap(bitmap, 512, 512, false); Bitmap bitmap2 =