void rsMatrixRotate(rs_matrix4x4 *m, float rot, float x, float y, float z)
Modify RenderScript.rs of last exercise "Draw circle in Android RenderScript".
//declare RendorScript Version
#pragma version(1)
//declare package
#pragma rs java_package_name(com.exercise.AndroidRenderScript);
//include graphics library
#include "rs_graphics.rsh"
rs_mesh my_rs_mesh;
float rotation;
void init(){
rotation = 0.0f;
}
int root(){
//set background color
rsgClearColor(0.0f, 0.0f, 0.0f, 0.0f);
//Transform something
rs_matrix4x4 matrix;
rsMatrixLoadIdentity(&matrix);
rsMatrixTranslate(&matrix, 100.0f, 100.0f, 0.0f);
rsMatrixRotate(&matrix, rotation++, 1.0f, 1.0f, 1.0f);
rsgProgramVertexLoadModelMatrix(&matrix);
//draw something
rsgDrawMesh(my_rs_mesh);
//repeat 20ms
return 20;
}
![3D rotate for RenderScript - rsMatrixRotate() thumbnail](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSIcsNuN2mJazot4SujH7vv5QoLvomRT-oscNE9UkRcv5sS7A8oHd6y4VX1Pm3zJMe6-Q4WkrQsE443HEqFlWNgMKEvA4CZHciymHTcbLp7C36DVLpaI-Phbg50eY8824snSrUHCx5saPV/s72-c/AndroidRenderScript_03_rotate_3D.png)
Title: 3D rotate for RenderScript - rsMatrixRotate()
Rating: 100% based on 99998 ratings. 10 user reviews.
Post by 4:11 AM
Rating: 100% based on 99998 ratings. 10 user reviews.
Post by 4:11 AM
0 comments:
Post a Comment