Texture formats?

Started by
6 comments, last by swiftcoder 15 years, 5 months ago
I am trying to implement displacement mapping using a 512*512 24 bit .png noise image as my texture. But each frame takes about 1 minute to render (using a GF 7600GS graphics card). I have tried making the texture smaller and that helps a little. But are there other ways to change the format (have looked at the glTexImage2D function) so the texture lookup will go faster?
Advertisement
hw acceleration for this depends on what format the GPU supports

http://www.opengl.org/wiki/index.php/Vertex_Texture_Fetch
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);
Ok I have used:

GL_RGBA

so far (which gives the slow performance). In the wiki page it say:


Gf 6 supports only GL_TEXTURE_2D of format GL_LUMINANCE32F and GL_RGBA32F. It doesn't support any of the other floating point formats or fixed point formats. There is no floating point compressed format.
Gf 7 is similar to the Gf6.

Since I have a GF 7600GS I have tried both the :

GL_LUMINANCE32F
GL_RGBA32F

But it gives a compile error:

error C2065: 'GL_LUMINANCE32F' : undeclared identifier

Do I need to install something extra to use these formats?

To use floating point textures (and a lot of the other newer opengl features) you need to get a header file which defines various extensions.

Try this:
http://elf-stone.com/glee.php
I already include glew.h (something like GLee.h I assume) so the extension should be available. But maybe I manually need to enable them before generating the texture?
Quote:Original post by mlt
I already include glew.h (something like GLee.h I assume) so the extension should be available. But maybe I manually need to enable them before generating the texture?
You may need to use GL_LUMINANCE32F_ARB instead - I can't remember if glew supports the core syntax yet.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

That actually helped!! I used it for the InternalFormat eventhough the documentation says that only:


Must be 1, 2, 3, or 4, or
GL_ALPHA, GL_ALPHA4, GL_ALPHA8, GL_ALPHA12, GL_ALPHA16, GL_LUMINANCE, GL_LUMINANCE4, GL_LUMINANCE8, GL_LUMINANCE12, GL_LUMINANCE16, GL_LUMINANCE_ALPHA, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE6_ALPHA2,
GL_LUMINANCE8_ALPHA8, GL_LUMINANCE12_ALPHA4, GL_LUMINANCE12_ALPHA12,
GL_LUMINANCE16_ALPHA16, GL_INTENSITY, GL_INTENSITY4, GL_INTENSITY8,
GL_INTENSITY12, GL_INTENSITY16, GL_R3_G3_B2, GL_RGB, GL_RGB4, GL_RGB5,
GL_RGB8, GL_RGB10, GL_RGB12, GL_RGB16, GL_RGBA, GL_RGBA2, GL_RGBA4,
GL_RGB5_A1, GL_RGBA8, GL_RGB10_A2, GL_RGBA12, or GL_RGBA16.


Are supported. When is it necessary to specify the 'format' (not the internalFormat)?
Quote:Original post by mlt
That actually helped!! I used it for the InternalFormat eventhough the documentation says that only:
...
Are supported.
The documentation doesn't always contain elements that were added through extensions, in this case the ARB_texture_float extension.
Quote:When is it necessary to specify the 'format' (not the internalFormat)?
AFAIK, only if you are supplying image data (i.e. when the last parameter is not null).

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

This topic is closed to new replies.

Advertisement