Archived

This topic is now archived and is closed to further replies.

glGetError() ??!?

This topic is 5670 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''m a little bit confused about glGetError()... well... here''s my code : (did some just for problem-testing) ... glFinish(); glGetError(); Frustum->Update(); ... so every error-message should be ''deleted'', right ? now i call Frustum->Update()... void nxFrustum::Update() { float clip[16]; float proj[16]; float modl[16]; float t; float save[16]; glFinish(); (1) -> int r = glGetError(); if (r != 0) printf ("ERROR ! %i\n", r); glGetFloatv (GL_PROJECTION_MATRIX, proj); glGetFloatv (GL_MODELVIEW_MATRIX, modl); (2) -> glMatrixMode (GL_MODELVIEW_MATRIX); //glPushMatrix(); glGetFloatv (GL_MODELVIEW_MATRIX, save); ... and the glGetError() that i marked (1) returns an error (GL_INVALID_ENUM). HOW CAN THIS BE ??? since i''ve used glFinish() before the first glGetError() and before the glGetError() in the Frustum->Update function, there should no queued GL-commands be interfering, right ? so how is it possible that it reports an error, if the first glGetError() (before call to update) didn''t report any ? i found out, that the error is to be found at the glMatrixMode() command (after a lot of try & error), but still... how can the glGetError() report the error, BEFORE it happened ? (maybe some sort of ''Fortune-Telling-Algorithm'' in here ?) another strange thing was, that it also reported GL_INVALID_ENUM for a glPushMatrix() call, when the stack was full... shouldn''t this be GL_STACK_OVERFLOW or so ?

Share this post


Link to post
Share on other sites
You are wrong, glGetError() returns ONE error, if you have a lot of errors a new call to glGetError () will returns another error. If you want "to clean" all errors you must to call glGetError until it returns GL_NO_ERROR:

while (glGetError!=GL_NO_ERROR)
glGetError ();

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Sorry for my previous code.

···
error=glGetError ();
while (error!=GL_NO_ERROR)
error=glGetError ();
···

better.

Share this post


Link to post
Share on other sites
well... in THAT case :

while (glGetError());

would be best, right ? (since MSDN says, GL_NO_ERROR is GUARANTEED to be 0)


now for my ''problem'' :

i''ve only read this MSDN-part :

The glGetError function returns the value of the error flag. Each detectable error is assigned a numeric code and symbolic name. When an error occurs, the error flag is set to the appropriate error code value. No other errors are recorded until glGetError is called, the error code is returned, and the flag is reset to GL_NO_ERROR. If a call to glGetError returns GL_NO_ERROR, there has been no detectable error since the last call to glGetError, or since OpenGL was initialized.


and didn''t read the following part :

To allow for distributed implementations, there may be several error flags. If any single error flag has recorded an error, the value of that flag is returned and that flag is reset to GL_NO_ERROR when glGetError is called. If more than one flag has recorded an error, glGetError returns and clears an arbitrary error flag value. If all error flags are to be reset, you should always call glGetError in a loop until it returns GL_NO_ERROR.

i''m not perfect in reading english texts, but as i understand them, both tell something quite different. so what''s correct ?
is it depending on the implementation ? or do i just understand the descriptions wrong & there''s always an ''array'' of flags, while the first part in the MSDN talks about ''one single flag'' and the second part about ''the array'' ?

IF it depends on the implementation, how can my app get information about it ?

Share this post


Link to post
Share on other sites
the two statements have nothing to do with one another....


No other errors are recorded until glGetError is called states that once an error has been set (i.e. glEnable(GL_PROJECTION); // invalid enum), that even if i cause another error, it will not be recorded unless glError has been called to clear the error first.


To allow for distributed implementations, there may be several error flags refers to an implementation that may have to return more error information than just an error code. the implementation would continue to return error information with subsequent calls to glGetError until you get GL_NO_ERROR. meaning there is no more error information for this specific error.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites
mmh...

(say, i''m stupid, but...)
didn''t understand it completely, yet...

what i understood so far :

- there''s always only ONE error recorded.
- if another error occurs before all flags are cleared,
it''s ''ignored''
- every error can have more than one flag, so i need to call
glGetError() until it return GL_NO_ERROR, to get all
information about that ONE error.

is that right, so far ?

if yes, here''s what i still don''t get :

- it seems to me, that any GL_INVALID_ENUM only records the
errorID. nothing else (since ALL return i got was ALWAYS
ONLY ''GL_INVALID_ENUM''). -> only one flag set ! (?)
- if that''s right, no other errors can be recorded... so in
that special case, a single call to glGetError() should clean
all flags. ( the call before Frustum->Update(); ) (?)
[- if the call before Frustum->Update(); ALWAYS returns
''GL_NO_ERROR'' (as it did in my case), how can it
report ''GL_INVALID_ENUM'' right after the call (before calling
any GL-function) ? if anything had happened before, the first
glGetError() call should already report it ! (?)]
- IF all that doesn''t apply, and IF the GL_INVALID_ENUM
generates more information than just the errorID, how do i
get that info ? (since EVERY call to glGetError() only
delivered this ID) (?)


maybe i''m a little slow here, but thx for help anyway.

Share this post


Link to post
Share on other sites
quote:
Original post by uNiQue0815
mmh...

(say, i''m stupid, but...)
didn''t understand it completely, yet...

what i understood so far :

- there''s always only ONE error recorded.
- if another error occurs before all flags are cleared,
it''s ''ignored''
- every error can have more than one flag, so i need to call
glGetError() until it return GL_NO_ERROR, to get all
information about that ONE error.

is that right, so far ?




yes, this is the correct understanding....

all i can suggest is to call glGetError until it''s clear all the time.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites