Created
October 25, 2012 06:51
-
-
Save mbohun/3950925 to your computer and use it in GitHub Desktop.
OpenGL, libSDL, C++, list OpenGL extensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <sstream> | |
#include <set> | |
#include <SDL.h> | |
#include <GL/gl.h> | |
using namespace std; | |
int main(int argc, char* argv[] ) | |
{ | |
SDL_Surface* scr; | |
const char* gl_ext_string; | |
Uint32 sdl_init_flags =0; | |
Uint32 video_mode_flags =0; | |
sdl_init_flags = sdl_init_flags | SDL_INIT_VIDEO; | |
SDL_Init(sdl_init_flags); | |
video_mode_flags =video_mode_flags | SDL_OPENGL; | |
scr =SDL_SetVideoMode(640, 480, 32, video_mode_flags ); | |
string ext_string(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS ) ) ); | |
const string TOKEN(" "); | |
bool done_flag =false; | |
int from =0; | |
set<string> result; | |
do { | |
int to =ext_string.find(TOKEN, from ); | |
if(to==string::npos) | |
{ | |
to =ext_string.size(); | |
done_flag =true; | |
} | |
string sub =ext_string.substr(from, to-from ); //from + number of chars to read | |
result.insert(sub); | |
from =to+1; | |
} while(!done_flag); | |
cout << "vendor:" << glGetString(GL_VENDOR) << endl; | |
cout << "renderer:" << glGetString(GL_RENDERER) << endl; | |
cout << "version:" << glGetString(GL_VERSION) << endl; | |
set<string>::const_iterator iter; | |
iter =result.begin(); | |
while(iter!=result.end() ) { | |
cout << *iter << endl; | |
iter++; | |
} | |
GLint noab; | |
glGetIntegerv(GL_AUX_BUFFERS, &noab ); | |
cout << "GL_AUX_BUFFERS:" << noab; | |
SDL_Quit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment