修复Object3D后视图上的文本镜像

时间:2017-07-27 06:52:26

标签: android canvas opengl-es android-bitmap google-project-tango

我的课程延伸$date = date('Y-m-d H:i:s', '2017-07-27 05:00'); if(x_seconds($date)): print "Is within 30 minutes."; else: print "IS NOT within 30 minutes"; endif;

从活动中调用类中的以下函数:

Renderer(org.rajawali3d.renderer.Renderer)

我需要因子public void makeText(float[] openGLPpoint, int color, String text,float depth) { double adjust_angle_o = 0; Material mSphereMaterial = new Material(); Bitmap bitmap= setTextInImage(text); Texture t = new Texture("text",bitmap); mSphereMaterial.addTexture(t); Object3D object3D = new Plane(0.3f,0.1f,100,100); object3D.setMaterial(mSphereMaterial); object3D.setDoubleSided(true); object3D.setColor(color); if(!depth >= 1) { adjust_angle_o = 0.2; } object3D.setPosition(openGLPpoint[0], openGLPpoint[1], openGLPpoint[2]-adjust_angle_o); getCurrentScene().addChild(object3D); } public Bitmap setTextInImage(String text){ Bitmap src = BitmapFactory.decodeResource(mContext.getResources(),R.drawable.label_bg_sm); Bitmap dest = Bitmap.createBitmap(src.getWidth(), src.getHeight(), Bitmap.Config.ARGB_8888); Canvas cs = new Canvas(dest); Paint tPaint = new Paint(); tPaint.setTextSize(50 * mContext.getResources().getDisplayMetrics().density); tPaint.setColor(Color.GREEN); tPaint.setStyle(Paint.Style.FILL_AND_STROKE); tPaint.setFakeBoldText(true); cs.drawBitmap(src, 0f, 0f, null); float height = tPaint.measureText("yY"); float width_o = tPaint.measureText(text+" m"); float x_coord = (src.getWidth() - width_o)/2; // 15f is to put space between top edge and the text cs.drawText(text+" m", x_coord, height+15f, tPaint); return dest; } ,这是正常的。

从正面看时文字是正确的,但是当从后面看到物体时,文字自然会反映出来。

以下是快照:

Mirrored text observed from rear view

如何修正文本,因为它应该可以从前视图和后视图中读取?任何修复文本镜像的文章?

1 个答案:

答案 0 :(得分:0)

我想通了,object3D.setDoubleSided(false)创建了一个重复的对象并在y轴上旋转了180。它现在工作正常。

编辑:旋转的一面显示为原始的暗。增加alpha不起作用。任何人都可以进一步指导吗