19 GLenum glerror = ::glGetError();
20 while(glerror!=GL_NO_ERROR) {
21 glerror = ::glGetError();
27 GLenum glerror = ::glGetError();
28 if(glerror!=GL_NO_ERROR) {
30 <<
" we have gl errors :"
34 while(glerror!=GL_NO_ERROR) {
45 a_out <<
"0x" << std::hex << glerror << std::endl;
47 glerror = ::glGetError();
53 std::string gl_version;
54 {
const char* _sv = (
const char*)::glGetString(GL_VERSION);
55 if(_sv) gl_version = _sv;}
57 std::string gl_vendor;
58 {
const char* _sv = (
const char*)::glGetString(GL_VENDOR);
59 if(_sv) gl_vendor = _sv;}
61 std::string gl_renderer;
62 {
const char* _sv = (
const char*)::glGetString(GL_RENDERER);
63 if(_sv) gl_renderer = _sv;}
65 std::string gl_extensions;
66 {
const char* _sv = (
const char*)::glGetString(GL_EXTENSIONS);
67 if(_sv) gl_extensions = _sv;}
69 GLint gl_texture_size;
70 ::glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_texture_size);
75 a_out <<
"tools::sg::gl::dump_infos :" << std::endl;
76 a_out <<
" GL_VERSION " << gl_version << std::endl;
77 a_out <<
" GL_VENDOR " << gl_vendor << std::endl;
78 a_out <<
" GL_RENDERER " << gl_renderer << std::endl;
79 a_out <<
" GL_EXTENSIONS " << gl_extensions << std::endl;
80 a_out <<
" GL_MAX_TEXTURE_SIZE " << gl_texture_size << std::endl;
87 #if defined(ANDROID) || TARGET_OS_IPHONE
89 if(!a_img.
bw2x(3,res)) {
90 a_out <<
"tools::sg::gl::tex_img : tools::img.bw2x() failed." << std::endl;
93 ::glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,res.
width(),res.
height(),0,GL_RGB,GL_UNSIGNED_BYTE,res.
buffer());
95 ::glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,a_img.
width(),a_img.
height(),0,GL_LUMINANCE,GL_UNSIGNED_BYTE,a_img.
buffer());
97 }
else if(a_img.
bpp()==3) {
98 ::glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,a_img.
width(),a_img.
height(),0,GL_RGB,GL_UNSIGNED_BYTE,a_img.
buffer());
99 }
else if(a_img.
bpp()==4) {
100 ::glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,a_img.
width(),a_img.
height(),0,GL_RGBA,GL_UNSIGNED_BYTE,a_img.
buffer());
102 a_out <<
"tools::sg::gl::tex_img : img.bpp() " << a_img.
bpp() <<
" not treated." << std::endl;