Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - S0lll0s

Pages: [1]
1
C / C++ /C# / Re: jelly vector / dragon ball
« on: April 11, 2013 »
Processing (Java) jellycube:

Code: [Select]
int count = 0;
int speed = 1;
int distance = 0;
boolean strok = true;
boolean freerot = false;

void setup() {
  size( 500, 500, P3D );
}

void draw() {
  background( 120 );
  translate( width / 2, height / 2 + 100, distance );

  count += speed;

  if ( !freerot )
    rotate( sin( count / 341.0 ), 0.2, 1.0, 0 );
  else {
    rotate( ( mouseX - width / 2 ) / float( width ) * 2, 0.0, 1.0, 0.0 );
    rotate( ( mouseY - height / 2 ) / 1000.0, -0.3, 0.0, 0.0 );
  }

  if ( strok )
    strokeWeight( 1 );
  else
    noStroke();
 
  scale( 10, 10, 10 );
  scale( 1, -1 + sin( count / 100.0 * PI ) * 0.2, 1 );
 
  lights();
 
  fill( 80, 80, 80, 130 );
  box( 400, 2, 400 );
 
  fill( 255 );
  for ( int y = 0; y < 9; y++ ) {
    float xz  = sin ( ( y ) * PI / 9.0     ) * sin( count / 100.0 * PI ) * 0.2 + 1.0;
    float xzz = sin ( ( y + 1 ) * PI / 9.0 ) * sin( count / 100.0 * PI ) * 0.2 + 1.0;
    if ( xz == 0 )
      xz = 0.01;
    if ( xzz == 0 )
      xzz = 0.01;
 
    translate( 0, 2, 0 );
 
    //back wall
    beginShape();
    vertex( -10 * xz, -1, -10 * xz );
    vertex( -10 * xzz, 1, -10 * xzz );
    vertex(  10 * xzz, 1, -10 * xzz );
    vertex(  10 * xz, -1, -10 * xz );
    endShape();
 
    //front wall
    beginShape();
    vertex( -10 * xz, -1, 10 * xz );
    vertex( -10 * xzz, 1, 10 * xzz );
    vertex(  10 * xzz, 1, 10 * xzz );
    vertex(  10 * xz, -1, 10 * xz );
    endShape();
 
    //left wall
    beginShape();
    vertex( -10 * xz, -1, -10 * xz );
    vertex( -10 * xzz, 1, -10 * xzz );
    vertex( -10 * xzz, 1, 10 * xzz );
    vertex( -10 * xz, -1, 10 * xz );
    endShape();
 
    //right wall
    beginShape();
    vertex(  10 * xz, -1, -10 * xz );
    vertex(  10 * xzz, 1, -10 * xzz );
    vertex(  10 * xzz, 1, 10 * xzz );
    vertex(  10 * xz, -1, 10 * xz );
    endShape();
  }
 
  //top
  beginShape();
  vertex( -10, 1, -10 );
  vertex( -10, 1, 10 );
  vertex(  10, 1, 10 );
  vertex(  10, 1, -10 );
  endShape();
 
  fill( 80, 80, 80, 130 );
  translate( 0, 2, 0 );
  box( 400, 2, 400 );
 
  count += speed;
}

void keyPressed() {
  if ( key == ' ' )
    freerot = !freerot;
  else if ( key == 's' || key == 'S' )
    strok = !strok;
  else if ( key == CODED ) {
    if ( keyCode == LEFT )
      speed++;
    else if ( keyCode == RIGHT )
      speed--;
    else if ( keyCode == UP )
      distance += 20;
    else if ( keyCode == DOWN )
      distance -= 20;
  }
}

2
by growing I mean starting very short and progressively get longer.
Well, I guess you're already able to draw a short line and a long line.
So I'm pretty sure you can draw any length in between, too...
And what you're asking for is varying the length over time.
[/quote]

Anyways, thanks for that link. I tried to find a good introduction to splines and this seems worth the read, I could only find spline librarys and extremely mathematical info.

3
Quote
my Syncing works pretty well for the first ~50seconds, but then it slowly drifts off and gets really bad.

Hi S0lll0s,

[...]
And a green hexagon is flashing to the beat.
Should be possible to get the rest working from here on.
Thank you, I moved on with the graphics but synchronization still didn't work, I will try this now.

how do I draw "thick" lines in OpenGL?
You call glLineWidth with the desired width.
I meant curves that look smooth, like the grey in this one:


and make them grow?

 ;D  ;D

4
C / C++ /C# / Re: [C++] Fauntastic! Intro Source
« on: April 04, 2013 »
Looks really nice, but I find your code close to unreadable.
I am unexperienced in reading demo code, but this really does look complicated ^^

5
I am starting my first (2d) demo now, and I get along pretty well except for major synchronization problems.

I do not have a graphics timer, I base all my graphics on the current audio time as I only play a mp3 for my first demo.

The libraries I use are SDL with OpenGL and BASS as an Audio Library. I am creating my own engine from scratch.
The music for my demo is Awolnation - Sail, so you should go ahead and obtain a mp3 of that song (legally of course) and put it as sail.mp3 in the binary folder if you want to test it.

I know that Sail is 119 BPM and my Syncing works pretty well for the first ~50seconds, but then it slowly drifts off and gets really bad. It should draw a green Hexagon every when the kick starts (and every 2nd bar before that too).

This is how I check if the kick just kick'd:
Code: [Select]
       int millis = (int)( time * 1000.0f ); //time is the playback pos in seconds (double)
        int everyX = (int)( 119.0 / 60.0f * 1000.0f ); //everyX is the time it takes for a bar to pass
       
        if ( ( millis + everyX / 4 + everyX ) % ( everyX * 2 ) < 80 ) //The song starts with an offset and I want every 2nd bar
            return true;

6
General chat / Re: The Welcoming Committee
« on: April 03, 2013 »
Hello everyone, I'm new as well.

I've been programming for quite some time, in C, Java, Python, JS and PHP but I rarely do anything graphical, which I want to change.

I tried some graphic stuff in Processing, like a broken TV flickering effect and some line art, but that's basically all.

I hope this forum can somehow help me learn more about these things.

Pages: [1]