opengl-es

Split a Texture into puzzle pieces In libgdx

拜拜、爱过 提交于 2019-12-22 01:31:17
问题 I am trying to convert android Canvas based game to Libgdx due to performance issues. Currently I am facing issues when I have to generate jigsaw puzzle piece sprites (dynamically). What I did : I used android bitmap manipulation (Path and PorterDuff) and generated puzzle pieces and then fed that to Libgdx Game object in AndroidLauncher. Question 1 : Is there a better way to convert a bitmap to puzzle pieces inside libgdx core project. (see below) Question 2 : How can I create an area just to

Distortion with 'pixel accurate' OpenGL rendering of sprites

谁说我不能喝 提交于 2019-12-22 01:14:55
问题 To define what I'm trying to do: I want to be able to take an arbitrary 'sprite' image from a ^2x^2 sized PNG, and display just the pixels of interest to a given x/y position on screen. My results are the problem - major distortion - it looks awful! (Note these SS's are in iPhone sim but on real retina device they appear the same.. junky). Here is a screenshot of the source PNG in 'preview' - which looks wonderful (any variations on rendering that I describe in this question look almost

How to set onTouch Listener for drawn texture in Android OpenGL-ES

江枫思渺然 提交于 2019-12-22 01:06:22
问题 I have a texture in my application and I can drag it using finger but how can I set a onTouch Listener for the texture, when I touch anywhere of the phone screen the texture move to where I touch, how can I make it only move when finger touch the texture? Any guidance will be appreciated~ this is my main class: import android.app.Activity; import android.os.Bundle; import android.view.WindowManager; public class MainActivity extends Activity { private Stage stage; @Override public void

Android OpenGL ES display image fullscreen with aspect ratio

↘锁芯ラ 提交于 2019-12-22 00:51:03
问题 I want to display an image fullscreen in my OpenGL app without losing its aspect ratio. I know that I can draw an image as a texture onto a "cube" or 2d plane. But I'm not sure if this is really the best way when I just simply want to show a 2d image. Espcially because I want this image to be fullscreen without losing its aspect ratio. I know this is easy with an ImageView. But I need this in my OpenGL ES application. But I have no clue how to do this. Anyone any idea? 回答1: Since the aspect

How to change canvas size in OpenGL? glClearColor is only painting a small box

对着背影说爱祢 提交于 2019-12-22 00:15:55
问题 When I run the following open gl command, it only paints the bottom left part of the ipad screen red. glClearColor(255.0f, 0.0f, 0.0f, 0.0f); How do I make it so the whole screen gets painted red? Thanks! 回答1: You probably haven't set the framebuffer to the correct size. If you are on an iPhone 4, the most common mistake is to use the reported view dimensions, which are the same as for the earlier models, even though the iPhone 4 has twice the resolution. Here's how I do it in my app

Android VR Toolkit - HeadTransform getHeadView matrix representation

社会主义新天地 提交于 2019-12-22 00:13:15
问题 I'm starting with Android VR-Toolkit for google cardboard. I use the sample at google website: https://developers.google.com/cardboard/get-started I new with openGL and try to figure out how the values are represented by the system. For example HeadTransform.getHeadView set a 4x4 matrix and according to the documentation: A matrix representing the transform from the camera to the head. Head origin is defined as the center point between the two eyes. My question is what represents every value

How do I convert 3D OpenGL matrix transforms to CoreAnimation CATransform3Ds?

可紊 提交于 2019-12-21 23:33:32
问题 Picture an OpenGL ES 1.1 rendering surface with a transparent CALayer of the same frame and bounds directly above it. Objects in the OpenGL scene are transformed (translated and rotated) using a 4x4 matrix. The overlayed CALayer transforms sublayers with a CATransform3D (which happens to be a 4x4 matrix, identical to ones used for OpenGL transforms). The OpenGL matrices transform the scene objects in exactly the manner I would like them to. I would then like to take the same matrix transform

GLSL shader for texture 'smoke' effect

落花浮王杯 提交于 2019-12-21 23:12:22
问题 I've looked around and haven't found anything relevant. I'm tyring to create a shader to give a texture smoke effect animation like here: Not asking for a complete/full solution (although that would be awesome) but any pointers towards where I can get started to achieve this effect. Would i need to have the vertices for the drawing or is this possible if I have the texture only? 回答1: In the example pictured it appears as if they have the vertices. Possibly the "drawing" of the flower shape

Transparent objects in OpenGl ES 2.0

折月煮酒 提交于 2019-12-21 21:56:36
问题 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

Coloring rectangle in function of distance to nearest edge produces weird result in diagonals

北战南征 提交于 2019-12-21 21:37:18
问题 I'm trying to color a rectangle in ShaderToy/GLSL in function of each pixel's distance to the nearest rectangle edge. However, a weird (darker) result can be seen on its diagonals: I'm using the rectangle UV coordinates for it, with the following piece of code: void mainImage( out vec4 fragColor, in vec2 fragCoord ) { // Normalized pixel coordinates (from 0 to 1) vec2 uv = fragCoord/iResolution.xy; vec2 uvn=abs(uv-0.5)*2.0; float maxc=max(uvn.y,uvn.x); vec3 mate=vec3(maxc); fragColor = vec4