opengl-es

how to create Duval Triangle in canvas

自闭症网瘾萝莉.ら 提交于 2019-12-18 03:45:20
问题 I need to create a triangle which called a duval triangle. It looks like this: I need to do it with canvas. so far I succeed to create a triangle. But I don't know how to color it up and how to divide the area inside the triangle into a different colors like in the picture. Can I do such thing in canvas, is it possible to create duval triangle in canvas. Any help is blessed :). The code so far: var triangle = document.getElementById("triangle"); var ctx = triangle.getContext("2d"); var cw =

Writing texture data onto depth buffer

☆樱花仙子☆ 提交于 2019-12-18 03:41:56
问题 I'm trying to implement the technique described at : Compositing Images with Depth. The idea is to use an existing texture (loaded from an image) as a depth mask, to basically fake 3D. The problem I face is that glDrawPixels is not available in OpenglES. Is there a way to accomplish the same thing on the iPhone? 回答1: The depth buffer is more obscured than you think in OpenGL ES; not only is glDrawPixels absent but gl_FragDepth has been removed from GLSL. So you can't write a custom fragment

Android OpenGL 3D picking

倖福魔咒の 提交于 2019-12-18 02:54:50
问题 I'm on Android OpenGL-ES 2.0 and after all the limitations that come with it, I can't figure out how to take 2D screen touches to the 3D points I have. I can't get the right results. I'm trying to implement shooting a ray into the point cloud, which I can then compare distances of my points to the ray, finding the closest point. public class OpenGLRenderer extends Activity implements GLSurfaceView.Renderer { public PointCloud ptCloud; MatrixGrabber mg = new MatrixGrabber(); ... public void

Is it possible to render an Android View to an OpenGL FBO or texture?

我的梦境 提交于 2019-12-18 02:47:41
问题 Is it possible to render a View (say, a WebView) to an FBO so it can be used as a texture in an OpenGL composition? 回答1: Yes is it certainly possible, I have written up a how-to here; http://www.felixjones.co.uk/neo%20website/Android_View/ However for static elements that won't change, the bitmap option may be better. 回答2: The complete demo project which renders a view to GL textures in real time in an efficient way can be found in this repo. It shows how to render WebView to GL texture in

Transitioning from OpenGL ES 1.1 to OpenGL ES 2.0

无人久伴 提交于 2019-12-18 01:18:14
问题 It's been a while since iPhone 3GS came out, and now there might be enough market share of OpenGL ES 2.0 supporting devices to warrant developing in it. But the situation is a lot of developers probably already have huge code bases in OpenGL ES 1.1 How does one transitionf rom ES 1.1 to ES 2.0? I suppose the matrices need to be taken care of, as well as stuff like GL_FOG, GL_CULL maybe? Is it possible to write "substitutes" for these functions, e.g your own glTranslatef, glPushmatrix etc?

Fighting with SurfaceView, Camera and OpenGL

大兔子大兔子 提交于 2019-12-17 23:45:11
问题 We've been fighting with some problems relating to SurfaceViews for more than a week, and find no proper solution to them. We read the other questions in the forum regarding to similar problems (and even Mixare source code) but couldn't find an answer, so we hope you could help us somehow. Scenario: We've got a SurfaceView for the Camera a SurfaceView for an OpenGL layer, which goes on top of the camera. another View, which shows some information about what we can see on the screen. This one

OpenGL ES - texture map all faces of an 8 vertex cube?

家住魔仙堡 提交于 2019-12-17 21:59:41
问题 Working through some OpenGL-ES tutorials, using the Android emulator. I've gotten up to texture mapping and am having some trouble mapping to a cube. Is it possible to map a texture to all faces of a cube that has 8 vertices and 12 triangles for the 6 faces as described below? // Use half as we are going for a 0,0,0 centre. width /= 2; height /= 2; depth /= 2; float vertices[] = { -width, -height, depth, // 0 width, -height, depth, // 1 width, height, depth, // 2 -width, height, depth, // 3

Clipping-planes in OpenGL ES 2.0

北城余情 提交于 2019-12-17 21:57:14
问题 I need to clip a few hundred objects under a clipping plane in OpenGL ES 2.0 and would appreciate ideas from people more experienced with this subset of OpenGL. In OpenGL ES 1.x there is glClipPlane. On the desktop you have glClipPlane, or gl_ClipDistance in your shader. Neither of these two are available in OpenGL ES 2.0. It seems that this kind of functionality disappeared completely with 2.0. It seems the only way to do this is either A) run the plane equation in the fragment shader, or B)

Using shader modifiers to animate texture in SceneKit leads to jittery textures over time

爷,独闯天下 提交于 2019-12-17 20:39:55
问题 I'm writing a scene in SceneKit for iOS. I'm trying to apply a texture to an object using a sprite sheet. I iterate through the images in that sheet with this code: happyMaterial = [SCNMaterial new]; happyMaterial.diffuse.contents = happyImage; happyMaterial.diffuse.wrapS = SCNWrapModeRepeat; happyMaterial.diffuse.wrapT = SCNWrapModeRepeat; happyMaterial.shaderModifiers = @{ SCNShaderModifierEntryPointGeometry : @"_geometry.texcoords[0] = vec2((_geometry.texcoords[0].x+floor(u_time*30.0))/10

How to get rid of Jagged edges in Android OpenGL ES?

﹥>﹥吖頭↗ 提交于 2019-12-17 20:38:52
问题 I have the following code: public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); gl.glShadeModel(GL10.GL_SMOOTH); gl.glClearDepthf(1.0f); gl.glEnable(GL10.GL_DEPTH_TEST); gl.glDepthFunc(GL10.GL_LEQUAL); //gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST); } public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); But