• Advertisement
Sign in to follow this  

mapping problem

This topic is 4684 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I try to map a mesh but the result is stange it isn't mapped correctly... glGetError give me the GL_INVALID_ENUM error, i don't know what it is :( i read coordinates in a .3ds file. the texture which i map has some black parts(which mustn't be mapped) and we see these parts on the model :-/ Can you help me ? here is some code :
 glGenTextures (myLoader->getCounterObj()+1, texname);	

	int i ;
	for(i=0 ; i <=/*1*/ myLoader->getCounterObj() ; i++)
	{
					SDL_Surface *texture=IMG_Load(/*"bois.bmp""eyeball.tif"*/myLoader->myObjects.textureNames/*"wood_b.TGA""herbe.bmp"*/);
			cout<<"texture "<<texture<<" nomTex "<<myLoader->myObjects.textureNames<<endl ;//gérer le compteur d'objets dans 0xa300
			
			glBindTexture (GL_TEXTURE_2D, texname) ;
	
			glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
			glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
			glTexParameteri (GL_TEXTURE_2D,	GL_TEXTURE_MAG_FILTER,GL_LINEAR);
			glTexParameteri (GL_TEXTURE_2D,	GL_TEXTURE_MIN_FILTER,GL_LINEAR);
	
			glTexImage2D(GL_TEXTURE_2D, 0, 3, texture->w, texture->h,
					0, GL_RGB, GL_UNSIGNED_BYTE, texture->pixels);
	
		
	}
	glEnable(GL_TEXTURE_2D) ; 

Share this post


Link to post
Share on other sites
Advertisement
try glintercept to see which call causes GL_INVALID_ENUM, itll prolly pick up a lot more errors as wqell

Share this post


Link to post
Share on other sites
i have the same error with GL_RGB. i tried glIntercept(gliConfig.ini) :
GL Intercept Log. Version : 0.42 Compile Date: Mar 30 2005 Run on: Wed Apr 27 11:22:16 2005

===================================================
GL ERROR - Function glEnable(GL_ONE) generated error GL_INVALID_ENUM
GLDriver - Shutdown - Current OpenGL context 0x10000?
GLDriver - Shutdown - Outstanding OpenGL context 0x10000 ?
ImageManager::Destructor - OpenGL id 1 is still active. (Image Memory leak?)
===================================================
Log End.

and gliInterceptLog.txt

===============================================================================
GLIntercept version 0.42 Log generated on: Wed Apr 27 11:29:38 2005

===============================================================================

wglChoosePixelFormat(0x10010c4a,0x12fc74)=5
wglDescribePixelFormat(0x10010c4a,5,40,0xc13f60)=54
wglChoosePixelFormat(0x10010c4a,0xc13f60)=5
wglSetPixelFormat(0x10010c4a,5,0xc13f60)
----->wglGetPixelFormat(0x10010c4a)=5 =true
wglCreateContext(0x10010c4a)
----->wglGetPixelFormat(0x10010c4a)=5
----->wglDescribePixelFormat(0x10010c4a,5,40,0x12fc1c)=54
----->wglGetPixelFormat(0x10010c4a)=5 =0x10000
wglGetCurrentContext()=0x0000
wglGetCurrentDC()=0x0000
wglMakeCurrent(0x10010c4a,0x10000)
----->wglGetPixelFormat(0x10010c4a)=5
----->wglGetPixelFormat(0x10010c4a)=5 =true
glEnable(GL_DEPTH_TEST)
glClearColor(0.000000,0.000000,1.000000,0.000000)
glGenTextures(1,0x41a7ac)
glBindTexture(GL_TEXTURE_2D,1)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_BASE_LEVEL,GL_ZERO)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_LEVEL,GL_ZERO)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR)
glTexImage2D(GL_TEXTURE_2D,0,0x0003,512,256,0,GL_RGB,GL_UNSIGNED_BYTE,0xbc10048)
glEnable(GL_TEXTURE_2D)
glEnable(GL_ONE) glGetError() =GL_INVALID_ENUM
glGetError()=GL_INVALID_ENUM
glLightfv(GL_LIGHT0,GL_AMBIENT,0x11fcd4b4)
glLightfv(GL_LIGHT0,GL_DIFFUSE,0x11fcd4b4)
glLightfv(GL_LIGHT0,GL_POSITION,0x11fcd350)
glLightfv(GL_LIGHT0,GL_SPOT_DIRECTION,0x11fcd33c)
glLightf(GL_LIGHT0,GL_CONSTANT_ATTENUATION,0.000000)
glLightf(GL_LIGHT0,GL_LINEAR_ATTENUATION,0.000000)
glLightf(GL_LIGHT0,GL_QUADRATIC_ATTENUATION,1.000000)
glEnable(GL_LIGHTING)
glEnable(GL_LIGHT0)
wglGetCurrentContext()=0x10000
wglGetCurrentDC()=0x10010c4a
glViewport(0,0,640,480)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glMultMatrixd([1.732051,0.000000,0.000000,0.000000,0.000000,1.732051,0.000000,0.000000,0.000000,0.000000,-1.000001,-1.000000,0.000000,0.000000,-2.000001,0.000000])
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glEnable(GL_RESCALE_NORMAL)
glMultMatrixf([-0.917514,-0.045835,0.395053,0.000000,0.397703,-0.105742,0.911400,0.000000,0.000000,0.993337,0.115249,0.000000,0.000000,0.000000,0.000000,1.000000])
glTranslated(-15.162777,-36.471790,-7.859083)
wglGetCurrentContext()=0x10000
wglGetCurrentDC()=0x10010c4a
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
glEnableClientState(GL_VERTEX_ARRAY)
glEnableClientState(GL_TEXTURE_COORD_ARRAY)
glEnableClientState(GL_NORMAL_ARRAY)
glFrontFace(GL_CCW)
glEnable(GL_CULL_FACE)
glCullFace(GL_BACK)
glPolygonMode(GL_FRONT,GL_FILL)
glRotatef(0.000000,0.000000,0.000000,1.000000)
glVertexPointer(3,GL_FLOAT,0,0x11d6ad98)
glBindTexture(GL_TEXTURE_2D,1)
glTexCoordPointer(2,GL_FLOAT,0,0x11e4693c)
glNormalPointer(GL_FLOAT,0,0x11f3ab7c)
glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,0x11fcd4a8)
glDrawElements(GL_TRIANGLES,2970,GL_UNSIGNED_SHORT,0x11dfd55a) Textures[ (0,1) ]
wglSwapBuffers(0x10010c4a)=true
wglGetCurrentContext()=0x10000
wglGetCurrentDC()=0x10010c4a
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
glEnableClientState(GL_VERTEX_ARRAY)
glEnableClientState(GL_TEXTURE_COORD_ARRAY)
glEnableClientState(GL_NORMAL_ARRAY)
glFrontFace(GL_CCW)
glEnable(GL_CULL_FACE)
glCullFace(GL_BACK)
glPolygonMode(GL_FRONT,GL_FILL)
glRotatef(0.000000,0.000000,0.000000,1.000000)
glVertexPointer(3,GL_FLOAT,0,0x11d6ad98)
glBindTexture(GL_TEXTURE_2D,1)
glTexCoordPointer(2,GL_FLOAT,0,0x11e4693c)
glNormalPointer(GL_FLOAT,0,0x11f3ab7c)
glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,0x11fcd4a8)
glDrawElements(GL_TRIANGLES,2970,GL_UNSIGNED_SHORT,0x11dfd55a) Textures[ (0,1) ]
wglSwapBuffers(0x10010c4a)

Share this post


Link to post
Share on other sites
i have found, it is glEnable(GL_ARB_texture_non_power_of_two); which generate the error but when i remove it mapping is alway wrong :(

Share this post


Link to post
Share on other sites
somebody told me that 3ds uses offsets and scaling for texture coordinates do you know something about it ?

Share this post


Link to post
Share on other sites
If you look in the log, there is this line...
glEnable(GL_ONE) glGetError() =GL_INVALID_ENUM
I'm assuming that that's where you call glEnable(GL_ARB_texture_non_power_of_two).

GL_ARB_texture_non_power_of_two is just the name of the extension, not an enum for you to enable. It is defined as 1 (same as GL_ONE) so that you can check if it is supported or not. You don't need to enable anything for NPOT textures to work, so there must be something else wrong somewhere if your texture coordinates are correct when you enable GL_ONE and incorrect when you don't.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement