opengl-es

Diffuse shader for OpenGL ES 2.0: Light changes with camera movement (Vuforia on Android)

烂漫一生 提交于 2019-12-10 16:03:25
问题 As a starting point I use the Vuforia (version 4) sample called MultiTargets which tracks a 3d physical "cube" in the camera feed and augments it with yellow grid lines along the cube edges. What I want to achieve is remove the textures and use diffuse lighting on the cube faces instead, by setting my own light position. I want to do this on native Android and I do NOT want to use Unity. It's been a hard journey of several days of work and learning. This is my first time working with OpenGL

WebGL : How do make part of an object transparent?

别来无恙 提交于 2019-12-10 15:55:38
问题 I have a 3D ball in the browser , now I want to dig a hole on it to see its back. How can I make it possiable ? For example, I want the white triangle part of the cube could be transparent(I mean we could see the background behind the cube). I've tried to change the alpha in fragment shader(the area in the code is a square not triangle, doesn't matter): <script id="shader-fs-alpha" type="x-shader/x-fragment"> precision mediump float; varying vec4 vColor; uniform float uAlpha; void main(void)

AndEngine: collision of two sprites

旧城冷巷雨未停 提交于 2019-12-10 15:54:07
问题 I am developing a small Android game. Before I started using AndEngine, I used the Canvas object and draw everything on it. For testing if two bitmaps collides with each other I checked if their bounding boxes overlap. In case of this, I checked if the overlapping rectangle of both bitmaps got one none transparent pixel in common. This method worked perfektly and I was able to detect pixel perfect collisions. Because of some performance issues I started using AndEngine. Collision detection

Spritekit: First texture draw slow (preloaded)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 15:39:16
问题 I'm having a performance issue regarding Apple Spritekit Framework. I use the method preloadTextureAtlases:withCompletionHandler: of SKTextureAtlas to make sure all my textures are loaded before the game really starts. Yet when the first texture of this atlas (whatever it is) is added to the scene as a child I got a small lag, like if the texture wasn't loaded. It only happens the first time . I tried real hard to debug this and to find the reason but I couldn't find it. Looking with

Opengl shader problems - weird light reflection artifacts

我怕爱的太早我们不能终老 提交于 2019-12-10 14:56:31
问题 I've been wrestling with this for days. I think I've finally narrowed it down to a problem with the per vertex tangents, but I'm not sure the best way to fix it. Context is iPhone app, opengl es2 using my own engine. My shader is a bump map (normal map) variety using the supplied per vertex tangent to create a TBN matrix. The vertex shader transforms the light vectors and eye vectors to tangent space, passes them to the fragment shader and calculates the lights. But some geometry in my first

Drawing Straight Lines with Finger on iPhone

99封情书 提交于 2019-12-10 14:55:51
问题 Background: I am trying to create a really simple iPhone app that will allow the user to draw multiple straight lines on the screen with their finger. I'm using these two methods in my UIViewController to capture the coordinates of each line's endpoints. - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event Question: I would like the line to show up as soon as touchesEnded has fired and then keep drawing more lines on

Why isn't GLsizei defined as unsigned?

爱⌒轻易说出口 提交于 2019-12-10 14:37:30
问题 I was looking up the typedef of GLsizei for the OpenGL ES 1.1 implementation on iOS, and was surprised to find that it was defined as an int . Some quick googling showed that this is normal. (Including on normal OpenGL.) I was expecting that it would be defined as an unsigned int or size_t . Why is it defined as just a vanilla int ? 回答1: It seems unlikely to be a problem, unless you have any 4GB data structures kicking around. Here's someone's answer: http://oss.sgi.com/archives/ogl-sample

Android source code not working, reading frame buffer through glReadPixels

夙愿已清 提交于 2019-12-10 13:48:02
问题 I am new to Android development and have an assignment to read frame buffer data after a specified interval of time. I have come up with the following code: public class mainActivity extends Activity { Bitmap mSavedBM; private EGL10 egl; private EGLDisplay display; private EGLConfig config; private EGLSurface surface; private EGLContext eglContext; private GL11 gl; protected int width, height; //Called when the activity is first created. @Override public void onCreate(Bundle

Translation after rotation

北城以北 提交于 2019-12-10 13:43:56
问题 I'm using OpenGL ES 2.0 for Android. I'm translating and rotating a model using the touch screen. My translations are only in the (x, y) plane, and my rotation is only about the z-axis. Imagine looking directly down at a map on a table and moving to various coordinates on the map, and being able to rotate the map around the point you are looking at . The problem is that after I rotate, my subsequent translations are to longer matched to the motions of the pointer on the screen, the axes are

GLSurfaceView onDrawFrame clearing behavior

家住魔仙堡 提交于 2019-12-10 13:24:41
问题 I ran into different behaviors with the GLSurfaceView. AFAIK it is the responsibility of the program to clear the buffer (color and depth ) each frame. Which means that if I don't clear the buffer I get the content of the last frame ( or the one before that for double buffering ). It seems though as if the buffer is cleared no matter what on some devices. I ran the following modification of the "Hello Triangle" program from the Addison Wesley OpenglES2.0 Programming Guide on some test devices