Commit eda66b7c authored by IOhannes m zmölnig's avatar IOhannes m zmölnig

removed pathces applied upstream

parent 770e233a
Author: IOhannes m zmölnig
Description: avoid 'bogus pointer' warnings in [pix_rtx]
Applied-Upstream: 0.93.4
--- gem.orig/src/Pixes/pix_rtx.cpp
+++ gem/src/Pixes/pix_rtx.cpp
@@ -20,7 +20,7 @@
// pix_rtx
//
// this the RealTimeX - transformator, that does a kind of swapping the time and the x axis
-// of a video (or any series of pictures) ON THE FLY
+// of a video (or any series of pictures) ON THE FLY
//
// for more information, on how this works, look at
// http://umlaeute.mur.at/rtx
@@ -49,7 +49,7 @@
//
/////////////////////////////////////////////////////////
pix_rtx :: pix_rtx()
-{
+{
imageStruct image;
image.xsize = image.ysize = 64;
@@ -78,7 +78,7 @@
// CreateBuffer
//
/////////////////////////////////////////////////////////
-void pix_rtx :: create_buffer(imageStruct image)
+void pix_rtx :: create_buffer(const imageStruct&image)
{
size_t dataSize = image.xsize * image.xsize * image.ysize * image.csize * sizeof(unsigned char); // only 1 channel !!, to keep data-size handy
@@ -127,7 +127,7 @@
size_t pixsize = image.ysize * image.xsize;
int cols=image.xsize, c=0, c1=0;
int rows=image.ysize, r=0;
-
+
unsigned char *pixels = image.data;
unsigned char *wp; // write pointer
unsigned char *rp; // read pointer
@@ -136,7 +136,7 @@
if (!set_buffer) {
wp = buffer.data + pixsize * buffer.csize * bufcount;
memcpy(wp, pixels, pixsize * buffer.csize * sizeof(unsigned char));
- } else {
+ } else {
// fill the buffer with the current frame
// this might be useful to prevent the black screen in the beginning.
// "set" message
@@ -158,7 +158,7 @@
while (r < rows) {
rp = buffer.data + buffer.csize * (buffer.xsize * buffer.ysize * c + buffer.xsize * r + (bufcount - c + cols) % cols );
pixels = image.data + image.csize * (image.xsize * r + cols - c1);
-
+
*pixels = *rp;
r++;
}
@@ -172,7 +172,7 @@
while (r < rows) {
rp = buffer.data + buffer.csize * (buffer.xsize * buffer.ysize * c + buffer.xsize * r + (bufcount - c + cols) % cols );
pixels = image.data + image.csize * (image.xsize * r + cols - c1);
-
+
pixels[0] = rp[0];
pixels[1] = rp[1];
r++;
@@ -187,12 +187,12 @@
while (r < rows) {
rp = buffer.data + buffer.csize * (buffer.xsize * buffer.ysize * c + buffer.xsize * r + (bufcount - c + cols) % cols );
pixels = image.data + image.csize * (image.xsize * r + cols - c1);
-
+
pixels[chRed] = rp[chRed];
pixels[chBlue] = rp[chBlue];
pixels[chGreen] = rp[chGreen];
pixels[chAlpha] = rp[chAlpha];
-
+
r++;
}
r=0;
--- gem.orig/src/Pixes/pix_rtx.h
+++ gem/src/Pixes/pix_rtx.h
@@ -3,7 +3,7 @@
GEM - Graphics Environment for Multimedia
Change rtx-transform a series of images (eg: a video or a film)
-
+
Copyright (c) 1997-1999 Mark Danks. mark@danks.org
Copyright (c) Günther Geiger. geiger@epy.co.at
Copyright (c) 2001-2011 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at
@@ -14,15 +14,15 @@
rtx-transform a series of pictures (especially movies, videos,...)
you have to use pix_film instead of pix_movie to make this work with prerecorded videos
-
+
2803:forum::für::umläute:2000
0409:forum::für::umläute:2000
1801:forum::für::umläute:2001 added the second mode
IOhannes m zmoelnig
mailto:zmoelnig@iem.kug.ac.at
-
+
this code is published under the Gnu GeneralPublicLicense that should be distributed with gem & pd
-
+
-----------------------------------------------------------------*/
#ifndef _INCLUDE__GEM_PIXES_PIX_RTX_H_
@@ -37,47 +37,47 @@
KEYWORDS
pix
-
+
DESCRIPTION
-
+
-----------------------------------------------------------------*/
class GEM_EXTERN pix_rtx : public GemPixObj
{
CPPEXTERN_HEADER(pix_rtx, GemPixObj);
-
+
public:
-
+
//////////
// Constructor
pix_rtx();
-
+
protected:
-
+
//////////
// Destructor
virtual ~pix_rtx();
-
+
//////////
// create a buffer that fits to the current imageSize
- virtual void create_buffer(imageStruct image);
-
+ virtual void create_buffer(const imageStruct&image);
+
//////////
// delete the buffer
virtual void delete_buffer();
-
+
//////////
// clear the buffer
virtual void clear_buffer();
-
+
//////////
// Do the processing
virtual void processImage(imageStruct &image);
-
+
//////////
// the huge double buffer and other tx-formation
imageStruct buffer;
int bufcount; // where to read/write
-
+
//////////
// the rtx-mode
bool mode;
@@ -85,13 +85,13 @@
//////////
// fill buffer with current pixbuff ?
bool set_buffer;
-
+
//////////
// the methods
static void modeMessCallback(void *data, t_floatarg newmode);
static void clearMessCallback(void *data);
static void setMessCallback(void *data);
-
+
};
#endif // for header file
Description: cross-compilation safe way to check for PD_(MAJOR|MINOR)_VERSION
Author: Helmut Grohne <helmut@subdivi.de>
Forwarded: not-needed
Reviewed-by: IOhannes m zmölnig
Last-Update: 2018-03-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- pd-gem.orig/m4/gem.m4
+++ pd-gem/m4/gem.m4
@@ -424,26 +424,14 @@
if test "x$with_pdversion" != "x"; then
PD_VERSION="$with_pdversion"
+ PD_MAJORVERSION=$(( $(echo $PD_VERSION | cut -d"." -f1) ))
+ PD_MINORVERSION=$(( $(echo $PD_VERSION | cut -d"." -f2) ))
else
AC_MSG_CHECKING([for Pd-version])
-cat > conftest.c << EOF
-#include <stdio.h>
-#include "m_pd.h"
-int main(){
- printf("%d.%d\n", PD_MAJOR_VERSION, PD_MINOR_VERSION);
- return 0;
-}
-EOF
- if $CXX $CFLAGS -o conftest.o conftest.c > /dev/null 2>&1; then
- PD_VERSION=`./conftest.o`
- else
- PD_VERSION=""
- fi
+ AC_COMPUTE_INT([PD_MAJORVERSION],[PD_MAJOR_VERSION],[#include "m_pd.h"])
+ AC_COMPUTE_INT([PD_MINORVERSION],[PD_MINOR_VERSION],[#include "m_pd.h"])
+ PD_VERSION="$PD_MAJORVERSION.$PD_MINORVERSION"
fi
-
-PD_MAJORVERSION=$(( $(echo $PD_VERSION | cut -d"." -f1) ))
-PD_MINORVERSION=$(( $(echo $PD_VERSION | cut -d"." -f2) ))
-
if test "$PD_MAJORVERSION" -gt 0 -o "$PD_MINORVERSION" -ge 37; then
GEM_RTE_REFERENCEPATH=extra/Gem
else
Description: Fixes to allow autoreconf
configure.ac is somewhat broken with newer autotools.
esp. it requires to test for AC_PROG_OBJCXX if any makefile
suggests building of ObjC++ files
Author: IOhannes m zmölnig
Forwarded: not-needed
Last-Update: 2014-10-04
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- gem.orig/configure.ac
+++ gem/configure.ac
@@ -114,7 +114,7 @@
# Checks for programs.
AC_PROG_CXX
-dnl AC_PROG_OBJCXX
+AC_PROG_OBJCXX
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
Author: IOhannes m zmoelnig
Description: include needed files for select() on kFreeBSD
Forwarded: http://pd-gem.git.sourceforge.net/git/gitweb.cgi?p=pd-gem/Gem;a=commit;h=b41709bafa221c02ddd0e278c9156f443078fdc5
Last-Update: 2012-06-11
--- gem.orig/src/Gem/WorkerThread.cpp
+++ gem/src/Gem/WorkerThread.cpp
@@ -31,7 +31,8 @@
#include "ThreadSemaphore.h"
#include <pthread.h>
-#if defined __linux__ || defined __APPLE__
+#if defined __linux__ || defined __APPLE__ || defined __FreeBSD_kernel__
+# include <sys/types.h>
# include <unistd.h>
# include <sys/time.h>
#endif
--- gem.orig/src/Gem/Dylib.cpp
+++ gem/src/Gem/Dylib.cpp
@@ -25,7 +25,7 @@
#include <string>
#include <stdio.h>
-#if defined __linux__ || defined __APPLE__
+#if defined __linux__ || defined __APPLE__ || defined __FreeBSD_kernel__
#include <unistd.h>
# define DL_OPEN
#endif
Author: IOhannes m zmölnig
Description: include <unistd.h> when missing (gcc-4.7 is picky about that)
--- gem.orig/plugins/recordV4L2/recordV4L2.cpp
+++ gem/plugins/recordV4L2/recordV4L2.cpp
@@ -33,6 +33,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#ifdef HAVE_VIDEO4LINUX2
--- gem.orig/plugins/recordV4L/recordV4L.cpp
+++ gem/plugins/recordV4L/recordV4L.cpp
@@ -32,7 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
-
+#include <unistd.h>
#ifdef HAVE_VIDEO4LINUX
REGISTER_RECORDFACTORY("V4L", recordV4L);
Description: prepare for Pd-0.49
t_symbol->s_name became "const char*"
Author: IOhannes m zmölnig
Forwarded: not-needed
Last-Update: 2018-09-17
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- pd-gem.orig/src/Base/CPPExtern.cpp
+++ pd-gem/src/Base/CPPExtern.cpp
@@ -135,7 +135,7 @@
vsnprintf(buf, MAXPDSTRING-1, fmt, ap);
va_end(ap);
if(NULL!=m_objectname && NULL!=m_objectname->s_name && &s_ != m_objectname){
- char*objname=m_objectname->s_name;
+ const char*objname=m_objectname->s_name;
if(x_obj)
pd_error(x_obj, "[%s]: %s", objname, buf);
else if (m_holder)
--- pd-gem.orig/src/Base/TextBase.cpp
+++ pd-gem/src/Base/TextBase.cpp
@@ -400,7 +400,7 @@
line+=c;
}
} else {
- char*sp=atom_getsymbol(&argv[i])->s_name;
+ const char*sp=atom_getsymbol(&argv[i])->s_name;
try {
std::wstring ws=toWstring(sp);
line+=ws;
--- pd-gem.orig/src/Controls/gemwin.cpp
+++ pd-gem/src/Controls/gemwin.cpp
@@ -135,7 +135,7 @@
GemMan::pleaseDestroy=false;
if (s != &s_)
- disp = s->s_name;
+ disp = (char*)s->s_name;
if ( !GemMan::windowExists() ) {
GemMan::createContext(disp);
--- pd-gem.orig/src/Gem/Event.cpp
+++ pd-gem/src/Gem/Event.cpp
@@ -458,7 +458,7 @@
}
GEM_EXTERN void triggerKeyboardEvent(char *string, int value, int state)
{
- addEvent(KEYBOARD, gensym(string)->s_name, 0, 0, state, 0, value, 0);
+ addEvent(KEYBOARD, (char*)gensym(string)->s_name, 0, 0, state, 0, value, 0);
}
GEM_EXTERN void triggerResizeEvent(int xSize, int ySize)
{
--- pd-gem.orig/src/Gem/Setup.cpp
+++ pd-gem/src/Gem/Setup.cpp
@@ -110,7 +110,7 @@
return;
}
- char*mypath = 0;
+ const char*mypath = 0;
t_class *c = class_new(gensym("Gem"), 0, 0, 0, 0, A_NULL);
#ifdef HAVE_S_STUFF_H
mypath=c->c_externdir->s_name;
--- pd-gem.orig/src/Geos/multimodel.cpp
+++ pd-gem/src/Geos/multimodel.cpp
@@ -145,7 +145,7 @@
char postName[256];
int i = 0;
- char *strPtr = filename->s_name;
+ const char *strPtr = filename->s_name;
while (strPtr[i] && strPtr[i] != '*') {
preName[i] = strPtr[i];
i++;
--- pd-gem.orig/src/Geos/scopeXYZ~.cpp
+++ pd-gem/src/Geos/scopeXYZ~.cpp
@@ -185,7 +185,7 @@
/////////////////////////////////////////////////////////
void scopeXYZ :: typeMess(t_symbol *type)
{
- char*s=type->s_name;
+ const char*s=type->s_name;
char c=*s;
switch(c){
case 'd': // default
--- pd-gem.orig/src/Particles/part_source.cpp
+++ pd-gem/src/Particles/part_source.cpp
@@ -51,7 +51,7 @@
/////////////////////////////////////////////////////////
void part_source :: domainMess(t_symbol*s)
{
- char *str=s->s_name;
+ const char *str=s->s_name;
if (!strcmp(str,"point" ))m_domain=PDPoint;
else if (!strcmp(str,"line" ))m_domain=PDLine;
--- pd-gem.orig/src/Particles/part_velocity.cpp
+++ pd-gem/src/Particles/part_velocity.cpp
@@ -64,7 +64,7 @@
}
void part_velocity :: domainMess(t_symbol*s){
- char *str=s->s_name;
+ const char *str=s->s_name;
if (!strcmp(str,"point" ))m_domain=PDPoint;
else if (!strcmp(str,"line" ))m_domain=PDLine;
else if (!strcmp(str,"triangle" ))m_domain=PDTriangle;
--- pd-gem.orig/src/Pixes/pix_convert.cpp
+++ pd-gem/src/Pixes/pix_convert.cpp
@@ -86,7 +86,7 @@
}
void pix_convert :: colorMessCallback(void *data, t_symbol*s)
{
- int fo = getPixFormat(s->s_name);
+ int fo = getPixFormat((char*)s->s_name);
if(fo)GetMyClass(data)->m_image.setCsizeByFormat(fo);
GetMyClass(data)->setPixModified();
}
--- pd-gem.orig/src/Pixes/pix_film.cpp
+++ pd-gem/src/Pixes/pix_film.cpp
@@ -338,7 +338,7 @@
closeMess();
char buff[MAXPDSTRING];
- char*buf=buff;
+ const char*buf=buff;
// we first try to find the file-to-open with canvas_makefilename
// if this fails, we just pass the given filename (could be a stream)
canvas_makefilename(const_cast<t_canvas*>(getCanvas()), filename->s_name, buff, MAXPDSTRING);
--- pd-gem.orig/src/Pixes/pix_freeframe.cpp
+++ pd-gem/src/Pixes/pix_freeframe.cpp
@@ -753,7 +753,7 @@
m_canopen=true;
return;
}
- char *pluginname = s->s_name;
+ const char *pluginname = s->s_name;
m_plugin = new FFPlugin(pluginname, getCanvas());
m_image.setCsizeByFormat(m_plugin->GLformat());
@@ -919,7 +919,7 @@
v=atom_getfloat(value);
break;
case (A_SYMBOL):
- v=atom_getsymbol(value)->s_name;
+ v=(char*)atom_getsymbol(value)->s_name;
break;
default:
return;
@@ -947,9 +947,9 @@
::verbose(2, "freeframe_loader: %s",(s?(s->s_name):"<none>"));
try{ \
Obj_header *obj = new (pd_new(pix_freeframe_class),(void *)NULL) Obj_header;
- char*realname=s->s_name+offset_pix_; /* strip of the leading 'pix_' */
+ const char*realname=s->s_name+offset_pix_; /* strip of the leading 'pix_' */
CPPExtern::m_holder = &obj->pd_obj;
- CPPExtern::m_holdname=s->s_name;
+ CPPExtern::m_holdname=(char*)s->s_name;
obj->data = new pix_freeframe(gensym(realname));
CPPExtern::m_holder = NULL;
CPPExtern::m_holdname=NULL;
--- pd-gem.orig/src/Pixes/pix_frei0r.cpp
+++ pd-gem/src/Pixes/pix_frei0r.cpp
@@ -301,7 +301,7 @@
m_canopen=true;
return;
}
- char *pluginname = s->s_name;
+ const char *pluginname = s->s_name;
m_plugin = new F0RPlugin(pluginname, getCanvas());
@@ -495,9 +495,9 @@
::verbose(2, "frei0r_loader: %s",(s?(s->s_name):"<none>"));
try{ \
Obj_header *obj = new (pd_new(pix_frei0r_class),(void *)NULL) Obj_header;
- char*realname=s->s_name+offset_pix_; /* strip of the leading 'pix_' */
+ const char*realname=s->s_name+offset_pix_; /* strip of the leading 'pix_' */
CPPExtern::m_holder = &obj->pd_obj;
- CPPExtern::m_holdname=s->s_name;
+ CPPExtern::m_holdname=(char*)s->s_name;
obj->data = new pix_frei0r(gensym(realname));
CPPExtern::m_holder = NULL;
CPPExtern::m_holdname=NULL;
--- pd-gem.orig/src/Pixes/pix_multiimage.cpp
+++ pd-gem/src/Pixes/pix_multiimage.cpp
@@ -115,7 +115,7 @@
char postName[256];
int i = 0;
- char *strPtr = filename->s_name;
+ const char *strPtr = filename->s_name;
while (strPtr[i] && strPtr[i] != '*')
{
preName[i] = strPtr[i];
--- pd-gem.orig/src/Pixes/pix_record.cpp
+++ pd-gem/src/Pixes/pix_record.cpp
@@ -50,7 +50,7 @@
result=atom_getfloat(ap);
break;
case A_SYMBOL:
- result=atom_getsymbol(ap)->s_name;
+ result=(char*)atom_getsymbol(ap)->s_name;
break;
default:
result=ap->a_w.w_gpointer;
--- pd-gem.orig/src/Pixes/pix_sig2pix.cpp
+++ pd-gem/src/Pixes/pix_sig2pix.cpp
@@ -197,7 +197,7 @@
}
void pix_sig2pix ::csMessCallback(void *data, t_symbol*s)
{
- int cs = getPixFormat(s->s_name);
+ int cs = getPixFormat((char*)s->s_name);
if(cs>0)GetMyClass(data)->csMess(cs);
else GetMyClass(data)->error("colorspace must be Grey, YUV or RGBA");
}
--- pd-gem.orig/src/Pixes/pix_video.cpp
+++ pd-gem/src/Pixes/pix_video.cpp
@@ -471,7 +471,7 @@
result=atom_getfloat(ap);
break;
case A_SYMBOL:
- result=atom_getsymbol(ap)->s_name;
+ result=(char*)atom_getsymbol(ap)->s_name;
break;
default:
result=ap->a_w.w_gpointer;
--- pd-gem.orig/src/openGL/GEMglProgramStringARB.cpp
+++ pd-gem/src/openGL/GEMglProgramStringARB.cpp
@@ -30,7 +30,7 @@
switch (argc) {
default:
case 4:
- string = reinterpret_cast<GLvoid*>(atom_getsymbol(argv+3)->s_name);
+ string = (atom_getsymbol(argv+3)->s_name);
case 3:
len=atom_getint(argv+2);
case 2:
@@ -91,7 +91,7 @@
}
void GEMglProgramStringARB :: stringMess (t_symbol* arg1) { // FUN
- string = reinterpret_cast<GLvoid*>(arg1->s_name);
+ string = (arg1->s_name);
setModified();
}
--- pd-gem.orig/src/openGL/GEMglProgramStringARB.h
+++ pd-gem/src/openGL/GEMglProgramStringARB.h
@@ -50,7 +50,7 @@
GLsizei len; // VAR
virtual void lenMess(t_float); // FUN
- GLvoid *string; // VAR
+ const GLvoid *string; // VAR
virtual void stringMess(t_symbol*); // FUN
Author: IOhannes m zmölnig
Description: fixed regression bug where [pix_film] would take no argument
Bug: http://sourceforge.net/tracker/index.php?func=detail&aid=3473016&group_id=64325&atid=507079
Applied-Upstream: 0.93.4
--- gem.orig/src/Pixes/pix_film.cpp
+++ gem/src/Pixes/pix_film.cpp
@@ -210,6 +210,11 @@
verbose(1, "%s support", m_ids[i].c_str());
}
firsttime=false;
+
+
+ if(filename && gensym("") != filename) {
+ openMess(filename, 0, -1);
+ }
}
/////////////////////////////////////////////////////////
Description: Reproducible builds
override __DATE__ with a reproducible value
Author: IOhannes m zmölnig
Origin: upstream
Forwarded: not-needed
Last-Update: 2016-04-15
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- gem.orig/src/Gem/Setup.cpp
+++ gem/src/Gem/Setup.cpp
@@ -100,13 +100,17 @@
static void Gem_addownpath(const char*filename) { }
#endif
+#ifndef BUILD_DATE
+# define BUILD_DATE " on " __DATE__
+#endif
+
GEM_EXTERN void Gem_setup()
{
// startup GEM
post("GEM: Graphics Environment for Multimedia");
post("GEM: ver: %s", GemVersion::versionString());
- post("GEM: compiled: " __DATE__);
+ post("GEM: compiled " BUILD_DATE);
post("GEM: maintained by %s", GEM_MAINTAINER);
post("GEM: Authors :\tMark Danks (original version)");
for(unsigned int i=0; i<sizeof(GEM_AUTHORS)/sizeof(*GEM_AUTHORS); i++) {
--- gem.orig/configure.ac
+++ gem/configure.ac
@@ -405,8 +405,15 @@
fi
-
-
+## allow to override the build date string
+AC_ARG_WITH([build-date],
+ AC_HELP_STRING([--with-build-date=<str>],
+ [alternative date string]))
+AC_MSG_CHECKING([build-date])
+AS_IF([test "x$with_build_date" = "xyes" ],[with_build_date=""])
+AS_IF([test "x$with_build_date" = "xno" ],[with_build_date=""])
+AS_IF([test "x$with_build_date" != "x" ],
+ [AC_DEFINE_UNQUOTED([BUILD_DATE], ["$with_build_date"], [user-defined build-date string])])
# enabling "-freg-struct-return" (for FreeFrame)
# i wonder could we make this the default ???
Author: IOhannes m zmoelnig <zmoelnig@umlautO.umlaeute.mur.at>
Description: check whether querying the matrix depths is really possible
and if not, stop throwing an error for each render-cycle;
this has been backported from upstream's HEAD
Forwarded: not-needed
--- gem.orig/src/Gem/GLStack.cpp
+++ gem/src/Gem/GLStack.cpp
@@ -25,6 +25,8 @@
/* need GLUtil for glReportError */
#include "Gem/GemGL.h"
#include "Utils/GLUtil.h"
+#include <map>
+
#define GLDEBUG if(glReportError())::startpost("glError @ %s:%d[%s] ", __FILE__, __LINE__, __FUNCTION__), ::post
using namespace gem;
@@ -46,76 +48,39 @@
};
};
-static GLenum id2maxdepth(enum GLStack::GemStackId id) {
- GLenum result=0;
- switch(id) {
- case GLStack::MODELVIEW:
- result=GL_MAX_MODELVIEW_STACK_DEPTH;
- break;
- case GLStack::PROJECTION:
- result=GL_MAX_PROJECTION_STACK_DEPTH;
- break;
- case GLStack::TEXTURE:
- result=GL_MAX_TEXTURE_STACK_DEPTH;
- break;
- case GLStack::COLOR:
- result=GL_MAX_COLOR_MATRIX_STACK_DEPTH;
- break;
- default:
- // ::error("GLStack: illegal stack matrix: %d");
- break;
- }
- return result;
-}
-
-
-static GLenum id2depth(enum GLStack::GemStackId id) {
- GLenum result=0;
- switch(id) {
- case GLStack::MODELVIEW:
- result=GL_MODELVIEW_STACK_DEPTH;
- break;
- case GLStack::PROJECTION:
- result=GL_PROJECTION_STACK_DEPTH;
- break;
- case GLStack::TEXTURE:
- result=GL_TEXTURE_STACK_DEPTH;
- break;
- case GLStack::COLOR:
- result=GL_COLOR_MATRIX_STACK_DEPTH;
- break;
- default:
- // ::error("GLStack: illegal stack matrix: %d");
- break;
- }
- return result;
-}
-
-
-static GLenum id2mode(enum GLStack::GemStackId id) {
- GLenum result=0;
- switch(id) {
- case GLStack::MODELVIEW:
- result=GL_MODELVIEW;
- break;
- case GLStack::PROJECTION:
- result=GL_PROJECTION;
- break;
- case GLStack::TEXTURE:
- result=GL_TEXTURE;
- break;
- case GLStack::COLOR:
- result=GL_COLOR;
- break;
- default:
- // ::error("GLStack: illegal stack matrix: %d");
- break;
- }
- return result;
+namespace {
+ static std::map<enum GLStack::GemStackId, GLenum>s_id2mode;
+ static std::map<enum GLStack::GemStackId, GLenum>s_id2depth;
+ static std::map<enum GLStack::GemStackId, GLenum>s_id2maxdepth;
+ static std::map<enum GLStack::GemStackId, bool>s_id2init;
}
GLStack:: GLStack(bool haveValidContext) : data(new Data()) {
+ static bool firsttime=true;
+ if(firsttime) {
+ s_id2mode[MODELVIEW] =GL_MODELVIEW;
+ s_id2mode[PROJECTION]=GL_PROJECTION;
+ s_id2mode[TEXTURE] =GL_TEXTURE;
+ s_id2mode[COLOR] =GL_COLOR;
+
+ s_id2depth[MODELVIEW] =GL_MODELVIEW_STACK_DEPTH;
+ s_id2depth[PROJECTION]=GL_PROJECTION_STACK_DEPTH;
+ s_id2depth[TEXTURE] =GL_TEXTURE_STACK_DEPTH;
+ s_id2depth[COLOR] =GL_COLOR_MATRIX_STACK_DEPTH;
+
+ s_id2maxdepth[MODELVIEW] =GL_MAX_MODELVIEW_STACK_DEPTH;
+ s_id2maxdepth[PROJECTION]=GL_MAX_PROJECTION_STACK_DEPTH;
+ s_id2maxdepth[TEXTURE] =GL_MAX_TEXTURE_STACK_DEPTH;
+ s_id2maxdepth[COLOR] =GL_MAX_COLOR_MATRIX_STACK_DEPTH;
+
+ s_id2init[MODELVIEW] =false;
+ s_id2init[PROJECTION]=false;
+ s_id2init[TEXTURE] =false;
+ s_id2init[COLOR] =false;
+ }
+ firsttime=false;
+
if(haveValidContext) {
reset();
}
@@ -129,7 +94,7 @@
// changing the texunit (e.g. in [pix_texture]) makes the
// local depthcounter a useless, and we get a lot of
// stack under/overflows
-#endif
+#endif
/** push the given matrix to the stack if the maximum has not been reached
@@ -137,7 +102,7 @@
* NOTE: needs valid openGL context
*/
bool GLStack::push(enum GemStackId id) {