Android NDK暂停/恢复的hello-gl2示例是否正确?(Is hello-gl2 example from Android NDK pause/resume correct?)
题:
考虑到Android NDK r6b的hello-gl2示例,当用户反复调用GLSurfaceView的暂停/恢复操作时,此示例是否正确? 我问,因为每次调用GL2JNIView.Renderer.onSurfaceChanged()时,它都会创建所有OpenGL资源(着色器,纹理)但它永远不会破坏它们。
背景:
我正在尝试调试一些使用C ++和JNI实现的OpenGL ES 2.0游戏,这些游戏在暂停/恢复期间表现不正确。 我试图找到一些参考示例,但我没有找到任何除了NDK提到的hello2-gl示例,可能恕我直言创建内存泄漏, 这个更复杂的版本,我目前正在使用,但是在GLSurfaceView完成其onPause()方法之前,似乎OpenGL上下文被破坏了,我正在销毁绑定到上下文的所有OpengGL着色器和纹理。 您能否指点我使用NDK在Android上使用OpenGL ES 2.0的一些真正正确的例子,关于暂停/恢复OpenGL资源处理的正确方法?
感谢您的帮助。
Question:
Considering the hello-gl2 example from Android NDK r6b, is this example correct when user repeatedly invokes pause/resume actions of the GLSurfaceView? I'm asking because each time a GL2JNIView.Renderer.onSurfaceChanged() is called, it creates all OpenGL resources (shaders, textures) but it never destroys them.
Background:
I'm trying to debug some OpenGL ES 2.0 game implemented using C++ and JNI which behaves incorrectly during pause/resume. I was trying to find some reference example for this but I haven't found any except of the mentioned hello2-gl example from NDK, which may IMHO create memory leaks, and this more complex version of it, which I'm currently using, but where it seems like OpenGL context is destroyed before GLSurfaceView finishes with its onPause() method where I'm destroying all the OpengGL shaders and textures bound to the context. Could you point me to some truly correct example of OpenGL ES 2.0 on Android using NDK concerning the correct way of pause/resume OpenGL resource handling?
Thank you for your help.
原文:https://stackoverflow.com/questions/8040149
最满意答案
您需要使用SqlDataReader ,然后启动循环以读取返回的值
假设ReceiptNO是文本字段,此示例将起作用cn.Open() Dim reader = da2.SelectCommand.ExecuteReader() while reader.Read() textBox1.Text = reader("ReceiptNO").ToString() End While
或者,如果您确定您的查询返回零或只有一条记录而您只对ReceiptNO字段感兴趣,那么您可以使用ExecuteScalar
Dim cmd = New SqlCommand("SELECT RecepitNO FROM Receipt WHERE (PaidFor=@PaidFor AND RegNO=@RegNO)") cmd.Connection = cn cmd.Parameters.Add("@paidFor", SqlDbType.VarChar).Value = cbMonth.Text cmd.Parameters.Add("@RegNO", SqlDbType.Int).Value = lblRegNO.Text cn.Open() Dim result = cmd.ExecuteScalar() if result IsNot Nothing Then textBox1.Text = result.ToString() End If
You need to use a SqlDataReader, and then start a loop to read the values returned
This example will work assuming the ReceiptNO is a text fieldcn.Open() Dim reader = da2.SelectCommand.ExecuteReader() while reader.Read() textBox1.Text = reader("ReceiptNO").ToString() End While
In alternative, if you are sure that your query returns zero or just one record and you are interested only in the ReceiptNO field, then you can use ExecuteScalar
Dim cmd = New SqlCommand("SELECT RecepitNO FROM Receipt WHERE (PaidFor=@PaidFor AND RegNO=@RegNO)") cmd.Connection = cn cmd.Parameters.Add("@paidFor", SqlDbType.VarChar).Value = cbMonth.Text cmd.Parameters.Add("@RegNO", SqlDbType.Int).Value = lblRegNO.Text cn.Open() Dim result = cmd.ExecuteScalar() if result IsNot Nothing Then textBox1.Text = result.ToString() End If
相关问答
更多-
Microsoft SQL Server是什么软件[2022-07-06]
简单的说就是 微软推出的【数据库软件】 Microsoft SQL Server SQL SQL是英文Structured Query Language的缩写,意思为结构化查询语言。SQL语言的主要功能就是同各种数据库建立联系,进行沟通。按照ANSI(美国国家标准协会)的规定,SQL被作为关系型数据库管理系统的标准语言。SQL语句可以用来执行各种各样的操作,例如更新数据库中的数据,从数据库中提取数据等。目前,绝大多数流行的关系型数据库管理系统,如Oracle, Sybase, Microsoft SQL S ... -
使用“编辑顶部200”选项,然后单击“显示SQL面板”,使用WHERE子句修改查询,然后执行查询。 您将能够编辑结果。 Use the "Edit top 200" option, then click on "Show SQL panel", modify your query with your WHERE clause, and execute the query. You'll be able to edit the results.
-
启动SQL SERVER 2005,您可以这样做 USE AdventureWorks; GO WITH OrderedOrders AS ( SELECT SalesOrderID, OrderDate, ROW_NUMBER() OVER (ORDER BY OrderDate) AS 'RowNumber' FROM Sales.SalesOrderHeader ) SELECT * FROM OrderedOrders WHERE RowNumber BETWEEN ...
-
使用+或CONCAT (从SQL Server 2012开始): USE [HRM_MVC_DEV_Test] GO UPDATE p SET FullName = FirstName + ' ' + LastName FROM [dbo].[ProjectWorkers] as p INNER JOIN [dbo].[Employees] as e ON e.EmployeeId = p.WorkerId GO 其他方式: SET FullName = CONCAT(FirstName,' ' ...
-
您需要使用SqlDataReader ,然后启动循环以读取返回的值 假设ReceiptNO是文本字段,此示例将起作用 cn.Open() Dim reader = da2.SelectCommand.ExecuteReader() while reader.Read() textBox1.Text = reader("ReceiptNO").ToString() End While 或者,如果您确定您的查询返回零或只有一条记录而您只对ReceiptNO字段感兴趣,那么您可以使用ExecuteSca ...
-
Microsoft SQL Server BI(Microsoft SQL Server BI)[2022-03-26]
有四个版本的SQL Server(从SQL Server 2017起) - Enterprise,Standard,Web和Express(开发人员是Enterrpise,是免费的(有时有50美元的媒体费用,但不能在生产中使用)。 。 请参阅以下链接https://docs.microsoft.com/zh-cn/sql/reporting-services/reporting-services-features-supported-by-the-editions-of-sql-server-2016?vi ... -
你可以简单地; insert into database2.dbo.table2 (f1, f2, fN) select f1, f2, fN from database1.dbo.table1 where x = y You can simply; insert into database2.dbo.table2 (f1, f2, fN) select f1, f2, fN from database1.dbo.table1 where x = y
-
条件语句中的Microsoft SQL无效列名(Microsoft SQL Invalid Column Name Inside of Conditional Statement)[2023-02-06]
只需包装无法在EXEC ()编译的代码: if (SELECT max(version) FROM DatabaseVersion) < x exec('INSERT INTO DatabaseVersion ....... (Current Version Number, Description of Change)') 这是一张exec执行了超过128个字符代码的图片: 这里是文档的链接: EXECUTE-Transact-SQL Just wrap your code that does not c ... -
select语句正在执行函数dbo.functionToGetAccountType()并将列别名为AccountType 。 它可以重写为: SELECT dbo.functionToGetAccountType() as AccountType FROM AccountLookup The select statement is executing the function dbo.functionToGetAccountType() and aliasing the column as Accou ...
-
问题1 尝试: SELECT deathDate, finalGameDate FROM Players WHERE Convert(datetime,finalGameDate) <= '1990/01/01' AND deathDate Is Not NULL 问题2 尝试: SELECT weight, birthCountry, case When birthCountry = 'USA' then 'Domestic-Born' ...