opengl es - How to draw a texture using glDrawTexiOES? -
i try following code, without success :
i create texture :
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);
then later in main render loop try draw texture 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);
but it's not work :( did miss ?
note: function crash on line: gltexparameteriv(gl_texture_2d, gl_texture_crop_rect_oes, @aparams[0]); error 1280
have tried read specification , error code? it's pretty clear problem ...
that error code gl_invalid_enum
, doesn't platform support extension needed gl_texture_crop_rect_oes
trying use.
Comments
Post a Comment