Example #1
0
std::vector<std::string> petabricks::IterationDefinition::packedargs() const {
  std::string t[] = {
    "IndexT "COORD_BEGIN_STR"["+jalib::XToString(dimensions())+"]",
    "IndexT "COORD_END_STR"["+jalib::XToString(dimensions())+"]"
  };
  return std::vector<std::string>(t, t+2);
}
/**
 * See also constructor that takes a std::istream.
 */
bool HaarWavelet::write(std::ostream &output) const
{
    if (dimensions() == 0) //won't store a meaningless wavelet
    {
        return false;
    }

    output << dimensions() << ' ';

    bool first = true;
    for (unsigned int i = 0; i < dimensions(); i++)
    {
        if (first)
        {
            first = false;
        }
        else
        {
            output << ' ';
        }
        output << rects[i].x << ' '
               << rects[i].y << ' '
               << rects[i].width << ' '
               << rects[i].height << ' '
               << weights[i];
    }

    return true;
}
Example #3
0
Expr ImageParam::operator()() const {
    user_assert(dimensions() == 0)
        << "Zero-argument access to Buffer " << name()
        << ", which has " << dimensions() << "dimensions.\n";
    std::vector<Expr> args;
    return Internal::Call::make(param, args);
}
int QPushButton::baselinePosition(int height) const
{
    // Button text is centered vertically, with a fudge factor to account for the shadow.

    return (int)ceil(-dimensions()[topMargin]
        + ((height + dimensions()[topMargin] + dimensions()[bottomMargin])) / 2.0
        - dimensions()[baselineFudgeFactor]);
}
Example #5
0
 int DynImage::size(int i) const {
     if (i >= dimensions()) {
         fprintf(stderr,
                 "ERROR: accessing size of dim %d of %d-dimensional image %s\n",
                 i, dimensions(), name().c_str());
         assert(i < dimensions());
     }
     return contents->size[i];
 }
Example #6
0
void Grid::__init() {
	gSize = indexSize();

	if (trueDimensions() != dimensions())
		cout << gridName << ": dim = " << dimensions() << ", trueDim = "
				<< trueDimensions() << ", index range = " << String(getN())
				<< ", index size = " << indexSize() << endl;

}
bool MyHaarWavelet::read(std::istream &input)
{
    if ( !HaarWavelet::read(input) )
    {
        return false;
    }

    means.resize(dimensions());
    for (unsigned int i = 0; i < dimensions(); i++)
    {
        input >> means[i];
    }

    return true;
}
SequenceDataPtr TransposeTransformer::TypedApply(SequenceDataPtr sequence,
                                                 const StreamDescription &inputStream,
                                                 const StreamDescription &outputStream)
{
    assert(inputStream.m_storageType == StorageType::dense);
    auto inputSequence = static_cast<DenseSequenceData&>(*sequence.get());
    assert(inputSequence.m_numberOfSamples == 1);
    assert(inputStream.m_sampleLayout->GetNumElements() == outputStream.m_sampleLayout->GetNumElements());

    size_t count = inputStream.m_sampleLayout->GetNumElements() * GetSizeByType(inputStream.m_elementType);

    auto result = std::make_shared<DenseSequenceWithBuffer>();
    result->m_buffer.resize(count);

    ImageDimensions dimensions(*inputStream.m_sampleLayout, ImageLayoutKind::HWC);
    size_t rowCount = dimensions.m_height * dimensions.m_width;
    size_t channelCount = dimensions.m_numChannels;

    auto src = reinterpret_cast<TElemType*>(inputSequence.m_data);
    auto dst = reinterpret_cast<TElemType*>(result->m_buffer.data());

    for (size_t irow = 0; irow < rowCount; irow++)
    {
        for (size_t icol = 0; icol < channelCount; icol++)
        {
            dst[icol * rowCount + irow] = src[irow * channelCount + icol];
        }
    }

    result->m_sampleLayout = outputStream.m_sampleLayout;
    result->m_data = result->m_buffer.data();
    result->m_numberOfSamples = inputSequence.m_numberOfSamples;
    return result;
}
Example #9
0
void TransposeTransformer::Initialize(TransformerPtr next,
                                      const ConfigParameters &readerConfig)
{
    TransformerBase::Initialize(next, readerConfig);

    // Currently we only support a single stream.
    ImageConfigHelper config(readerConfig);
    size_t featureStreamId = config.GetFeatureStreamId();
    m_appliedStreamIds.push_back(featureStreamId);

    const auto &inputStreams = GetInputStreams();
    m_outputStreams.resize(inputStreams.size());
    std::copy(inputStreams.begin(), inputStreams.end(), m_outputStreams.begin());

    for (auto id : m_appliedStreamIds)
    {
        auto &stream = inputStreams[id];

        ImageDimensions dimensions(*stream->m_sampleLayout, HWC);

        // Changing from NHWC to NCHW
        auto changedStream = std::make_shared<StreamDescription>(*stream);
        changedStream->m_sampleLayout = std::make_shared<TensorShape>(dimensions.AsTensorShape(CHW));
        m_outputStreams[id] = changedStream;
    }
}
Example #10
0
void Player::init(b2World* world, const glm::vec2& position, taengine::SoundEffect jumpEffect) {
	m_hitbox = new Box;
	glm::vec2 dimensions(1.0f, 2.5f);
	static_cast<Box*> (m_hitbox)->init(world, b2_dynamicBody, position, true, false,
		dimensions, 1.0f, 1.0f, 0.0f, false, FixtureTag::PLAYER_BODY, FixtureTag::ALL);

	m_hitbox->getBody()->SetLinearDamping(2.0f);
	m_hitbox->getBody()->SetUserData(this);

	//add foot sensor fixture
	b2PolygonShape polygonShape;
	polygonShape.SetAsBox(0.45f, 0.2f, b2Vec2(0, -1.25f), 0);
	b2FixtureDef fixtureDef;
	fixtureDef.isSensor = true;
	fixtureDef.shape = &polygonShape;
	fixtureDef.filter.categoryBits = FixtureTag::PLAYER_FOOT;
	fixtureDef.filter.maskBits = FixtureTag::WALL | FixtureTag::ENEMY_BODY;
	b2Fixture* footSensorFixture = m_hitbox->getBody()->CreateFixture(&fixtureDef);
	footSensorFixture->SetUserData((void*)3);

	m_tileSheet.init(taengine::ResourceManager::getTexture("Sprites/anya.png"), glm::ivec2(7, 4));
	m_drawDimensions = glm::vec2(3.0f, 3.0f);

	m_jumpEffect = jumpEffect;

	m_animationSpeed = 0.15f;
	m_animationTime = 0.0f;

	m_direction = 1;

	m_footContacts = 0;

	m_killCount = 0;
	m_moveState = PlayerMoveState::STANDING;
}
Example #11
0
void paper_set_units(paper_s *p, units_t ut)
{
    // Sanity check parameters.
  assert(p);
  p->units = ut;
  dimensions(p);
}
Example #12
0
void
TexelStoreGL::
resize_implement(int new_num_layers)
{
  fastuidraw::ivec3 dims(dimensions());
  int old_num_layers(dims.z());

  if(m_texture_as_r8 != 0)
    {
      /* a resize generates a new texture which then has
         a new backing store. The texture view would then
         be using the old backing store which is useless.
         We delete the old texture view and let texture()
         recreate the view on demand.
       */
      glDeleteTextures(1, &m_texture_as_r8);
      m_texture_as_r8 = 0;
    }

  dims.z() = new_num_layers;
  m_backing_store.resize(dims);

  std::vector<uint8_t> right(dims.y(), 0), bottom(dims.x(), 0);
  for(int layer = old_num_layers; layer < new_num_layers; ++layer)
    {
      set_data(dims.x() - 1, 0, layer, //top right
               1, dims.y(), //entire height
               fastuidraw::make_c_array(right));

      set_data(0, dims.y() - 1, layer, //bottom left
               dims.x() - 1, 1, //entire width
               fastuidraw::make_c_array(bottom));
    }
}
Example #13
0
void
BackingStore::
resize_implement(int new_num_layers)
{
  fastuidraw::ivec2 dims(dimensions());
  m_backing_store.resize(dimensions_for_store(dims.x(), new_num_layers));
}
Example #14
0
ImageDataDeserializer::ImageDataDeserializer(const ConfigParameters& config)
{
    ImageConfigHelper configHelper(config);
    m_streams = configHelper.GetStreams();
    assert(m_streams.size() == 2);
    const auto& label = m_streams[configHelper.GetLabelStreamId()];
    const auto& feature = m_streams[configHelper.GetFeatureStreamId()];

    // Expect data in HWC.
    ImageDimensions dimensions(*feature->m_sampleLayout, configHelper.GetDataFormat());
    feature->m_sampleLayout = std::make_shared<TensorShape>(dimensions.AsTensorShape(HWC));

    label->m_storageType = StorageType::sparse_csc;
    feature->m_storageType = StorageType::dense;

    m_featureElementType = feature->m_elementType;
    size_t labelDimension = label->m_sampleLayout->GetDim(0);

    if (label->m_elementType == ElementType::tfloat)
    {
        m_labelGenerator = std::make_shared<TypedLabelGenerator<float>>();
    }
    else if (label->m_elementType == ElementType::tdouble)
    {
        m_labelGenerator = std::make_shared<TypedLabelGenerator<double>>();
    }
    else
    {
        RuntimeError("Unsupported label element type '%d'.", label->m_elementType);
    }

    CreateSequenceDescriptions(configHelper.GetMapPath(), labelDimension);
}
Example #15
0
SummaryConfig::SummaryConfig( const Deck& deck, const EclipseState& es , const ParseContext& parseContext)
    : SummaryConfig( deck,
                        *es.getSchedule(),
                        es.get3DProperties(),
                        parseContext,
                        dimensions( *es.getInputGrid() ) )
{}
Example #16
0
 /// Evaluate gradients of all basis functions associated with
 /// cell at x, writing to grad_f_x. The array grad_f_x must
 /// have size numBasisFunc() * dimensions().  The dimensions()
 /// components of the first basis function gradient come
 /// before the components of the second etc.
 void DGBasisMultilin::evalGrad(const int cell,
                                const double* x,
                                double* grad_f_x) const
 {
     const int dim = dimensions();
     const int num_basis = numBasisFunc();
         const double* cc = grid_.cell_centroids + dim*cell;
         switch (degree_) {
         case 0:
             std::fill(grad_f_x, grad_f_x + num_basis*dim, 0.0);
             break;
         case 1:
             std::fill(grad_f_x, grad_f_x + num_basis*dim, 1.0);
             for (int dd = 0; dd < dim; ++dd) {
                 const double f[2] = { 0.5 - x[dd] + cc[dd],  0.5 + x[dd] - cc[dd] };
                 const double fder[2] = { -1.0,  1.0 };
                 const int divi = 1 << (dim - dd - 1); // { 4, 2, 1 } for 3d, for example.
                 for (int ix = 0; ix < num_basis; ++ix) {
                     const int ind = (ix/divi) % 2;
                     for (int dder = 0; dder < dim; ++dder) {
                         grad_f_x[ix*dim + dder] *= (dder == dd ? fder[ind] : f[ind]);
                     }
                 }
             }
             break;
         default:
             OPM_THROW(std::runtime_error, "Maximum degree is 1 for now.");
         }
 }
void Bloom::captureBackBuffer()
{
	DX::Viewport vp;

	vp.X = vp.Y = 0;
	vp.MinZ = 0;
	vp.MaxZ = 1;
	vp.Width = bbWidth_;
	vp.Height = bbHeight_;

	if ( wasteOfMemory_->valid() && wasteOfMemory_->push() )
	{
		Moo::rc().setViewport( &vp );
		colourScaleParameters_.setTexture( "diffuseMap", FullScreenBackBuffer::renderTarget().pTexture() );	

		if (colourScale_->begin())
		{
			for ( uint32 i=0; i<colourScale_->nPasses(); i++ )
			{
				colourScale_->beginPass(i);
				// note bbc_ always applies pixel-texel alignment correction
				Vector2 tl(0,0);
				Vector2 dimensions((float)bbWidth_,(float)bbHeight_);
				bbc_->draw( tl, dimensions, tl, dimensions, true);
				colourScale_->endPass();
			}
			colourScale_->end();
		}
		
			
		wasteOfMemory_->pop();
	}
}
Example #18
0
void VolumeResample::resampleVolume() {
    tgtAssert(inport_.hasData(), "Inport has not data");
    forceUpdate_ = false;

    if (inport_.getData()->getRepresentation<Volume>()) {

        Volume::Filter filter;
        if (filteringMode_.isSelected("nearest"))
            filter = Volume::NEAREST;
        else if (filteringMode_.isSelected("linear"))
            filter = Volume::LINEAR;
        else if (filteringMode_.isSelected("cubic"))
            filter = Volume::CUBIC;
        else {
            LERROR("Unknown filter mode: " << filteringMode_.get());
            return;
        }        

        tgt::ivec3 dimensions(resampleDimensionX_.get(), resampleDimensionY_.get(), resampleDimensionZ_.get());
        try {
            VolumeHandle* v = VolumeOperatorResample::APPLY_OP(inport_.getData(), dimensions, filter, progressBar_);
            outport_.setData(v);
        }
        catch (const std::bad_alloc&) {
            LERROR("resampleVolume(): bad allocation");
            outport_.setData(0);
        }
    }
    else {
        outport_.setData(0);
    }
}
Example #19
0
void paper_set_orientation(paper_s *p, paper_orientation_t o)
{
    // Sanity check parameters.
  assert(p);
  p->orientation = o;
  dimensions(p);
}
Example #20
0
			void PixelBufferGL15::blitFrom(AE::Graphics::ColorBuffer *source, AE::Math::Point2<AE::uint> srcOffset, AE::Math::Point2<AE::uint> srcDimensions, AE::Math::Point2<AE::int32> const &destPosition)
			{
				assert(srcDimensions.x >= srcOffset.x && 
					   srcDimensions.y >= srcOffset.y);

				void *pixels = source->getData();

				glBindTexture(GL_TEXTURE_2D, mTextureGL);

				AE::int32 y;
				AE::Math::Point2<AE::uint> dimensions(srcDimensions.x - srcOffset.x, srcDimensions.y - srcOffset.y);

				if(AE::Graphics::AxesConvention2d::verticalDirection == AE::Graphics::VD_BOTTOM_TO_TOP)
					y = mDimensions.y - destPosition.y - dimensions.y;
				else
					y = destPosition.y;

				glTexSubImage2D(GL_TEXTURE_2D, 0, 
								destPosition.x, y, 
								dimensions.x, dimensions.y, 
								static_cast<AE::Graphics::Device::PixelBufferGL15 *>(source)->mPixelFormatGL, 
								static_cast<AE::Graphics::Device::PixelBufferGL15 *>(source)->mTypeGL, 
								pixels);

				GLenum error = glGetError();
				assert(error == 0);
			}
Example #21
0
Affine Rect::transformTo(Rect const &viewport, Aspect const &aspect) const
{
    // 1. translate viewbox to origin
    Geom::Affine total = Translate(-min());

    // 2. compute scale
    Geom::Point vdims = viewport.dimensions();
    Geom::Point dims = dimensions();
    Geom::Scale scale(vdims[X] / dims[X], vdims[Y] / dims[Y]);

    if (aspect.align == ALIGN_NONE) {
        // apply non-uniform scale
        total *= scale * Translate(viewport.min());
    } else {
        double uscale = 0;
        if (aspect.expansion == EXPANSION_MEET) {
            uscale = std::min(scale[X], scale[Y]);
        } else {
            uscale = std::max(scale[X], scale[Y]);
        }
        scale = Scale(uscale);

        // compute offset for align
        Geom::Point offset = vdims - dims * scale;
        offset *= Scale(align_factors(aspect.align));
        total *= scale * Translate(viewport.min() + offset);
    }

    return total;
}
Example #22
0
std::ostream& operator<<(std::ostream& stream, const ::core::ndarray<T>& a) {
  if (a.get_rank() > 2) {
    core::multiindex
        indices(a.get_rank() - 2, 0),
        dimensions(a.get_dimensions().begin(),
                   a.get_dimensions().begin() + a.get_rank() - 2);
    std::vector<core::slice> slices(a.get_rank());
    slices[a.get_rank() - 2] =
        core::slice(0, a.get_dimension(a.get_rank() - 2) - 1);
    slices[a.get_rank() - 1] =
        core::slice(0, a.get_dimension(a.get_rank() - 1) - 1);
    do {
      for (std::size_t i(0); i < slices.size() - 2; ++i)
        slices[i] = core::slice(indices[i], indices[i]);
      stream << " showing slice (" << indices << ":, :): " << std::endl;
      stream << core::ndarray<double>(a, slices).squeeze() << std::endl;
    } while (core::increment(indices, dimensions));
  } else {
    for (std::size_t i(0); i < a.get_dimension(0); ++i) {
      stream << "  ";
      for (std::size_t j(0); j < a.get_dimension(1); ++j)
        stream << a.index(i, j) << " ";
      stream << std::endl;
    }
  }
  return stream;
}
Example #23
0
 /// Evaluate all basis functions associated with cell at x,
 /// writing to f_x. The array f_x must have size equal to
 /// numBasisFunc().
 void DGBasisMultilin::eval(const int cell,
                            const double* x,
                            double* f_x) const
 {
     const int dim = dimensions();
     const int num_basis = numBasisFunc();
     const double* cc = grid_.cell_centroids + dim*cell;
     switch (degree_) {
     case 0:
         f_x[0] = 1;
         break;
     case 1:
         std::fill(f_x, f_x + num_basis, 1.0);
         for (int dd = 0; dd < dim; ++dd) {
             const double f[2] = { 0.5 - x[dd] + cc[dd],  0.5 + x[dd] - cc[dd] };
             const int divi = 1 << (dim - dd - 1); // { 4, 2, 1 } for 3d, for example.
             for (int ix = 0; ix < num_basis; ++ix) {
                 f_x[ix] *= f[(ix/divi) % 2];
             }
         }
         break;
     default:
         OPM_THROW(std::runtime_error, "Maximum degree is 1 for now.");
     }
 }
static SoXipDataImage *
createXipImageSingle(SoItkDataImage * xipItkImage, SbXipImage::DataType typeFlag,
		     int bitsPerComp, SbXipImage::ComponentLayoutType compLayout)
{
    typedef typename itk::Image<Type, nDims> ImageType;
    ImageType * itkImage = reinterpret_cast<ImageType *>(xipItkImage->getPointer());

    typename ImageType::RegionType region = itkImage->GetBufferedRegion();

    SbXipImageDimensions dimensions(1, 1, 1);

    for (unsigned int i = 0; i < nDims; ++ i)
    {
	dimensions[i] = region.GetSize()[i];
    }

    SbXipImage* image =
	new SbXipImage(dimensions, typeFlag, bitsPerComp,
		       itkImage->GetBufferPointer(), nComps,
		       SbXipImage::INTERLEAVED, compLayout,
		       xipItkImage->getModelMatrix());

    if (!image) return 0;

    SoXipDataImage * xipImage = new SoXipDataImage;
    xipImage->ref();
    xipImage->addRef(xipItkImage);
    xipImage->set(image);

    return xipImage;
}
void StackedPlot::draw(float width, float height) const {
    ofPushMatrix();
    ofPushStyle();
    int d = dimensions();
    vector<ofMesh> meshes(d);
    for(int i = 0; i < d; i++) {
        meshes[i].setMode(OF_PRIMITIVE_TRIANGLE_STRIP);
    }
    list<vector<float> >::const_iterator itr;
    int i;
    for(itr = history.begin(), i = 0; itr != history.end(); itr++, i++) {
        const vector<float>& cur = *itr;
        for(int j = 0; j < d; j++) {
            meshes[j].addVertex(ofVec2f(i, cur[j]));
            meshes[j].addVertex(ofVec2f(i, cur[j + 1]));
        }
    }
    ofScale(width / (historyLength - 1), height);
    for(int i = 0; i < d; i++) {
        if(colors.size()) {
            ofSetColor(colors[i % colors.size()]);
        } else {
            float hue = ofMap(i, 0, d, 0, 255);
            ofSetColor(ofColor::fromHsb(hue, 255, 255));
        }
        meshes[i].draw();
    }
    ofPopMatrix();
    ofPopStyle();
}
Example #26
0
Vector3D<Precision> UnplacedBox::SamplePointOnSurface() const
{
  Vector3D<Precision> p(dimensions());

  double S[3] = {p[1] * p[2], p[0] * p[2], p[0] * p[1]};

  double rand = (S[0] + S[1] + S[2]) * RNG::Instance().uniform(-1.0, 1.0);

  int axis = 0, direction = rand < 0.0 ? -1 : 1;

  rand = std::abs(rand);

  // rand is guaranteed (by the contract of RNG::Instance().uniform(-1.0, 1.0);)
  // to be less than one of the S[axis] since it starts
  // at a random number between 0 and (S[0] + S[1] + S[2])
  // and each iteration exits or substracts, respectively, S[0] and then S[1]
  // so on the 3rd iteration we have axis==2 and rand <= S[2]
  // Note that an automated tools (clang-tidy for example) will not be
  // able to detect this guarantee and complains about a possible out of
  // bound access (or garbage value).
  while (rand > S[axis])
    rand -= S[axis], axis++;

  p[0] = (axis == 0) ? direction * x() : p[0] * RNG::Instance().uniform(-1.0, 1.0);
  p[1] = (axis == 1) ? direction * y() : p[1] * RNG::Instance().uniform(-1.0, 1.0);
  p[2] = (axis == 2) ? direction * z() : p[2] * RNG::Instance().uniform(-1.0, 1.0);
  return p;
}
Example #27
0
void petabricks::IterationDefinition::fillSplitRegionList(SplitRegionList& regions, SplitRegion& r, unsigned int blockNumber) const {
  int d = r.dimensions();
  if(d<dimensions()) {
    FormulaPtr globalBegin = _begin[d];
    FormulaPtr globalEnd = _end[d];

    // nthPart= (begin-end)/n
    FormulaPtr nthPart = new FormulaDivide (new FormulaSubtract(globalEnd, globalBegin), new FormulaInteger(blockNumber));

    //First block
    FormulaPtr begin = globalBegin;
    FormulaPtr end = new FormulaAdd(begin, nthPart);
    r.push_back(begin, end, 0);
    fillSplitRegionList(regions, r, blockNumber);
    r.pop_back();
    //Other blocks
    for(unsigned int i=1; i<blockNumber; ++i) {
      begin = new FormulaAdd(globalBegin, new FormulaMultiply(nthPart, new FormulaInteger(i)));
      if (i+1 == blockNumber) {
        end = globalEnd;
      }
      else {
        end = new FormulaAdd(globalBegin, new FormulaMultiply(nthPart, new FormulaInteger(i+1)));
      }
      r.push_back(begin, end, i);
      fillSplitRegionList(regions, r, blockNumber);
      r.pop_back();
    }
  }
  else {
    regions.push_back(r);
  }
}
Example #28
0
 Grid::Grid()
  : dimensions_(0),
    offsets_(0),
    size_(0)
 {
    IntVector dimensions(1);
    setDimensions(dimensions); 
 }
void GraphicsObject::showEvent(QShowEvent *) {
    if (!goinitialized) {
        //Under X11, we need to flush the commands sent to the server to ensure that
        //SFML will get an updated view of the windows
            #ifdef Q_WS_X11
        XFlush(QX11Info::display());
        #endif
        #ifdef __APPLE__
        sf::RenderWindow::create(reinterpret_cast<sf::WindowHandle>(winId()));
        #elif __linux__
        sf::RenderWindow::create((sf::WindowHandle)winId());
        #elif __unix__ // all unices not caught above
        sf::RenderWindow::create((sf::WindowHandle)winId());
        #elif _WIN32
        sf::RenderWindow::create(reinterpret_cast<sf::WindowHandle>(winId()));
        #endif
        #ifdef __APPLE__
        sf::Vector2u dimensions(1600, 1200);
//            sf::Vector2u dimensions(1600,1200);
//            sf::Vector2u dimensions(800,600);
        sf::RenderWindow::setSize(dimensions);
        #elif __linux__
        sf::Vector2u dimensions(800, 600);
        sf::RenderWindow::setSize(dimensions);
        #elif __unix__ // all unices not caught above
        sf::Vector2u dimensions(800, 600);
        sf::RenderWindow::setSize(dimensions);
        #elif _WIN32
        sf::Vector2u dimensions(800, 600);
        sf::RenderWindow::setSize(dimensions);
        //set up size?
        #endif

        sf::View view1(sf::FloatRect(0, 0, 800, 600));
        this->setView(view1);

        sf::RenderWindow::display();
        //   QWidget::setFixedSize(800, 600);
        QWidget::showNormal();

        OnInit();
        connect(&gotimer, SIGNAL(timeout()), this, SLOT(repaint()));
        gotimer.start();
        goinitialized = true;
    }
}
Example #30
0
	bool onFrame(){
		gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
		gl.loadIdentity();
		gl.viewport(0,0, dimensions().w, dimensions().h);
		
		gl.begin(gl.LINE_STRIP);
			static float limit = 120;
			for (float i = 0; i<limit; i++) {
				float p = i / limit;
				gl.color(1, p, 1-p);
				p *= 6.283185308;
				gl.vertex(cos(p*freq1), sin(p*freq2), 0);
			}
		gl.end();
//printf("%p: %d x %d\n", this, dimensions().w, dimensions().h);
		return true;
	}