635 |
return val; |
return val; |
636 |
} |
} |
637 |
|
|
638 |
void callGL(const char *str, int intoList) { |
void callGL(const char *str) { |
639 |
DBG(dbg) << "CallGL\n"; |
DBG(dbg) << "CallGL\n"; |
640 |
|
|
641 |
int er = glGetError(); |
int er = glGetError(); |
646 |
return; |
return; |
647 |
} |
} |
648 |
|
|
|
if(intoList > 0) { |
|
|
glNewList(intoList, GL_COMPILE); |
|
|
} |
|
649 |
const char *cur = str; |
const char *cur = str; |
650 |
const char *next; |
const char *next; |
651 |
while((next=strchr(cur, '\n')) != 0) { |
while((next=strchr(cur, '\n')) != 0) { |
655 |
if(strlen(cur) != 0) |
if(strlen(cur) != 0) |
656 |
callGLop(string(cur)); |
callGLop(string(cur)); |
657 |
out: |
out: |
658 |
if(intoList > 0) { |
er = glGetError(); |
659 |
glEndList(); |
if (er != GL_NO_ERROR) |
660 |
} |
{ |
661 |
|
cerr << "OPENGL ERROR " <<gluErrorString(er) |
662 |
|
<<" after executing " << str << "\n"; |
663 |
|
return ; |
664 |
|
} |
665 |
|
return; |
666 |
|
} |
667 |
|
|
668 |
|
void compileGL(const char *str, GLuint intoList) { |
669 |
|
DBG(dbg) << "CallGL\n"; |
670 |
|
|
671 |
|
int er = glGetError(); |
672 |
|
if (er != GL_NO_ERROR) |
673 |
|
{ |
674 |
|
cerr << "OPENGL ERROR " <<gluErrorString(er)<<" before executing " |
675 |
|
<< str << "\n"; |
676 |
|
return; |
677 |
|
} |
678 |
|
|
679 |
|
glNewList(intoList, GL_COMPILE); |
680 |
|
|
681 |
|
callGL(str); |
682 |
|
|
683 |
|
glEndList(); |
684 |
|
|
685 |
|
er = glGetError(); |
686 |
|
if (er != GL_NO_ERROR) |
687 |
|
{ |
688 |
|
cerr << "OPENGL ERROR " <<gluErrorString(er) |
689 |
|
<<" after compiling " << str << "\n"; |
690 |
|
return ; |
691 |
|
} |
692 |
|
return; |
693 |
} |
} |
694 |
|
|
695 |
const char* getString(const char *name) { |
const char* getString(const char *name) { |