Note that there are some explanatory texts on larger screens.

plurals
  1. POproblem in loading texture from AVFrame(android)
    primarykey
    data
    text
    <p>I get a problem when loading data from AVFrame to openGL:</p> <pre><code> int target_width = 320; int target_height = 240; img_convert_ctx = sws_getContext(pCodecCtx-&gt;width, pCodecCtx-&gt;height, pCodecCtx-&gt;pix_fmt, target_width, target_height, PIX_FMT_RGBA, SWS_FAST_BILINEAR, NULL, NULL, NULL); if(img_convert_ctx == NULL) { LOGE("could not initialize conversion context\n"); return; } sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame-&gt;data, pFrame-&gt;linesize, 0, pCodecCtx-&gt;height, pFrameRGB-&gt;data, pFrameRGB-&gt;linesize); //free(data); int line=target_width*target_height*4; data=(char*)malloc(line); if (!data) LOGE("create data frame fail"); LOGE("successful data"); filldata(data,pFrameRGB,target_width,target_height); </code></pre> <p>with function filldata as:</p> <pre><code> static void filldata(char *data,AVFrame *pFrame,int w,int h) {uint8_t *frameLine; int yy; int i=0; for (yy = 0; yy &lt; h; yy++) { frameLine = (uint8_t *)pFrame-&gt;data[0] + (yy * pFrame-&gt;linesize[0]); int xx; for (xx = 0; xx &lt; w; xx++) { int in_offset = xx * 4; data[i++] = frameLine[in_offset]; data[i++] = frameLine[in_offset+1]; data[i++] = frameLine[in_offset+2]; data[i++] = frameLine[in_offset+3]; } } } </code></pre> <p>After that i use data to transfer to </p> <pre><code>glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, *wi, *he, 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)data); </code></pre> <p>but it cannot show texture, maybe data above and data in function gltextimage2D are different. Please help me figure out what is the format for gltextimage2D so i can configure data to show texture. OR anyone has some sample code to show me.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload