PDA

View Full Version : Interesting problem



siftings81
04-18-2004, 07:12 AM
I've got a interesting problem. I wrote a pong like game in 3D for class that works fine on my computer, but when I run it in the lab, it doesn't display the paddle. Here's some background.

-My machince runnin XP with Visual C++
-Lab is runnin XP with .Net
-Compiled same source, got 2 different results
-even brought an executable to the lab that ran fine on mine, but still didn't work on lab's pc

The glut files I had to install on the lab's pc are the same as the ones on mine. I've also since upgraded to .Net, with the same results. So basically I now have the same software config on both machines, but get different results? Any ideas would greatly be apreciated.

plasmonster
04-18-2004, 09:22 AM
I would need alot more information than that to begin a discussion. It's very important to state your problem clearly.

ioquan
04-18-2004, 10:21 AM
what video card does each computer have? How do you draw the paddle?

madmortigan
04-18-2004, 11:41 AM
Hi

Some wild guess: Could it be that the paddle does get drawn but you can't see it, say because it's drawn on the bottom of the screen and the lab pc is not set up properly (I know lab pc's back in my days where not that great, their monitors/v.cards were crappy, etc.)? Are you using full screen mode? If yes, this makes this guess even more possible. Try modifying the settings (size, etc.) of the screen/display card, and make sure they are properly set.

Having ruled out the scenario above, another guess: Are you using any sort of texture to draw the paddle? If yes, have you got the image file of the texture at the lab pc?

Are you using any fancy texture/other effect that is possibly not supported by the display card of the lab pc?

some more details would help here.

madmortigan

siftings81
04-18-2004, 03:44 PM
Sorry for the lack of details, but I'm stumped why such simple code would work on my machine but no one else's(tested it on another machine). At first I thought it was because I was running Visual Studio 6, and the lab runs .Net, but that doesn't appear to be the problem.

My program uses display lists to draw the world objects, then translates them, etc..
for example:

glNewList(PADDLE, GL_COMPILE);
glLineWidth(2.0);
glDisable(GL_LIGHTING);
glBegin(GL_POLYGON);
glColor4f(1.0,.0,.0,0.4);
glVertex3iv(paddle_vertex[0]);
glVertex3iv(paddle_vertex[1]);
glVertex3iv(paddle_vertex[2]);
glVertex3iv(paddle_vertex[3]);
glEnd();
glBegin(GL_LINE_LOOP);
glColor4f(1.0,.0,.0,1.0);
glVertex3iv(paddle_vertex[0]);
glVertex3iv(paddle_vertex[1]);
glVertex3iv(paddle_vertex[2]);
glVertex3iv(paddle_vertex[3]);
glEnd();
glEnable(GL_LIGHTING);
glLineWidth(1.0);
glEndList();

I'm using a perspective view, and I know the code that tracks the paddle movement works since the ball does rebound, just can't see it. I was just wondering why I would have to alter my code for such a simple program that isn't hardware dependent?

The video card I have is a geforce 3, and the lab's are gateways, probably with integrated video.

Also, when I was runnin it on the lab's pc, I got what looks like a quater of the paddle to appear and work correctly by altering the third parameter of the following:

/* ball */
glTranslatef(ball_pos[0],ball_pos[1],ball_pos[2]);/* move the ball */
glMaterialfv(GL_FRONT, GL_DIFFUSE, ball_diffuse);
glCallList(BALL);/* draw the ball */
glLoadIdentity();

plasmonster
04-18-2004, 05:17 PM
It's still awfully hard to guess at your problem. A quick scan of your code revealed little to me. I'm not familiar with gateway's offerings, so I can't comment on the hardware issue; but if duplicate code fails to run on one of the systems, it might be a suspect. Save that, check your code carefully for mistakes.

ioquan
04-18-2004, 06:02 PM
drawing of GL_LINE_LOOP and GL_POLYGON might not be supported correctly on your lab computer's video card.

Try drawing triangles or quads instead.

mikeman
04-19-2004, 01:58 AM
Originally posted by siftings81:

/* ball */
glTranslatef(ball_pos[0],ball_pos[1],ball_pos[2]);/* move the ball */
glMaterialfv(GL_FRONT, GL_DIFFUSE, ball_diffuse);
glCallList(BALL);/* draw the ball */
glLoadIdentity();This looks a little strange to me.You should always enclose drawing of an object inside glPushMatrix...glPopMatrix.
Like this:
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
SetCameraPos();

glPushMatrix();
glTranslatef(ox,oy,oz);
DrawObject();
glPopMatrix();

Also,test if something is wrong with the display lists.Throw all the commands of the PADDLE list in a function and call this to draw the paddle.See if something changes.
Finally,I hope you don't change the values of paddle_vertex[i] to actually move the paddle.

siftings81
04-19-2004, 05:30 AM
thanks for all the replies. I haven't given many details about the code since it works fine on my pc, just wondering why it wouldn't work on another. I guess I'll try drawing the paddle differently, and using pushmatrix/popmatrix.

Update: got it to work by altering the translation call for the ball. I still have no idea why it worked on mine though