简体   繁体   English

Android opengl纹理问题-显示混乱了很多颜色

[英]Android opengl texture problem - display has messed up with lot of colors

I am trying to load a texture on to my android app display, where I am using code from this github . 我试图将纹理加载到我的android应用程序显示器上,在这里我正在使用此github中的代码。

I get my pixels messed up completely on the screen, And I have no idea, what's going on. 我的像素完全在屏幕上弄乱了,我不知道发生了什么。 The only thing I change in that code is I have memcpy, which copied uint8_t buffer into s_pixels instead of render_pixels in glbuffer.c file. 我在该代码中唯一更改的是memcpy,它将uint8_t缓冲区复制到s_pixels而不是glbuffer.c文件中的render_pixels。 My frame pixels are in rgb565 format. 我的帧像素为rgb565格式。

Is it somekind of configuration problem or any problem with the way I copy pixels? 是某种配置问题还是我复制像素的方式有问题?

EDIT 编辑

Below is the code : 下面是代码:

pictureQ is as below pictureQ如下

pictureQ { uint8_t *data; pictureQ {uint8_t * data; int size; 整数大小; } }

    memcpy(s_pixels,&(pictureQ[qFirst].data[0]) , 307200);
    //render_pixels(s_pixels);
    glClear(GL_COLOR_BUFFER_BIT);
   // glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 480, 320, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, &(pictureRGBQ[qFirst].data[0]));
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 480, 320, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, s_pixels);

    check_gl_error("glTexSubImage2D");
    glDrawTexiOES(0, 0, 0, s_w, s_h);
    check_gl_error("glDrawTexiOES");
    memset(s_pixels, 0, 307200);

Ok, It was my mistake, I was passing the data for the pixels instead of the data. 好的,这是我的错误,我正在传递像素的数据而不是数据。 Thanks for your response Reuben Scatton. 感谢您的回复Reuben Scatton。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM