Esempio n. 1
0
void pix_filmOS :: openMess(t_symbol *filename, int format)
{
  //  if (filename==x_filename)return;
  x_filename=filename;
  if (format)m_colorspace=format;

  char buf[MAXPDSTRING];
  canvas_makefilename(const_cast<t_canvas*>(getCanvas()), filename->s_name, buf, MAXPDSTRING);

  // Clean up any open files
  closeMess();

  m_haveMovie = GEM_MOVIE_NONE;
  realOpen(buf);
  if (m_haveMovie == GEM_MOVIE_NONE)return;
  
#ifndef __APPLE__
  createBuffer();
  prepareTexture();
#endif

  t_atom ap[3];
  SETFLOAT(ap, m_numFrames);
  SETFLOAT(ap+1, m_xsize);
  SETFLOAT(ap+2, m_ysize);

  m_newFilm = 1;
  post("loaded file: %s with %d frames (%dx%d)", buf, m_numFrames, m_xsize, m_ysize);
  outlet_list(m_outNumFrames, 0, 3, ap);
}
Esempio n. 2
0
void pix_movieDS::openMess(t_symbol *filename, int format)
{
//	if (filename == x_filename)
//	{
//		return;
//	}

	x_filename	= filename;

	if (format)
	{
		m_colorspace	= format;
	}

	char buf[MAXPDSTRING];
	canvas_makefilename(getCanvas(), filename->s_name, buf, MAXPDSTRING);

	// Clean up any open files
	closeMess();

	realOpen(buf);

	if (FALSE == m_haveMovie)
	{
		return;
	}

	t_atom	ap[3];

	SETFLOAT(ap, m_numFrames);
	SETFLOAT(ap+1, m_xsize);
	SETFLOAT(ap+2, m_ysize);

	m_newFilm	= 1;
}
Esempio n. 3
0
/////////////////////////////////////////////////////////
// Destructor
//
/////////////////////////////////////////////////////////
pix_frei0r :: ~pix_frei0r()
{
  while(!m_inlet.empty()) {
    t_inlet*in=m_inlet.back();
    if(in)inlet_free(in);
    m_inlet.pop_back();
  }
  closeMess();
}
Esempio n. 4
0
/////////////////////////////////////////////////////////
// Destructor
//
/////////////////////////////////////////////////////////
pix_freeframe :: ~pix_freeframe()
{
#ifndef DONT_WANT_FREEFRAME
  while(!m_inlet.empty()) {
    t_inlet*in=m_inlet.back();
    if(in)inlet_free(in);
    m_inlet.pop_back();
  }
  closeMess();
#endif /* DONT_WANT_FREEFRAME */
}
Esempio n. 5
0
void glsl_vertex :: openMess(t_symbol *filename)
{
  if(NULL==filename || NULL==filename->s_name)return;
  if(&s_==filename)return;

  if( !GLEW_VERSION_1_1 ) { /* stupid check whether we have a valid context */
    post("shader '%s' will be loaded when rendering is turned on (openGL context needed)", filename->s_name);
    m_shaderFilename=filename;
    return;
  }

  if(!isRunnable()) {
    return;
  }

  // Clean up any open files
  closeMess();

  std::string fn = findFile(filename->s_name);
  const char*buf=fn.c_str();

  FILE *file = fopen(buf,"rb");
  if(file) {
    fseek(file,0,SEEK_END);
    long size = ftell(file);
    if(size<0){fclose(file);error("error reading filesize");return;}
    m_shaderString = new char[size + 1];
    memset(m_shaderString,0,size + 1);
    fseek(file,0,SEEK_SET);
    size_t count=fread(m_shaderString,1,size,file);
    int err=ferror(file);
    fclose(file);
    if(err){error("error %d reading file (%d<%d)", err, count, size); return;}
  } else {
    error("could not find shader-file: '%s'", buf);
    return;
    /*
      // assuming that the "filename" is actually a shader-program per se
      m_shaderString = new char[strlen(buf) + 1];
      strcpy(m_shaderString,buf);
    */
  }
  m_size=strlen(m_shaderString);

  if(GLEW_VERSION_2_0)
    openMessGL2();
  else if (GLEW_ARB_vertex_shader) 
    openMessARB();

  logpost(NULL, 5, "Loaded file: %s", buf);
  m_shaderFilename=NULL;
}
Esempio n. 6
0
void vertex_program :: openMess(t_symbol *filename)
{
    if(NULL==filename || NULL==filename->s_name || &s_==filename || 0==*filename->s_name)return;

    // Clean up any open files
    closeMess();
    m_buf = findFile(filename->s_name);

    FILE *file = fopen(m_buf.c_str(),"rb");
    if(file) {
        fseek(file,0,SEEK_END);
        long size = ftell(file);
        if(size<0) {
            fclose(file);
            error("error reading filesize");
            return;
        }
        m_programString = new char[size + 1];
        memset(m_programString,0,size + 1);
        fseek(file,0,SEEK_SET);
        size_t count = fread(m_programString,1,size,file);
        m_programString[size]='\0';
        int err=ferror(file);
        fclose(file);
        if(err) {
            error("error %d reading file (%d<%d)", err, count, size);
            return;
        }
    } else {
        m_programString = new char[strlen(m_buf.c_str()) + 1];
        strcpy(m_programString,m_buf.c_str());
    }
    m_size=strlen(m_programString);
    m_programType=queryProgramtype(m_programString);
    if(m_programType==GEM_PROGRAM_none) {
        m_programID = 0;
        char *s = m_programString;
        while(*s && *s != '\n') s++;
        *s = '\0';
        post("unknown program header \"%s\" or error open \"%s\" file\n",
             m_programString,
             filename->s_name);

        delete[] m_programString;
        m_programString=NULL;
        m_size=0;
        return;
    }

    post("Loaded file: %s\n", m_buf.c_str());
}
Esempio n. 7
0
void glsl_vertex :: loadShader()
{
  if(NULL==m_shaderFilename || NULL==m_shaderFilename->s_name)return;

  if(!isRunnable()) {
    return;
  }

  // Clean up any open files
  closeMess();

  std::string fn = findFile(m_shaderFilename->s_name);
  const char*buf=fn.c_str();

  FILE *file = fopen(buf,"rb");
  if(file) {
    fseek(file,0,SEEK_END);
    long size = ftell(file);
    if(size<0){fclose(file);error("error reading filesize");return;}
    m_shaderString = new char[size + 1];
    memset(m_shaderString,0,size + 1);
    fseek(file,0,SEEK_SET);
    size_t count=fread(m_shaderString,1,size,file);
    m_shaderString[size]='\0';
    int err=ferror(file);
    fclose(file);
    if(err){error("error %d reading file (%d<%d)", err, count, size); return;}
  } else {
    error("could not find shader-file: '%s'", buf);
    return;
    /*
      // assuming that the "filename" is actually a shader-program per se
      m_shaderString = new char[strlen(buf) + 1];
      strcpy(m_shaderString,buf);
    */
  }
  m_size=strlen(m_shaderString);

  if(GLEW_VERSION_2_0)
    openMessGL2();
  else if (GLEW_ARB_vertex_shader)
    openMessARB();

  verbose(1, "Loaded file: %s", buf);
  m_shaderFilename=NULL;
}
Esempio n. 8
0
pix_movieDS::~pix_movieDS(void)
{
	closeMess();

	// Release IMediaControl interface
	if (MediaControl != NULL)
	{
		MediaControl->Release();

		MediaControl	= NULL;
	}

	// Release IMediaSeeking interface
	if (MediaSeeking != NULL)
	{
		MediaSeeking->Release();

		MediaSeeking	= NULL;
	}

	// Release IMediaPosition interface
	if (MediaPosition != NULL)
	{
		MediaPosition->Release();

		MediaPosition	= NULL;
	}

	// Release base FilterGraph
	if (FilterGraph != NULL)
	{
		FilterGraph->Release();

		FilterGraph	= NULL;
	}

	// Release COM
	CoUninitialize();
}
Esempio n. 9
0
////////////////////////////////////////////////////////
// Destructor
//
/////////////////////////////////////////////////////////
glsl_vertex :: ~glsl_vertex()
{
  closeMess();
}
Esempio n. 10
0
/////////////////////////////////////////////////////////
// Destructor
//
/////////////////////////////////////////////////////////
pix_movieOS :: ~pix_movieOS()
{
  // Clean up the movie
  closeMess();
  deleteBuffer();
}
Esempio n. 11
0
////////////////////////////////////////////////////////
// Destructor
//
/////////////////////////////////////////////////////////
vertex_program :: ~vertex_program()
{
    closeMess();
}
Esempio n. 12
0
////////////////////////////////////////////////////////
// Destructor
//
/////////////////////////////////////////////////////////
glsl_geometry :: ~glsl_geometry()
{
  closeMess();
}
Esempio n. 13
0
void glsl_geometry :: openMess(t_symbol *filename)
{
  if(NULL==filename || NULL==filename->s_name)return;
  if(&s_==filename)return;
  if( !GLEW_VERSION_1_1 ) { /* stupid check whether we have a valid context */
    post("shader '%s' will be loaded when rendering is turned on (openGL context needed)", filename->s_name);
    m_shaderFilename=filename;
    return;
  }

  if(!isRunnable()) {
    return;
  }

  // Clean up any open files
  closeMess();

  std::string fn = findFile(filename->s_name);
  const char*buf=fn.c_str();

  FILE *file = fopen(buf,"rb");
  if(file) {
    fseek(file,0,SEEK_END);
    long size = ftell(file);
    if(size<0){fclose(file);error("error reading filesize");return;}
    m_shaderString = new char[size + 1];
    memset(m_shaderString,0,size + 1);
    fseek(file,0,SEEK_SET);
    size_t count=fread(m_shaderString,1,size,file);
    m_shaderString[size]='\0';
    int err=ferror(file);
    fclose(file);
    if(err){error("error %d reading file (%d<%d)", err, count, size); return;}
  } else {
    error("could not find shader-file: '%s'", buf);
    return;
    /*
      // assuming that the "filename" is actually a shader-program per se
      m_shaderString = new char[strlen(buf) + 1];
      strcpy(m_shaderString,buf);
    */
  }
  m_size=strlen(m_shaderString);

  if(GLEW_EXT_geometry_shader4) // GLEW_VERSION_2_1
    openMessGL2();
  else if (GLEW_ARB_geometry_shader4)
    openMessARB();

  verbose(1, "Loaded file: %s", buf);
  m_shaderFilename=NULL;

  if (m_shader || m_shaderARB)
    {
      t_atom a;
      // send shaderID to outlet
      gem::utils::glsl::atom_setshader(a, m_shader?m_shader:m_shaderARB);

      outlet_list(m_outShaderID, gensym("list"), 1, &a);
    }
}
Esempio n. 14
0
/////////////////////////////////////////////////////////
// Destructor
//
/////////////////////////////////////////////////////////
pix_movie :: ~pix_movie()
{
  // Clean up the movie
  closeMess();
}