Advertisement Jump to content
Sign in to follow this  

Opengl:why glEnableClientState(GL_TEXTURE_COORD_ARRAY); generate error?

This topic is 880 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



I am checking error in my program with the following function:

void errorCheck(char * msg) 
	GLenum errCode;
	const GLubyte *errString;
	while ((errCode = glGetError()) != GL_NO_ERROR) {
		errString = gluErrorString(errCode);
		printf(">>===>> %s : %s\n", msg, errString);
		fprintf(file, ">>===>> %s : %s\n", msg, errString);

and in my codes:

	glBindBuffer(GL_ARRAY_BUFFER, TexCoordVBOID);
	glBufferData(GL_ARRAY_BUFFER, 8*sizeof(GLfloat), aTexCoord, GL_STATIC_DRAW);
	errorCheck("in init quad");
	glTexCoordPointer(2, GL_FLOAT, 2*sizeof(GLfloat), BUFFER_OFFSET(0));

after the     glEnableClientState(GL_TEXTURE_COORD_ARRAY);  it generated the following error:

>>===>> in init quad : invalid operation
why would a glEnableClientState() produced such an error?
thanks in advance for your help.

Share this post

Link to post
Share on other sites
From your other thread that I was posting in it sounds like the version of OpenGL that you are using doesn't support fixed function or default vertex attributes (glTexCoord and so on) so that's probably why this is  generating an error, it no longer exists. The brief search I did suggests that it was removed in 3.2 (maybe 3.1). If this is the case then glTexCoordPointer probably doesn't exist either. I read there is a compatibility mode that you can enable that allows these things to work so the function might still exist. I would suggest you take what you have learned from the other thread (where you were using vertex attributes) and use those for your texture coordinates too.
I'm not sure why your second post was down voted as moving your check error function around is a reasonable method for narrowing down and finding which function is generating the error.
It will be helpful if you can find out which version of OpenGL you are targeting and add that to your OpenGL questions. It'll allow people to quickly help you with your problem.
This is the API reference for OpenGL 4.5 there are others for previous versions also here Edited by Nanoha

Share this post

Link to post
Share on other sites

As the other poster said, you should give more details, mainly which version of OpenGL you are running with (glGet(GL_MAJOR_VERSION) and glGet(GL_MINOR_VERSION)) and what version of OpenGL you are targeting to develop with (if relevant).


But as a general answer I would say that if you want to keep using these functions, create a compatibility profile context for OpenGL. How to do this depends on what lower-level API you are using to create your window.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!