opengl-es-2.0

Libgdx: Moving a rotated perspective camera

允我心安 提交于 2019-12-04 17:41:46
I am developing an android app which visualize the map of an environment and currently i am using libgdx to draw the map, also like any map application the user should be capable of zoom, rotate and moving the map, I have developed a GestureHandler class which implements GestureListener interface and interacts with a PerspectiveCamera (since i will use 3d components in the future): @Override public boolean pan(float x, float y, float deltaX, float deltaY) { float tempX = (mapView.getCamera().position.x - deltaX * 0.5f); float tempY = (mapView.getCamera().position.y + deltaY * 0.5f); mapView

How to convert an Open GL ES 2.0 application to a Live Wallpaper?

南笙酒味 提交于 2019-12-04 17:22:08
I have a class which implements GLSurfaceView.Renderer and uses Open GL ES 2.0, and works perfectly as a standard application. However I'd like to expand this so that its a live wallpaper. Naturyally I've got a service class which exteds WallPaperservice, and in turn a engine class which extends WallpaperService.Engine. In the normal version of the code I can just do mGLSView = new GLSurfaceView(this); // in the engine this becomes 'new GLSurfaceView(getBaseContext());' mGLSView.setEGLContextClientVersion(2); mGLSView.setRenderer(new myRenderer()); setContentView(mGLSView); However in the

Scaling around point (pinch zoom) with Android and OpenGL ES 2.0

六眼飞鱼酱① 提交于 2019-12-04 17:12:47
I'm trying to scale around the point using approach: translate to the point I want to scale around (pinch zoom) scale translate back It looks like: @Override public boolean onScale(ScaleGestureDetector detector) { float scaleFactor = detector.getScaleFactor(); float focusX = detector.getFocusX(); float focusY = detector.getFocusY(); Matrix.translateM(modelMatrix, 0, -focusX, -focusY, 0); Matrix.scaleM(modelMatrix, 0, scaleFactor, scaleFactor, 0); Matrix.translateM(modelMatrix, 0, focusX, focusY, 0); But when I create result MVP matrix like: Matrix.multiplyMM(MVPmatrix, 0, projectionMatrix, 0,

Which OpenGL ES 2.0 texture formats are color-, depth- or stencil-renderable?

折月煮酒 提交于 2019-12-04 16:46:50
问题 From OpenGL ES 2.0 specification section 4.4.5: "Formats not listed in table 4.5, including compressed internal formats. are not color-, depth-, or stencil-renderable, no matter which components they contain." Then there are extensions that extend this table such as: OES_depth24 OES_depth32 OES_rgb8_rgba8 ARM_rgba8 If I understood the specification correctly, table 4.5 affects both texture and renderbuffer formats. And in that case, for example, RGB and RGBA textures with 8-bits per component

What is glVertexAttrib (versus glVertexAttribPointer) used for?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 15:28:59
问题 I understand that glVertexAttribPointer will set the values for a vertex attribute based on the pointed-to array. What is glVertexAttrib for, though? It looks like it just sets a single (possibly vector) value for the vertex attribute, so what happens when you have multiple vertices? Do all of the vertices end up seeing the same value for the attribute? 回答1: This was mainly used with the old immediate mode ( glBegin/glEnd ), where you don't use vertex arrays, which is deprecated (and removed

Transparent objects in OpenGl ES 2.0

北战南征 提交于 2019-12-04 15:24:18
So I've been playing around with OpenGL ES 2.0 on Android but now got to a problem I haven't been able to solve. Apologies in advance, it appears that I'm not allowed to post more that two links (yet), so I put my three images in a Photobucket album here . I'm trying to create a 3D environment that is enclosed by transparent areas ("colored glass"). To see if it works I also put a opaque cube within. I enabled the following capabilities: GLES20.glEnable(GLES20.GL_CULL_FACE); GLES20.glEnable(GLES20.GL_DEPTH_TEST); GLES20.glEnable(GLES20.GL_BLEND); GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20

What OpenGL ES texture format should I use for better dynamic range on iPad?

我与影子孤独终老i 提交于 2019-12-04 15:14:15
I'm developing some software which uses a texture map to store geometry. Using GL_RGB for the internal format gives a lot of aliasing, I assume because the texture is being compressed down to GL_RGB4 by default. On a desktop I can use GL_RGB16 or GL_RGB32F (etc.) to set the internal format, but under OpenGL ES 2.0 there doesn't seem to be any of these formats. Is there an alternative, or extension, that is available under IOS which I can use? According to Apple (and my own experience) GL_RGB and GL_UNSIGNED_BYTE uses 8:8:8 storage. To drop to lower colour precision you'd need to specify a type

iOS based OpenGL ES programming

情到浓时终转凉″ 提交于 2019-12-04 14:14:58
问题 I need to find resources for learning openGL ES for the iPhone. I've already watched Brad Larson's awesome videos and I'm downloading the advanced videos from apple now. I know a lot about iOS programming but am clueless on OpenGL, so resources that don't assume I already know openGL. I want to learn a majority of the OpenGL capabilities, but my major goal is to be able to manipulate an image based on the touch locations. More specifically I want to create a water ripple effect that follows

How to use GPUImageLookupFilter without GPUImageFilterGroup?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 13:21:18
I have a problem with understanding GPUImage. Specifically, I can't figure out how to use GPUImageLookupFilter. I have several examples of usage in GPUImageAmatorkaFilter for example. But LookupFilter used there within GPUImageFilterGroup which I didn't understood yet either. I wonder whether I can use LookupFilter alone. I've tried this: GPUImageLookupFilter *lookup = [[GPUImageLookupFilter alloc] init]; UIImage *image = [UIImage imageNamed:@"amatorka.png"]; GPUImagePicture *lookupImageSource = [[GPUImagePicture alloc] initWithImage:image]; [lookupImageSource addTarget: lookup

opengl overlay on camera view

[亡魂溺海] 提交于 2019-12-04 12:38:58
问题 I still haven't found a proper way to show an opengl overlay oon top of camera preview, There's a hack, where you call setContentView(GLSurfaceView) addContentView(MyCameraSurfaceView) but it doesn't work properly - i.e. when you switch to anouther activity and go back, the opengl layer isnt displayed over camera preview. there are a lot of tutorials and samples which use the above method, but it simply doesn't work as expected does anyone know how they do it in layar 回答1: It looks like I've