PDA

View Full Version : fullscreen switch error :(



Titus
08-01-2003, 02:23 PM
Iīve been using nehes lesson06 as a base for my program...

I changed this:
glBegin(GLQUADS);
blah
blah
blah
blEnd();

with something like this:
glBegin(GL_TRIANGLES)
for(i=0;i<12;i++)
for(j=0;j<3;j++)
glVertex3f(face[i].vert[j])

Obviously this is not the real code (way to large), but the point is that works http://www.opengl.org/discussion_boards/ubb/smile.gif
It draws the 3 vertices for each of the 12 faces.
Everything is fine, the cube spins with the texture and all of that..

The problem is when I hit F1 to swith to fullscreen (or if I started at Fullscreen, switching to window mode)

Then I get the "Send Report" window, I debug it and i get and 00x000000005 Access Violation pointing to:
glVertex3f(faces[i].vertex[j]);

Really donīt know what can it be... I have not repeated the variables (i,j) in any other part of the program..
and as I said it works great in both window mode and fullscreen, the problem shows up when I switch mode.

Any ideas?
Thanks
?

torisutan
08-01-2003, 04:21 PM
certain opengl functions can't run (and have access violations or something similar) if no opengl context has been defined. i'm not sure what all these functions are (i know glGetString is one). When u switch screen modes, u have to destroy the window and the gl context, and recreate them. So maybe when you switch modes, you've forgotten to recreate the gl context.

hope this helps
--tristan

Deiussum
08-04-2003, 04:20 AM
It's not just certain OpenGL functions that can't run before a context is created, it's all of them. Until you create a gl context none of the gl* functions will succeed.

GlutterFly
08-04-2003, 06:41 AM
This might be silly, but if that was the problem, then wouldnt glBegin send the error and not glVertex? Or possibly even a gl statement earlier?

Titus
08-04-2003, 08:06 AM
Nah Donīt worry guys
Thanks for the help
But it seems that was some stupid error reading the values, Iīm not sure what was it but I re-wrote the code for more objects and somehow the problem went away http://www.opengl.org/discussion_boards/ubb/biggrin.gif
Thanksk anyway
?

Deiussum
08-04-2003, 09:39 AM
Yeah, I didn't really read the original question that closely. Just wanted to clarify the bit about "certain" functions not working before a context is created. If I had actually looked at the original post like I should have, I would have said, "check your data. Make sure you aren't touching memory you have no right to touch." http://www.opengl.org/discussion_boards/ubb/smile.gif