opengl-es

Opengl ES, issue while rendering close by objects

穿精又带淫゛_ 提交于 2019-12-06 11:28:27
I am working with opengl es on android. I have a 3d humanoid model on which i can put a hairstyle which is another 3d model. While rendering i could find that on the area where the two objects are very close/coincides (the head-hair region) the rendering is not proper, in fact i get different results on different mobile devices. I doubt it is z-fighting. Are there some solution for rendering close by objects properly with opengl es which will be consistent across all mobile devices. I have attached a snapshot for reference. Here i have a face model on which i have placed a hair model but

OpenGL ES 2.0 Context in Android

痴心易碎 提交于 2019-12-06 11:23:46
I'm new to OpenGL on Android and I have read heavily documented samples, and I kinda understand it. But before trying to do anything complex, I want to draw a simple 2D white rectangle on a black bacground. Nothing else. I'm stuck at this error: call to OpenGL ES API with no current context , which seems to be that I'm calling something from the non-OpenGL Thread . The thing is that I'm not sure what is called from the OpenGL Thread . So here's my code //============== Activity ==================// public class MainActivity extends Activity { public static String TAG = MainActivity.class

Cocos2d - apply GLImageProcessing effect to CCSprite

烂漫一生 提交于 2019-12-06 11:11:06
问题 Apple's oplengl GLImageProcessing loads an image and applies image adjustments: brightness, saturation, contrast, hue and sharpness. How can GLImageProcessing be used on a CCSprite? Any help would be appreciated! Update: Cocos2d v2 has shader support. For Image Effects look up GLSL shader called Photoshop Math. 回答1: I've applied approach from GLImageProcessing to change the hue of CCSpite and wrote a subclass of CCSprite for convenient usage. Check this out: https://github.com/alex314

SpriteKit and UIKit compatibility: OpenGL error when migrating to Swift 2?

橙三吉。 提交于 2019-12-06 10:57:02
I just don't understand what is going on since I migrated to Swift 2. I have a Tabbed application and I am getting this error: <CAEAGLLayer: 0x7fb2e053fb40>: calling -display has no effect. Assertion failed: (length + offset <= _length), function commit_data, file /BuildRoot/Library/Caches/com.apple.xbs/Sources/Jet_Sim/Jet-1.50/Jet/jet_types_OpenGL.h, line 863. I know it is really vague but I don't know where to start looking for bugs. Thanks. Edit: I just realized it might be related to the fact that I am trying to embed a GameViewController into the TabbedController. However, it did not

android - How do I draw a wireframe over object in opengl 2.0?

自古美人都是妖i 提交于 2019-12-06 10:24:22
I have a tetrahedron object created in openGL ES 2.0. What I'm trying to achieve is to show the actual wireframe of the polygon over its base color. Is there a method for achieving this effect? Also, my tetrahedron is pink. How can I change its color? In addition to what Jave said. Instead of enlarging the whole object (whose optimal amount always depends on the object and the current view) to prevent z-fighting artefacts, you can also use the polygon offset (using glPolygonOffset ), whose major application are indeed wireframe overlays. It basically works by slightly adjusting the depth

In opengl, How can I get relation between pixels and gl.gltranslatef(floatx,y,z)?

别等时光非礼了梦想. 提交于 2019-12-06 10:23:57
I am trying to learn opengl stuff on Android. In the gl.gltranslatef(x,y,z) call, I am shifting my texture by some units in the +ve x direction. But I am unable to find the number of pixels does 1 unit of x belong to? Here is what I am doing: I call gl.glviewport(0,0,width,height); // This will set my rectangle with 0,0 as lowerleft corner and then extend it to accommodate width and height. Then I call to gl.glfrustrum(-5,5,-7,7,3,7); // I am little confused how this call is using the dimensions I set in gl.glviewport. How will -5 to 5 units from left to right in the above call, translate to

OpenGL ES 2.0 Shader - 2D Radial Gradient in Polygon

北战南征 提交于 2019-12-06 09:27:50
问题 I am trying to paint a radial gradient inside a Polygon. My Stage is 600x320 . I am able to draw a gradient but it`s 'distorted/streched'. The goal is a gradient like a light would produce. u_lightPosition is passed as a relative value : {0.5, 0.5} . Currently unused lightPositionAbsolute is passed in as absolute value {300.0, 160.0} . My fragment-shader currently looks like this: #ifdef GL_ES precision lowp float; #endif varying vec4 v_fragmentColor; uniform vec2 u_lightPosition; uniform

OpenGL ES: Rotating 3d model around itself

天涯浪子 提交于 2019-12-06 09:08:57
I'm playing with OpenGL ES on iPhone and I'm trying to rotate a model by panning with the finger. I discovered the open source app Molecules that let's you do that and I'm looking at that code, but when it comes to rotate a model of mine I'm able to rotate it only around a point distant in the space (like it was in orbit as a satellite and I am the fixed planet). Any suggestion on what can be wrong? I can post the code later , maybe on demand (many lines) For the most part refer to Molecules you can find it here MOLECULES If my memory serves me correctly, I think you need to translate the

Eraser in OpenGL ES iphone

寵の児 提交于 2019-12-06 08:59:21
问题 i have two images which are overlapping on each other.(the way in which cards are placed on top of each other) now if i move my finger over the top most image that portion of the image should become transparent.(opacity of that part should become 0). i am new to OpenGL ES development. kindly help me out or give me any suggestion to complete this functionality. Thanks in advance 回答1: You're going to need render-to-texture using Framebuffer Objects (FBOs). Render to the desired texture, but

How do I use the Android compass orientation to aim an opengl camera?

被刻印的时光 ゝ 提交于 2019-12-06 08:53:09
问题 I'm using libgdx to develop a basic 3d game for android and I'm having difficulty properly orienting the camera given three rotation angles provided from the compass (azimuth - rotation about Z, roll - rotation about Y, pitch - rotation about X). I've had some slight success with the following code in that I can properly aim the virtual camera down the Z-axis and X-axis as I expected. (Angles are in degrees [-180,180]) camera.direction.x = 0; camera.direction.y = 0; camera.direction.z = 1;