Archived

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

Can't activate the GL rendering context...

This topic is 5900 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 sometimes (too often) get this error when i try to execute some opengL code. It appears on program startup until i restart my computer. I quess it has something to do with opengl-program not ending as it should and leaving something ''on''. Can i make some code to prevent this message and execute my programs normally without restart. Any help will be much appreciated. Can i somehow reset this videocard when something has gone wrong??? Its frustrating if i try to code something and make a mistake.... i have to restart my machine to be able to go on If this has something to do with my hardware, i can post details of it. i only think its not.

Share this post


Link to post
Share on other sites
What''s the error?


If its the resolution of your screen locking at a lower setting after your program crashing then heres the solution:

1) Refresh the desktop (right click on background)
2) Run an OpenGL program at full-screen that works i.e. one of the tutorials lessons. This always resets the resolution to the correct value.
3) Go to properties and then settings and readjust the resolution back to its orignal setting.

If its not the resolution explain your problem a bit better.

Share this post


Link to post
Share on other sites
Its not the resolution. As i said it gives me this error message and i cant make any opengl program to execute. the execution stops at the initialization with this message. resolution doesnt change (usually, depends on the prog). i just cant execute anything...

better?

Xewren

oh, the message was as is the topic:

Can't activate the GL rendering context..

Edited by - Xewren on October 22, 2001 9:23:45 AM

Share this post


Link to post
Share on other sites
Only thing I can think of is your trying to execute the program at a resolution your graphics card cant handle, if your using Nehe''s base code that error appears in the CreateWindow function near the bottom. Does the program build and just not execute?

Try running one of the tutorial programs at full-screen.
If it succeeds then its a problem with your code and not the machine.

Check where you set the screen resolution make sure its precisely 640 by 480 at 16 bits per colour at both the setting of the initial window and the resized window.

I use to get that error when I assigned an invalid resolution and ran the program at full-screen i.e.600 by 400, and its possible your suffering from that problem as well.

If a Nehe tutorial runs but I''m of no help look over your initialisation of the GL window, suttle changes can make a lasting impact. i.e. in the tutorials

wc.lpszClassName = "OpenGL";

if (!(hWnd=CreateWindowEx(dwExStyle,"OpenGL",

if these segments of code in the createGLwindow function aren''t to the letter then all hell breaks lose, "OpenGL" is not a decorative feature its needed to render the window.

Share this post


Link to post
Share on other sites
Oh well... first of all thanks a lot for your help. The problem isnt in code when it is not changed. well it might be a problem in the code im working on sometimes, but...

After i have had problems with a program that compiles ok and crashes at execution, none of the working executables work. Then i cant use them in any way, not in full screen, not in widowed mode, they just wont execute. I can easily (grr) set things straight by restarting my system, but not in any other way. no programs start after that crash until reboot.

Lets ask it this way... If your applications crash, does it effect in opengl so that you cant make it work anymore? What do you do then?????

Xewren

I have to add this: These executables work well if nothing goes wrong. I dont even know what resolutions and colordepths im using (found out, they are: 640,480,16). its the basecode of nehe. after startup i can run any tutorial-executable and any own modification...




Edited by - Xewren on October 22, 2001 9:55:46 AM

Share this post


Link to post
Share on other sites
You are using win98 aren''t you? I bet you are. There is a problem with 98 and OpenGL. If you crash your program and don''t get to shut down OpenGL properly, windows won''t let you start another OpenGL program because it still thinks the rendering context is associated with another thread. The only way around this is with a reboot unfortunately. However, you can prevent this from happening in the first place by manually handling interrupts. Take a look at the signal function in your SDK. I believe it is defined in signal.h . This has helped me, but it is still frustrating to try and debug with win98. I am getting 2000 (because XP is a POS) and that will make my life easier. I suggest you do the same.

Abs

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yup, Win98 is my OS at the moment... is win ME any better???

Thx Abs for that answer...

Im a such a newbie that sdk, mfc, owl, apf etc.etc dont tell me much, i cant handle them. I need examples to do something. I will try with win ME sometime in the future when i have time... thanks to everyone!

Share this post


Link to post
Share on other sites
Yup, Win98 is my OS at the moment... is win ME any better???

Thx Abs for that answer...

Im a such a newbie that sdk, mfc, owl, apf etc.etc dont tell me much, i cant handle them. I need examples to do something. I will try with win ME sometime in the future when i have time... thanks to everyone!

Share this post


Link to post
Share on other sites
Something like this:

define a signal procedure that calls your Kill routine:

void sigproc(int sig) {
KillGLWindow();
// Any clean up you need
}


then manually handle the termination, seg fault, etc... interrupts:


signal(SIGSEGV, sigproc);
signal(SIGTERM, sigproc);
signal(SIGILL, sigproc);


Of course you could just call your kill routine in response, but whatever.

And, SDK = Software development kit. Your Visual C++ SDK (Assuming that is what you are using) is fully documented so you can look up these type of things in the future.

Abs

Edited by - Absolution on October 22, 2001 12:11:06 PM

Edited by - Absolution on October 22, 2001 12:11:27 PM

Share this post


Link to post
Share on other sites