When your handset requires a debugger to be attached for release version apk,
reboot the handset :
simple verts lister for Blender
Warning:
This code must be executed under Edit mode.
import bpy import bmesh def up(v): for e in v.link_edges: ov = e.other_vert(v) if ov not in verts: verts.append(ov) up(ov) print(v.co.x, ",", v.co.y, ",", v.co.z, "," ) def down(v): print(v.co.x, ",", v.co.y, ",", v.co.z, "," ) for e in v.link_edges: ov = e.other_vert(v) if ov not in verts: verts.append(ov) down(ov) obj = bpy.context.active_object bm = bmesh.from_edit_mesh(obj.data) verts = [] def main(): v0 = bm.verts[0] verts.append(v0) e0 = v0.link_edges u = e0[0].other_vert(v0) verts.append(u) up(u) print(v0.co.x, ",", v0.co.y, ",", v0.co.z, "," ) if len(e0)>1: d = e0[1].other_vert(v0) verts.append(d) down(d)
render to texture in OpenGL ES
The key is glFramebufferTexture2D in creating FBO. The image is rendered to the bound image buffer through the attachment point.
/* texId[0] = texture from resource file texId[3] = texture on the fly in Frame Buffer 1 */ ///////////////////////// void initRenderTexFbo(){ // FBO glGenFramebuffers(1, fboId); glBindFramebuffer(GL_FRAMEBUFFER, fboId); // texture glGenTextures(1, &texId[3]); glBindTexture(GL_TEXTURE_2D, texId[3]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fboWidth, fboHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); // Framebuffer Texture glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texId[3], 0); GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT0}; glDrawBuffers(1, DrawBuffers); // RBO glGenRenderbuffers(1, &rboId); glBindRenderbuffer(GL_RENDERBUFFER, rboId); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, fboWidth, fboHeight); // back to default glBindFramebuffer(GL_FRAMEBUFFER, 0); } ///////////////////////// void render_to_FrameBuffer1(){ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, pFooGlInfo->fboId); glActiveTexture(GL_TEXTURE0 + texUnit); glBindTexture(GL_TEXTURE_2D, pFooGlInfo->texId[0]); glBindVertexArray(id_vao); glUseProgram(shaderProgramId); glClearColor(1.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); // ... glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idbIdx); glDrawElements(type, idx_n, GL_UNSIGNED_SHORT, NULL); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindVertexArray(0); } ///////////////////////// void render_from_FrameBuffer1(){ glBindVertexArray(id_vao); glUseProgram(shaderProgramId); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glActiveTexture(GL_TEXTURE0 + texUnit); glBindTexture(GL_TEXTURE_2D, texId[3]); // ... glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idbIdx); glDrawElements(type, idx_n, GL_UNSIGNED_SHORT, NULL); glBindVertexArray(0); }
How to sign an Android app for Google Play
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore [path]/key.keystore app-unsigned.apk keyNameAlias
zipalign -v 4 app-unsigned.apk app-signed.apk
simple verts detection on a line
import bpy import bmesh obj = bpy.context.scene.objects.active m = obj.data bm = bmesh.new() bm.from_mesh(m) bm.verts.index_update() verts = [] # [6] [12] are examples firstV = bm.verts[6] secondV = bm.verts[12] verts.append(firstV) verts.append(secondV) for v in bm.verts: for e in v.link_edges: vv = e.other_vert(v) print(v.index, obj.matrix_world *v.co, vv.index) def findGrandChild(v, vv): for e in vv.link_edges: vvv = e.other_vert(vv) if vvv.index != v.index: if vvv.index == firstV.index: break verts.append(vvv) findGrandChild(vv, vvv) findGrandChild(firstV, secondV) for x in verts: x.index # show results # do not forget matrix_world for x in verts: print(x.index, obj.matrix_world * x.co) for x in verts: print(x.index, obj.matrix_world * x.normal)
How to Export Mesh Vertices
import bpy obj = bpy.data.objects['Plane.001'] for x in obj.data.vertices: obj.matrix_world * x.co
Depth Test vs Alpha Texture in OpenGL
While depth test enabled and overlay object has transparent-texture, underling object should be drawn first.