Java GLES20更新draw()位图
我现在的处境很难描述。我想做的是,单击按钮,OpenGL渲染器可以将其位图更改为指定的。要么是我的draw()方法有问题,要么可能是更改了渲染器图像 其他一些信息: 我在Android设备上使用MAXST AR跟踪图像,并在实时图像上显示另一个图像。通过点击屏幕上的按钮,我想将当前显示的图像更改为另一个。我尽了我所能,现在我愿意得到一些好主意如何解决我的问题 My draw()方法: setTextureBitmap()方法: next(),previous()方法:Java GLES20更新draw()位图,java,android,opengl-es,opengl-es-2.0,augmented-reality,Java,Android,Opengl Es,Opengl Es 2.0,Augmented Reality,我现在的处境很难描述。我想做的是,单击按钮,OpenGL渲染器可以将其位图更改为指定的。要么是我的draw()方法有问题,要么可能是更改了渲染器图像 其他一些信息: 我在Android设备上使用MAXST AR跟踪图像,并在实时图像上显示另一个图像。通过点击屏幕上的按钮,我想将当前显示的图像更改为另一个。我尽了我所能,现在我愿意得到一些好主意如何解决我的问题 My draw()方法: setTextureBitmap()方法: next(),previous()方法: fun next() {
fun next() {
if(current < allSize()) {
current++
val bitmap = MaxstARUtil.getBitmapFromAsset(Functions.randomNote(), activity.assets)
var text = textAsBitmap(title, 72f, Color.BLACK, bitmap)
if(current > 0 && current < desc.size) {
println(desc.get(current))
text = textAsBitmap(desc.get(current), 72f, Color.WHITE, bitmap)
} else if(current >= desc.size) {
currentRenderer!!.setTextureBitmap(bitmap)
return
}
currentRenderer!!.setTextureBitmap(text)
}
println(current)
}
fun previous() {
if(current > 0) {
current--
val bitmap = MaxstARUtil.getBitmapFromAsset(Functions.randomNote(), activity.assets)
var text = textAsBitmap(title, 72f, Color.BLACK, bitmap)
if(current > 0 && current < desc.size) {
text = textAsBitmap(desc.get(current), 72f, Color.WHITE, bitmap)
} else if(current >= desc.size) {
currentRenderer!!.setTextureBitmap(bitmap)
return
}
currentRenderer!!.setTextureBitmap(text)
}
println(current)
}
fun next(){
如果(当前0&¤t=desc.size){
currentRenderer!!.setTextureBitmap(位图)
返回
}
currentRenderer!!.setTextureBitmap(文本)
}
println(当前)
}
有趣的过去{
如果(当前>0){
当前--
val bitmap=MaxstARUtil.getBitmapFromAsset(Functions.randomNote(),activity.assets)
var text=textAsBitmap(标题,72f,Color.BLACK,位图)
如果(当前值>0&¤t=desc.size){
currentRenderer!!.setTextureBitmap(位图)
返回
}
currentRenderer!!.setTextureBitmap(文本)
}
println(当前)
}
您已经很好地解释了您想做什么,但问题是什么?什么不起作用?@rabbi76不起作用的是它只显示一个位图,当我调用next()时,什么都没有发生,它应该用new更改当前位图
public void setTextureBitmap(Bitmap texture) {
glBindTexture(GLES20.GL_TEXTURE_2D, textureNames[0]);
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, texture, 0);
texture.recycle();
}
fun next() {
if(current < allSize()) {
current++
val bitmap = MaxstARUtil.getBitmapFromAsset(Functions.randomNote(), activity.assets)
var text = textAsBitmap(title, 72f, Color.BLACK, bitmap)
if(current > 0 && current < desc.size) {
println(desc.get(current))
text = textAsBitmap(desc.get(current), 72f, Color.WHITE, bitmap)
} else if(current >= desc.size) {
currentRenderer!!.setTextureBitmap(bitmap)
return
}
currentRenderer!!.setTextureBitmap(text)
}
println(current)
}
fun previous() {
if(current > 0) {
current--
val bitmap = MaxstARUtil.getBitmapFromAsset(Functions.randomNote(), activity.assets)
var text = textAsBitmap(title, 72f, Color.BLACK, bitmap)
if(current > 0 && current < desc.size) {
text = textAsBitmap(desc.get(current), 72f, Color.WHITE, bitmap)
} else if(current >= desc.size) {
currentRenderer!!.setTextureBitmap(bitmap)
return
}
currentRenderer!!.setTextureBitmap(text)
}
println(current)
}