Jump to content
  • Advertisement
Sign in to follow this  
Ancient Spirit

PLEASE HELP

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

const GLubyte *szExtensions = glGetString(GL_EXTENSIONS);
char m[1000];

sprintf(m, "%s", (char *)szExtensions);
MessageBox(NULL, m, "Error", MB_OK | MB_TOPMOST);

The message box text says NULL... What is wrong with my code? I have also tried some casts... If you can please help... Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement

char* Buffer = (char*)malloc(strlen((char*)glGetString(GL_EXTENSIONS))+1);
strcpy(Buffer, (char*)glGetString(GL_EXTENSIONS));
MessageBox(NULL, Buffer, "Error", MB_OK);
free(Buffer);

Share this post


Link to post
Share on other sites
Looks like an error occured. E.g. if you call glGetString between glBegin()/glEnd(), it will return 0. Use glGetError() to retrieve the error code.

Share this post


Link to post
Share on other sites
Quote:
Original post by UltimaX
*** Source Snippet Removed ***


Unhandled exception at 0x0041bad0 in Ancient Spirit Engine.exe: 0xC0000005: Access violation reading location 0x00000000.

this is the error i get...

Share this post


Link to post
Share on other sites
Quote:
Original post by Konfusius
Looks like an error occured. E.g. if you call glGetString between glBegin()/glEnd(), it will return 0. Use glGetError() to retrieve the error code.


actually im not drawing at all... i havent even initialized the HGLRC or HDC... no PIXELFORMAT and etc...

Error: invalid handle...

Share this post


Link to post
Share on other sites

const GLubyte *szExtensions = glGetString(GL_EXTENSIONS);
char m[1000];

sprintf(m, "%s", (char *)szExtensions);
MessageBox(NULL, m, "Error", MB_OK | MB_TOPMOST);







I'd like to add that 1000 characters is probably not enough to fit every extension, except on older graphics cards. If you're using C, you should use strlen, malloc and strncpy to make m the proper size, if you use C++ use std::string...

Tom

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!