Go Back   Winamp Forums > Developer Center > Winamp Development

Reply
Thread Tools Search this Thread Display Modes
Old 27th April 2005, 00:15   #1
galactic_fox
Junior Member
 
Join Date: Apr 2005
Posts: 2
Winamp Plugin and opengl

Hi guys


I'm newbie when it comes to winamp. I've downloaded the sdk off of the site. I managed to get a glut window and some opengl working. However I can't seem to get the data spectrum or wave data. When I plot them as a line I get a stationary line not a moving wave. here's my basis setup maybe you tell me what I'm doing wrong.

-create a glut window config_getinifn()
-I copy the this_mod(the pointer) to a global pointer
- I also call glutDisplayFunc(render3);,
glutIdleFunc(render3);, glutMainLoop(); there too

void render3
-int x, y;
float i;
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.0, 0.0, 0.0, 1.0);
glColor3f(0,1,0);
glLineWidth(2.0);
glBegin(GL_LINES);
for(y=1;y<256;y=y++)
{
for(x=1;x<288;x++)
{
i=globalpointer->waveformData[y][x];
glVertex2i(x,i);
}
}
glEnd();
glutSwapBuffers(); //printf("{%d %d} {%d %d} \n", results->x,results->y,results->x1,results->y1);
return 0;


any suggestions would be great help I've been stuck on this for a long time


thanks in advance
galactic_fox is offline   Reply With Quote
Old 2nd May 2005, 07:46   #2
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
Set the waveformData member of the winampVisModule struct to 2.

Then use these for loops instead:
code:

// draw oscilliscope
for (y = 0; y < this_mod->nCh; y ++)
{
int x, y; // x is the horizontal axis, y is channel flag (left = 0, right = 1)

MoveToEx(memDC,0,(y*256)>>(this_mod->nCh-1),NULL);
for (x = 0; x < 288; x ++)
{
LineTo(memDC,x,(y*256 + this_mod->waveformData[y][x]^128)>>(this_mod->nCh-1));
}
}




If that is C you tried to show us, then you should rethink your choice of programming language. Please don't post such code except when you label it as pseudo-code.
saivert is offline   Reply With Quote
Old 2nd May 2005, 08:00   #3
Cummi Bare
Banned
 
Cummi Bare's Avatar
 
Join Date: Apr 2005
Posts: 313
Send a message via Yahoo to Cummi Bare
Heh, saivert, you sound harsh. Just out of interest can you answer this.
Quote:
Originally posted by saivert
If that is C you tried to show us, then you should rethink your choice of programming language.
Why?
Quote:
Originally posted by saivert
Please don't post such code except when you label it as pseudo-code.
And why?

Cheers
Cummi Bare is offline   Reply With Quote
Old 2nd May 2005, 08:32   #4
Cummi Bare
Banned
 
Cummi Bare's Avatar
 
Join Date: Apr 2005
Posts: 313
Send a message via Yahoo to Cummi Bare
Holy Shit saivert, you're on a mission this morning.
Cummi Bare is offline   Reply With Quote
Old 2nd May 2005, 09:45   #5
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
@Cummi Bare: Thanks for noticing all my replies this day. :-)

I wrote what I wrote because the code he posted below his questions was terrible. It did not look like real C code at all. And if it is, then I have to start reading those C/C++ programming books again (and again).

I mean, what the h*** is this:
code:

void render3
-int x, y;



You can't declare a function like that (void render3).
It should be this:

code:


void render3()
{
int x, y; // No dash (-) before it.
// ...code...
}



And he did not indent his either. Very hard to read then...
saivert is offline   Reply With Quote
Old 2nd May 2005, 10:04   #6
Cummi Bare
Banned
 
Cummi Bare's Avatar
 
Join Date: Apr 2005
Posts: 313
Send a message via Yahoo to Cummi Bare
Quote:
Originally posted by saivert
I wrote what I wrote because the code he posted below his questions was terrible. It did not look like real C code at all.
Oh OK, I just assumed he was being ultra sloppy, or off his face, and wasn't posting the actual code he's using.
Quote:
Originally posted by saivert
I mean, what the h*** is this:
Cummi Bare is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump