On Sunday, 12 April 2009 at 22:47, Per Inge Mathisen wrote:
> I don't understand this part of the patch (new since first version):
> 
>                       tmp = malloc(texture_width * texture_height * 4);
> 
>                       glGenTextures(1, &video_texture);
>                 glBindTexture(GL_TEXTURE_2D, video_texture);
>                 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture_width,
> texture_height,
>                                 0, GL_RGBA, GL_UNSIGNED_BYTE, tmp);
>                       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
> GL_LINEAR);
>                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
> GL_NEAREST);
>                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
>                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
> 
>                 free(tmp);
> 
> Do you upload an uninitialized buffer here?

Yes. I'm uploading the video image via glTexSubImage, but before I can do that,
I need to call glTexImage once to initialize the texture. The content of the
buffer is completely irrelevant, since the part of the texture that is shown on
screen is updated with the video before being displayed.

That part was there in the first patch, btw, in the if(!initialized) block in
video_write (where it doesn't make that much sense code-wise, but perhaps
illustrates the order of things better).

_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to