Textures

Started by
5 comments, last by aznium 17 years, 2 months ago
Hi all, I got my NPOT textures working, however speed is something to be desired.

hwidth = 960; //(1920 / 2)
height = 1080;

...

glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture1);
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, hwidth, height, 0, GL_RGB, GL_UNSIGNED_BYTE, partialFrame1);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture2);
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, hwidth, height, 0, GL_RGB, GL_UNSIGNED_BYTE, partialFrame2);
its taking around 10ms to 30ms to load 2 textures of 960x1080 ... is it possible to bring this number down to 2 to 6ms? Also, I am using double-buffering. this call:


...
//glBegin...Quad...glTexCoord2f...glVertex2f...
//...draw
//...the
//...texture
//glEnd
...

SwapBuffers(hDC);
usually takes 2ms, but sometimes jumps to 45ms!!! any ideas? the hardware on this machine is core 2 duo E6700, 4 gigs ram (DDR2 400), Quadro FX 1500 thanks all!
Advertisement
i switched to using

glTexSubImage2D

since i am reusing texture1/texture2...

and i got a slight boost there.

(btw. each texture only gets displayed once before it gets discarded....its something like a video player)
Try using a format supported by the hw like BGRA or RGBA.
No GPU supports RGB as far as I know. They are converted to BGRA or RGBA by the driver and then uploaded. I know that BGRA is typically the prefered form.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Quote:this call:
usually takes 2ms, but sometimes jumps to 45ms!!! any ideas?
disable vsync?
my source is RGB i can make it BGR if necessary .

wont adding a alpha channel waste memory? and will it improve speed A LOT? or jsut a bit?




vysnc already disabled . and my panel is 120hz...shouldnt jump to 45ms?
This heavily depends on which hardware you are using.
On nVidia Cards you can safely use BGR and even benefit from the saved memory.
On ATI, the card can not handle 3-compononent textures. The Driver has to interleave it to convert it to BGRA which can involve an additional system memory copy. The memory is wasted on GPU anyway.

Another default hint for fast texture uploads: Take a look at Pixel Buffer Objects. They allow you to specify a texture upload and do something else while the GPU loads up the data independently. Of course this won't save anything if you have not much to do besides texture uploads.
my source is either RGB or BGR . that can not be changed

my source is also RAM




so are you suggesting this

RAM->Pixel Buffer Object->VRAM->Display

?

thx

This topic is closed to new replies.

Advertisement