News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Fast Way Uploading data to VRAM

Started by Farabi, October 29, 2011, 09:09:06 AM

Previous topic - Next topic

Farabi

I used OpenGL to display my Window DC, I used glSubTex2D but it was very slow on my card when I used 800x600 dimension, BitBlt is far superior. Any good method to upload the texture data so OpenGL can showed it? I saw that for displaying AVI it is faster using MS one than what the RealPlayer Corp Did.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

Tedd

I suspect you're re-loading the textures every frame, which is obviously slow. You only need to load them once.

glGenTextures to allocate 'names' for the number of textures you have
then for each of those textures:
- load the image data
- glBindTexture to bind to a name
- glTexParameteri to set the mapping parameters
- glTexImage2D to assign the image to the texture

Now you can use each of those textures by 'name' without reloading them.

and glDeleteTextures to free the textures.


P.S. Need I say "read the documentation" (and find some good tutorials) :P
No snowflake in an avalanche feels responsible.

Farabi

I know, I just want to display a movie on my OpenGL application. I cant just upload all the frame, it wasting resource, so I need to reuse existing texture and modified just the  data texture, but it seems even I used only TexSubImage it generated a mimmap too that maked it so slow.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

oex

#3
Quote from: Farabi on November 12, 2011, 01:47:38 AM
I know, I just want to display a movie on my OpenGL application. I cant just upload all the frame, it wasting resource, so I need to reuse existing texture and modified just theĀ  data texture, but it seems even I used only TexSubImage it generated a mimmap too that maked it so slow.

Parameters
target
Specifies the target texture. Must be GL_TEXTURE_2D.
level
Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

xoffset
Specifies a texel offset in the x direction within the texture array.

Specify level *0* then only the base image will be generated (No Mipmapping)....

The delay is more likely uploading the image to the graphics card.... Maybe you could do this in a more compressed format? Certainly I had no problem doing this on my old graphics card (An SIS 5200 I think it was and I transfered RGBA 640x480 at webcam 5-10 FPS).... I have a different computer now and this old code is too customised for my old computer so I cant give you timings atm I am away for a month on a course....

Additionally I have it displaying from AVI however the slowdown here is obviously reading from the hard disk

Edit: Use multi-threading to read the file from disk both either from a more compressed format and/or several frames in advance for buffering
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

Farabi

I dont know , maybe th GPU (If used) rescale the texture even it is not necessary. MSAVIFIL.dll used 0% CPU Usage where OpenGL atleast 30%.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"