我在Qt上使用GL_TEXTURE_2D_ARRAY和QOpenGLTexture。我想知道这种纹理的层数是否有任何限制?我希望有81 x 81层,但不知何故它只能用于81 x 25层。没有分段错误我只得到黑色屏幕而不是纹理。
答案 0 :(得分:1)
是的,有一个限制。您可以通过调用
来查询限制package com.example.jaspreetsingh.selectlist;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import static android.R.attr.name;
import static android.os.Build.VERSION_CODES.N;
public class MainActivity extends AppCompatActivity implements android.widget.CompoundButton.OnCheckedChangeListener {
ListView listView;
ArrayList<Names> nameList;
NameAdapter nameAdapter;
String firstName;
String lastName;
boolean selection;
ArrayList<String> summary = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView = (ListView) findViewById(R.id.lv);
displayViewList();
}
public void displayViewList() {
nameList = new ArrayList<Names>();
nameList.add(new Names("Mike", "Warner", false));
nameList.add(new Names("Chris", "Evans", false));
nameList.add(new Names("Robert", "Dowery", false));
nameList.add(new Names("Jon", "Jones", false));
nameList.add(new Names("Tom", "Brady", false));
nameAdapter = new NameAdapter(nameList, this);
listView.setAdapter(nameAdapter);
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int pos = listView.getPositionForView(buttonView);
if (pos != ListView.INVALID_POSITION) {
Names n = nameList.get(pos);
n.setSelected(isChecked);
selection = isChecked;
firstName = n.getFirstName();
lastName = n.getLastName();
String fullName = firstName + lastName;
if (selection) {
summary.add(firstName);
}
if (!selection) {
summary.remove(firstName);
}
}
}
public void button(View view) {
displayText(summary);
}
public void displayText(ArrayList<String> result) {
TextView resultTextView = (TextView) findViewById(R.id.result_text_view);
resultTextView.setText(result.toString());
}
}
保证至少为256。
如果您请求太多图层(或由于任何其他原因而不支持的纹理),则会生成相应的错误。您可以使用GLint maxLayers;
glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &maxLayers);
查询错误。