fullscreen switch error :(

I´ve been using nehes lesson06 as a base for my program…

I changed this:

with something like this:

Obviously this is not the real code (way to large), but the point is that works
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:

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?

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

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.

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?

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
Thanksk anyway

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.”