Graphics.DrawTexture does not work on mobile?

Hi, still trying to get the Graphics.DrawTexture working. I’ve noticed that Graphics.DrawTexture method doesn’t draw anything to a RenderTexture on my Android testing devices. It does work without problems in the Windows Editor though.

Graphics.Blit to my RenderTexture interestingly works.

And no, I can’t use GUI.DrawTexture… (seemed to be the most popular advice in the past).

I’ve filed a bug but hope to find answers here before because this is kind of a show stopper for me.

Thanks
Ben

Edit: I found a post of someone using the Graphics.DrawTexture method with a Rect defined as (-1,-1,2,2) even though the docs state

With this setting the texture is drawn to my RT even on my mobile device. BUT I don’t want to draw “fullscreen” or to the whole texture but to a defined Rectangle like it should be able according to the manual. Weird.

Ok, embarassingly enough, I’ve solved this conundrum myself now. More research helped me understand that RenderTexture.active somehow needs its own pixel matrix and in order to make it work one should do the following:

RenderTexture.active = renderTexture;
GL.PushMatrix();
GL.LoadPixelMatrix();
Graphics.DrawTexture(…);
GL.PopMatrix();
RenderTexture.active = null;

Then DrawTexture accepts pixel coordinates like expected. Phew…

Ben

tank’s i have strange thinks result but it’s works now