performance in textured streaming video

  • Follow


Hello newsgroup,

I am just trying to realize a streaming video output as a texture on a surface using OpenGL. I have already read the NeHe lesson 35 but my application is different in some points. My OpenGL surface consists of about 1700 quadrangles and therefore my application is somewhat slow. I am using a display list to draw the surface and apply the texture. Before reading NeHe lesson 35 I used gluBuild2DMipmaps to create the texture, but I didn't get it to work with glTexImage2D, glLoadMatrix and glLoadIdentity (the texture isn't applied). The source code documentation of lesson 35 mentions gluScaleImage which is said to be too slow. Because of lesson 35 applying the texture multiple times it is somewhat different for me to filter the relevant OpenGL instructions.
The size of the images used as a texture is 720x576, the screen is 1024x768, the modelled surface constists of 1700 quads (as well as the texels) - the coordinates didn't change and the images are (each new frame is) located at the same position in memory too. How do I gain the best performance ? Should I use a display list, gluBuild2DMipMaps, gluScaleImage or any other way ? Which instructions are important to use glTexImage2D in conjunction with glLoadMatrix to get the texture having a size that is a power of two ?
The streaming video using OpenGL works fine, if I didn't use textures.

Thanks in advance,


Alex
0
Reply Alexander 1/30/2004 11:02:22 AM

"Alexander Block" <Alexander.Block@fernuni-hagen.de> wrote in message
news:bvddka$rcljl$1@ID-188997.news.uni-berlin.de...
> Hello newsgroup,
>
> I am just trying to realize a streaming video output as a texture on a
surface using OpenGL. I have already read the NeHe lesson 35 but my
application is different in some points. My OpenGL surface consists of about
1700 quadrangles and therefore my application is somewhat slow. I am using a
display list to draw the surface and apply the texture. Before reading NeHe
lesson 35 I used gluBuild2DMipmaps to create the texture, but I didn't get
it to work with glTexImage2D, glLoadMatrix and glLoadIdentity (the texture
isn't applied). The source code documentation of lesson 35 mentions
gluScaleImage which is said to be too slow. Because of lesson 35 applying
the texture multiple times it is somewhat different for me to filter the
relevant OpenGL instructions.
> The size of the images used as a texture is 720x576, the screen is
1024x768, the modelled surface constists of 1700 quads (as well as the
texels) - the coordinates didn't change and the images are (each new frame
is) located at the same position in memory too. How do I gain the best
performance ? Should I use a display list, gluBuild2DMipMaps, gluScaleImage
or any other way ? Which instructions are important to use glTexImage2D in
conjunction with glLoadMatrix to get the texture having a size that is a
power of two ?
> The streaming video using OpenGL works fine, if I didn't use textures.

Do not use gluBuild2DMipMaps, gluScaleImage. It's CPU expensive.
Because of texture size (720x576) you should use 1024x1024 texture (lower
left part) or
use GL_NV_texture_rectangle or GL_EXT_texture_rectangle extension.

I already made player that can play up to 3 MPEG2 720x576 files in the same
time using OpenGL.
I use GL_NV_texture_rectangle, and render a single quad on the screen.

yooyo


0
Reply yooyo 1/30/2004 11:48:12 AM


Alexander Block wrote:
> Hello newsgroup,
> 
> I am just trying to realize a streaming video output as a texture on a 
> surface using OpenGL. I have already read the NeHe lesson 35 but my 
> application is different in some points. My OpenGL surface consists of 
> about 1700 quadrangles and therefore my application is somewhat slow. I 
> am using a display list to draw the surface and apply the texture. 
> Before reading NeHe lesson 35 I used gluBuild2DMipmaps to create the 
> texture, but I didn't get it to work with glTexImage2D, glLoadMatrix and 
> glLoadIdentity (the texture isn't applied). The source code 
> documentation of lesson 35 mentions gluScaleImage which is said to be 
> too slow. Because of lesson 35 applying the texture multiple times it is 
> somewhat different for me to filter the relevant OpenGL instructions.
> The size of the images used as a texture is 720x576, the screen is 
> 1024x768, the modelled surface constists of 1700 quads (as well as the 
> texels) - the coordinates didn't change and the images are (each new 
> frame is) located at the same position in memory too. How do I gain the 
> best performance ? Should I use a display list, gluBuild2DMipMaps, 
> gluScaleImage or any other way ? Which instructions are important to use 
> glTexImage2D in conjunction with glLoadMatrix to get the texture having 
> a size that is a power of two ?
> The streaming video using OpenGL works fine, if I didn't use textures.
> 
> Thanks in advance,
> 
> 
> Alex

Use a 1024x1024 texture and load every frame using glTexSubImage2D.
You'll have to adjust your texture coordinates (either through a
texture matrix or manually You won't be able to scale the texture smoothly
to 1024x1024 in realtime, and I think it will be hard to build mipmaps
in  realtime (assuming you want 25 fps in PAL resolution).


Regards,

	Toni
0
Reply Antonio 1/30/2004 11:49:45 AM

"Alexander Block" <Alexander.Block@fernuni-hagen.de> schrieb im Newsbeitrag
news:bvddka$rcljl$1@ID-188997.news.uni-berlin.de...
> Hello newsgroup,
>
> I am just trying to realize a streaming video output as a texture on a
surface using OpenGL. I have already read the NeHe lesson 35 but my
application is different in some points. My OpenGL surface consists of about
1700 quadrangles and therefore my application is somewhat slow. I am using a
display list to draw the surface and apply the texture. Before reading NeHe
lesson 35 I used gluBuild2DMipmaps to create the texture, but I didn't get
it to work with glTexImage2D, glLoadMatrix and glLoadIdentity (the texture
isn't applied). The source code documentation of lesson 35 mentions
gluScaleImage which is said to be too slow. Because of lesson 35 applying
the texture multiple times it is somewhat different for me to filter the
relevant OpenGL instructions.
> The size of the images used as a texture is 720x576, the screen is
1024x768, the modelled surface constists of 1700 quads (as well as the
texels) - the coordinates didn't change and the images are (each new frame
is) located at the same position in memory too. How do I gain the best
performance ? Should I use a display list, gluBuild2DMipMaps, gluScaleImage
or any other way ? Which instructions are important to use glTexImage2D in
conjunction with glLoadMatrix to get the texture having a size that is a
power of two ?
> The streaming video using OpenGL works fine, if I didn't use textures.
>

as already said, do not use gluBuild2DMipmaps unless you really need
mipmapping.
another trick is not to use Nehe's assembler to swap BGR to RGB. use
GL_BGR_EXT instead.

thats how i do the updating.
if you want some more tricks contact me via ICQ:
1 7 6 1 9 1 2 0 7
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, videoWidth, videoHeight,
GL_BGR_EXT, GL_UNSIGNED_BYTE, data);





hth psy


0
Reply Sebastian 1/30/2004 1:46:08 PM

Another trick, however not so easy to implement is, only to update the
regions of the texture that need to be updated. If you're using a format
as MPEG4, DivX or similair compressed format, the video files already
contain exactly that information, since one of the working principles of
video compression is to only store changed parts.

At least it should be possible using the open source XviD MPEG4 decoder 
library, decompressing the XVID_CSP_USER mode. Although I never tried 
it, I think, that the structures supplied by this will contains exact 
descriptions, of what has changed.

This is primarily provided to support developers of high performance 
media players.

Wolfgang

0
Reply Wolfgang 1/30/2004 8:21:49 PM

Thank you all for your answers. I just realized my application using glTexSubImage together with a display list and a texture matrix. It works very fine and I think another performance progression won't be possible, will it ?

Regards,

	Alex

Antonio Bleile schrieb:
> 
> Use a 1024x1024 texture and load every frame using glTexSubImage2D.
> You'll have to adjust your texture coordinates (either through a
> texture matrix or manually You won't be able to scale the texture smoothly
> to 1024x1024 in realtime, and I think it will be hard to build mipmaps
> in  realtime (assuming you want 25 fps in PAL resolution).
> 
> 
> Regards,
> 
>     Toni
0
Reply Alexander 2/2/2004 6:33:58 AM

5 Replies
262 Views

(page loaded in 0.084 seconds)

Similiar Articles:








7/25/2012 10:47:58 PM


Reply: