mail-archives/monodroid/2011-December/007511.html

97 строки
4.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [mono-android] Handling texture loss in OpenTK on mono for android
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Handling%20texture%20loss%20in%20OpenTK%20on%20mono%20for%0A%09android&In-Reply-To=1322980346644-5045738.post%40n5.nabble.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="007478.html">
<LINK REL="Next" HREF="007513.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[mono-android] Handling texture loss in OpenTK on mono for android</H1>
<B>chris@Terrago</B>
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Handling%20texture%20loss%20in%20OpenTK%20on%20mono%20for%0A%09android&In-Reply-To=1322980346644-5045738.post%40n5.nabble.com"
TITLE="[mono-android] Handling texture loss in OpenTK on mono for android">cdrake at terragotech.com
</A><BR>
<I>Mon Dec 5 16:03:59 EST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="007478.html">[mono-android] Handling texture loss in OpenTK on mono for android
</A></li>
<LI>Next message: <A HREF="007513.html">[mono-android] Handling texture loss in OpenTK on mono for android
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7511">[ date ]</a>
<a href="thread.html#7511">[ thread ]</a>
<a href="subject.html#7511">[ subject ]</a>
<a href="author.html#7511">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Warren
This sounds like a problem I was having a few months ago. It would be nice
to have a little more detail on how you are setting up your rendering
through AndroidGameView, but I will make a few assumptions and hopefully
this information will be useful to you.
I am assuming that you have set up an AndroidGameView with a run loop that
is started in the handler for an OnLoad event. You probably also have some
kind of OO framework to handle initializing OpenGL textures (among other
renderable objects) such that they can be drawn later in response to
OnRenderFrame events without the need to reconstruct them each time. If this
is at all similar to your approach, there are two issues you need to be
aware of:
1. AndroidGameView maintains a Graphics context that is destroyed any time
the view is paused. The graphics context maintains references to various
resources such as textures, framebuffers, buffers, renderbuffers, shaders,
and program contexts. *When the graphics context is destroyed the GPU will
also destroy any resources associated with it.* This is normal behavior and
is documented on the OpenTK site. So to handle this you will need to make
sure that you have a way to signal a context change (do this upon your
activity resuming) to your renderer so that it can remove any cached
references to resources the GPU has deleted and then recreate them.
2. When the graphics context is destroyed in response to a screen rotation
or when the device sleeps it is never recreated. I am assuming that there is
a problem with the recreation of the SurfaceView because you never get
another OnLoad event. This is apparently a known bug although I can't dig up
a link at the moment. Unfortunately, I have not found a way around this
problem that works consistently.
I hope this helps. If not, give me a little more detail about your setup and
I'll see what I can do.
Chris
--
View this message in context: <A HREF="http://mono-for-android.1047100.n5.nabble.com/Handling-texture-loss-in-OpenTK-on-mono-for-android-tp5045738p5050146.html">http://mono-for-android.1047100.n5.nabble.com/Handling-texture-loss-in-OpenTK-on-mono-for-android-tp5045738p5050146.html</A>
Sent from the Mono for Android mailing list archive at Nabble.com.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="007478.html">[mono-android] Handling texture loss in OpenTK on mono for android
</A></li>
<LI>Next message: <A HREF="007513.html">[mono-android] Handling texture loss in OpenTK on mono for android
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7511">[ date ]</a>
<a href="thread.html#7511">[ thread ]</a>
<a href="subject.html#7511">[ subject ]</a>
<a href="author.html#7511">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/monodroid">More information about the Monodroid
mailing list</a><br>
</body></html>