我尝试以下代码,但没有任何成功:
我像这样创建我的纹理:
glActiveTexture(GL_TEXTURE0);
glGenTextures(1, @Tex);
glBindTexture(GL_TEXTURE_2D, Tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
TJGLUtils.JavaClass.texImage2D(GL_TEXTURE_2D, // target: Integer;
0, // level: Integer;
aBitmap, // bitmap: JBitmap;
0); // border: Integer =>
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 100, 100, 0, GL_RGBA, GL_UNSIGNED_BYTE, nil);
glBindTexture(GL_TEXTURE_2D, 0);
然后在我的主渲染循环中,我尝试用glDrawTexiOES绘制纹理,如下所示:
eglMakeCurrent(eglGetCurrentDisplay, SharedSurface, SharedSurface,
SharedContext);
glViewport(Round(FContentRect.Left * FScale), Round(FContentRect.Top * FScale), Round(FContentRect.Width * FScale),
Round(FContentRect.Height * FScale));
glDepthMask(1);
glClearDepthf(1);
glClearStencil(0);
glClearColor(0, 0, 0, 0);
glClear(GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT or GL_COLOR_BUFFER_BIT);
glBindTexture(GL_TEXTURE_2D, Tex);
aParams[0] := 0;
aParams[1] := 0;
aParams[2] := 100;
aParams[3] := 100;
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, @aParams[0]);
glDrawTexiOES(0, 0, 0, 100, 100);
eglSwapBuffers(SharedDisplay, SharedSurface);
但这不起作用:(我错过了什么?
注意:此行上的函数崩溃:glTexParameteriv(GL_TEXTURE_2D,GL_TEXTURE_CROP_RECT_OES,@ aParams [0]);错误1280
答案 0 :(得分:0)
您是否尝试过读取规范并查找错误代码?很清楚问题是什么......
该错误代码为GL_INVALID_ENUM
,因此您的平台似乎不支持您尝试使用的GL_TEXTURE_CROP_RECT_OES
所需的扩展程序。