glTexImage2D problem
Hi~ I need Help!
I use glTexImage2D() like this.
glTexImage2D(GL_TEXTURE_2D, 0, 4, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, pData);
The texture on the mesh seems like it just a 8 bit color or 16 bit color, There are color grating on the texture.
The same program on MacOSX has no this problem, it just on windows, I test some other opengl program download from the net, they are OK!
I dont know why, please help!
Thank you!!!!
Perhaps it could be the texture filtering? How are you setting that? The texture would appear blocky if you use GL_NEAREST.
You should post more of your code so that we can try and figure out what's wrong.
You should post more of your code so that we can try and figure out what's wrong.
Thank you very much!
I will try to test the filter.
I find a prev topic of this quesion.
They say that because the 3rd param are not matching with the 7th in the glTexImage2D().
I will try both of them, thank you!!!!
I will try to test the filter.
I find a prev topic of this quesion.
They say that because the 3rd param are not matching with the 7th in the glTexImage2D().
I will try both of them, thank you!!!!
If use too many textures that out of the video memory, What will the opengl show to me?
The failed of glGenTextures() or the glTexImage2D() failed?
Thank you!
The failed of glGenTextures() or the glTexImage2D() failed?
Thank you!
Quote:http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.htmlC SPECIFICATION void glTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) PARAMETERS ... internalformat Specifies the number of color components in the texture. Must be 1, 2, 3, or 4, or one of the following symbolic constants: 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. ... format Specifies the format of the pixel data. The following symbolic values are accepted: GL_COLOR_INDEX, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_RGBA, GL_LUMINANCE, and GL_LUMINANCE_ALPHA. ...
The internalformat and format arguments should be valid in your case.
Thank you!!!!!
Do you know the answer of my second question?
Thank you very much!
Welcome to China, I will be your cicerone.
Do you know the answer of my second question?
Thank you very much!
Welcome to China, I will be your cicerone.
Quote:Original post by cubicwang
If use too many textures that out of the video memory, What will the opengl show to me?
The failed of glGenTextures() or the glTexImage2D() failed?
Thank you!
Well, you must be using quite a few textures for that to happen. The driver will first move textures in and out of the graphics card memory and use the main memory, so it should have a lot to go on.
If OpenGL does run out of memory, it will set a GL_OUT_OF_MEMORY error, which means there is not enough memory left to execute the command. It can fail on any call.
You need to get this error with glGetError, and you can use gluErrorString to translate the error code into a more helpful string.
Quote:Original post by cubicwang
Thank you!!!!!
Do you know the answer of my second question?
Thank you very much!
Welcome to China, I will be your cicerone.
hehe, cool. You're welcome.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement