Java 类android.renderscript.RenderScriptGL 实例源码

项目:intellij-ce-playground    文件:BallsView.java   
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
    super.surfaceChanged(holder, format, w, h);
    if (mRS == null) {
        RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
        mRS = createRenderScriptGL(sc);
        mRS.setSurface(holder, w, h);
        mRender = new BallsRS();
        mRender.init(mRS, getResources(), w, h);
    }
    mRender.updateProjectionMatrices();
}
项目:intellij-ce-playground    文件:BallsView.java   
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
    super.surfaceChanged(holder, format, w, h);
    if (mRS == null) {
        RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
        mRS = createRenderScriptGL(sc);
        mRS.setSurface(holder, w, h);
        mRender = new BallsRS();
        mRender.init(mRS, getResources(), w, h);
    }
    mRender.updateProjectionMatrices();
}
项目:sophia    文件:CarouselView.java   
private void ensureRenderScript() {
    if (mRS == null) {
        RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
        if (USE_DEPTH_BUFFER) {
            sc.setDepth(16, 24);
        }
        mRS = createRenderScriptGL(sc);
    }
    if (mRenderScript == null) {
        mRenderScript = new CarouselRS(mRS, mContext.getResources(),
                getRenderScriptInfo().resId);
        mRenderScript.resumeRendering();
    }
    mController.setRS(mRS, mRenderScript);
}
项目:Curve3d    文件:FallingSnowView.java   
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
    super.surfaceChanged(holder, format, w, h);

    if (mRSGL == null) {
        RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
        mRSGL = createRenderScriptGL(sc);
        mRSGL.setSurface(holder, w, h);
        mRender = new SnowRS(w, h);
        mRender.init(mRSGL, getResources(), false);
        mRender.start();
    }
}
项目:intellij-ce-playground    文件:BallsRS.java   
public void init(RenderScriptGL rs, Resources res, int width, int height) {
    mRS = rs;
    mRes = res;

    ProgramFragmentFixedFunction.Builder pfb = new ProgramFragmentFixedFunction.Builder(rs);
    pfb.setPointSpriteTexCoordinateReplacement(true);
    pfb.setTexture(ProgramFragmentFixedFunction.Builder.EnvMode.MODULATE,
                       ProgramFragmentFixedFunction.Builder.Format.RGBA, 0);
    pfb.setVaryingColor(true);
    mPFPoints = pfb.create();

    pfb = new ProgramFragmentFixedFunction.Builder(rs);
    pfb.setVaryingColor(true);
    mPFLines = pfb.create();

    android.util.Log.e("rs", "Load texture");
    mPFPoints.bindTexture(loadTexture(R.drawable.flares), 0);

    mPoints = new ScriptField_Point(mRS, PART_COUNT, Allocation.USAGE_SCRIPT);

    Mesh.AllocationBuilder smb = new Mesh.AllocationBuilder(mRS);
    smb.addVertexAllocation(mPoints.getAllocation());
    smb.addIndexSetType(Mesh.Primitive.POINT);
    Mesh smP = smb.create();

    mPhysicsScript = new ScriptC_ball_physics(mRS, mRes, R.raw.ball_physics);

    mScript = new ScriptC_balls(mRS, mRes, R.raw.balls);
    mScript.set_partMesh(smP);
    mScript.set_physics_script(mPhysicsScript);
    mScript.bind_point(mPoints);
    mScript.bind_balls1(new ScriptField_Ball(mRS, PART_COUNT, Allocation.USAGE_SCRIPT));
    mScript.bind_balls2(new ScriptField_Ball(mRS, PART_COUNT, Allocation.USAGE_SCRIPT));

    mScript.set_gPFLines(mPFLines);
    mScript.set_gPFPoints(mPFPoints);
    createProgramVertex();

    mRS.bindProgramStore(BLEND_ADD_DEPTH_NONE(mRS));

    mPhysicsScript.set_gMinPos(new Float2(5, 5));
    mPhysicsScript.set_gMaxPos(new Float2(width - 5, height - 5));

    mScript.invoke_initParts(width, height);

    mRS.bindRootScript(mScript);
}
项目:sophia    文件:CarouselController.java   
public void setRS(RenderScriptGL rs, CarouselRS renderScript) {
    mRS = rs;
    mRenderScript = renderScript;
}
项目:Curve3d    文件:RenderScriptScene.java   
public void init(RenderScriptGL rs, Resources res, boolean isPreview) {
    mRS = rs;
    mResources = res;
    mPreview = isPreview;
    mScript = createScript();
}
项目:Curve3d    文件:RenderScriptScene.java   
public RenderScriptGL getRS() {
    return mRS;
}