opengl-es

Render to 3D texture webgl2

Deadly 提交于 2019-12-10 19:02:57
问题 I read here that it should be possible to render to a 3D texture in WebGL2 by using multiple render targets and attaching each layer of the 3d texture as a layer to the render target. However I can't seem to get it to work, no errors but the values of the texture doesn't change between the reads and is just empty. The texture has gl.RGBA8 as internal format, gl.RGBA as format and a size of 64x64x64 What am I doing wrong? This is what I tried so far (pseudo code): this.fbo = gl

Applying a custom SKShader to SKScene that pixelates the whole rendered scene in iOS 8 SpriteKit with Swift

寵の児 提交于 2019-12-10 19:02:22
问题 I'm trying to create a full-screen pixelation effect on SKScene. I've learned that there should be two options to do this: Using a custom SKShader using GLES 2.0. Using Core Image filters. I've tried to add a custom SKShader that should modify the whole screen by pixelating it. I'm not sure that if it's possible, but documentation from SKScene (which is a subclass of SKEffectNode ) suggests it: An SKEffectNode object renders its children into a buffer and optionally applies a Core Image

Reading a openGL ES texture to a raw array

末鹿安然 提交于 2019-12-10 18:55:34
问题 I'm trying to get the bytes from a RGBA texture in openGL ES. I think I'm trying to imitate glGetTexImage from vanilla openGL. As is right now, the pixels are all nil, from the call to glClear , not the texture data I'm looking for. This is a method in a category extending SPTexture from Sparrow Framework. -(NSMutableData *) getPixelsFromTexture { GLsizei width = (GLsizei) self.width; GLsizei height = (GLsizei) self.height; GLint oldBind = 0; glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldBind);

Use MediaCodec to record 720p video but fps of encoding video is too low

喜夏-厌秋 提交于 2019-12-10 18:47:06
问题 I managed to write a video recording demo, my implementation is the same as ContinuousCaptureActivity of Grafika. In ContinuousCaptureActivity.java, The author create egl object in SurfaceCreated which run in UI thread and call drawFrame also in UI thread. He did 2 things in drawFrame, draw frame to screen and push data to encoder. See the code here: ContinuousCaptureActivity Because I set the encoding video size to 1280*720 which is large, the camera preview is not smooth and fps of target

what is the purpose of onSurfaceChanged?

一笑奈何 提交于 2019-12-10 18:44:46
问题 I don't exactly understand what the purpose of this method is. In the android documentation, they say that this is when the size of the screen is changed. Does this mean the size of the viewport, or what exactly does it mean? What opengl calls should I make in the method. 回答1: The method is called when the size of the viewport is changed or first created. This function is the first place where you will know exactly how many pixels your GlSurfaceView occupies. In this method it would be

How to merge two FBOs?

℡╲_俬逩灬. 提交于 2019-12-10 18:40:07
问题 OK so I have 4 buffers, 3 FBOs and a render buffer. Let me explain. I have a view FBO, which will store the scene before I render it to the render buffer. I have a background buffer, which contains the background of the scene. I have a user buffer, which the user manipulates. When the user makes some action I draw to the user buffer, using some blending. Then to redraw the whole scene what I want to do is clear the view buffer, draw the background buffer to the view buffer, change the

How to obtain the RGB colors of the camera texture in OpenGL ES 2.0 for Android in Java

半腔热情 提交于 2019-12-10 18:35:10
问题 I'm trying to port a .NET app to Android where I capture each frame from the camera and then modify it accordingly to user settings before displaying it. Doing it in .NET was simple since I was able to simply query the camera for the next image and I would get a bitmap that I could access at will. One of the many processing options requires the application to obtain the intensity histogram of each captured image and then do some modifications to the captured image before displaying the result

Difference from eglCreatePbufferSurface and eglCreatePixmapSurface with OpenGL ES(EGL)

末鹿安然 提交于 2019-12-10 18:34:00
问题 I am having a problem where I need to some off-screen work with opengl es2 by software rendering(Only has CPU, no GPU). The question is can I use pbuffer without GPU? Also, how to directly save to a png file after drawing something. Please help and give me a demo. 回答1: First, use EGL to create an off-screen buffer: eglCreatePbufferSurface(display, config, PBufAttribs); Then read the buffer: GLint size; size = esContext->width * esContext->height * 4; GLubyte *data = (GLubyte*)malloc(size);

ios - pass a 4x4 matrix to glUniformMatrix4fv

╄→гoц情女王★ 提交于 2019-12-10 18:24:12
问题 I'm trying to pass a 4x4 matrix to glUniformMatrix4fv but can't figure out the last bit. I create a 4x4 by directly inputing 16 values. glUniformMatrix4fv excepts an UnsafePointer<GLfloat>! as its last argument var proj = GLKMatrix4(m: ( -1.1269710063934326, 0.0, -1.380141455272968e-16, 0.0, 0.0, 0.800000011920929, 0.0, 0.0, 0.0, -0.0, 0.0, -4.950000286102295, -1.2246468525851679e-16, 0.0, 1.0, 5.050000190734863) ) var loc = GLint(_locations.uniforms.projection) var f = GLboolean(GL_FALSE)

OpenGL: Circle bevel with fragment shader?

倖福魔咒の 提交于 2019-12-10 18:17:55
问题 I'm trying to make a circular particle that looks like it's got a light shining on the top of it. Here's what I'm trying to get it to look like: And here's what it currently looks like: Not very good. Since I'm using GL_POINTS, I get the gl_PointCoord variable, which should make things easier, except I don't know how to use it properly, which led to this mess: varying lowp vec4 DestinationColor; void main(void) { lowp vec2 circCoord = 2.0 * gl_PointCoord - 1.0; if (dot(circCoord, circCoord) >