Hello,
I’m currently rendering video using a texture and then just displaying the texture using glQuad.
I’m looking for the right settings, but I’m not sure wht should be changed. Currently here is what I do:
//hints
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
glHint(GL_FOG_HINT, GL_FASTEST);
// create the texture
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable(GL_TEXTURE_RECTANGLE_NV);
glGenTextures(1, &m_videoTexture);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, m_videoTexture);
BYTE* black_frame = (BYTE*)malloc(widthheight16sizeof(BYTE));
memset(black_frame, 0, widthheight16sizeof(BYTE));
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_SHORT, black_frame);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV,GL_TEXTURE_WRAP_T,GL_CLAMP);
free(black_frame);
Is it necessary to create this black frame ??
After this, I just use glTexSubImage2D to copy the video into the texture.
Is there some improvements that can be made ?
TIA
wpr