Archived

This topic is now archived and is closed to further replies.

A lot to ask for....

This topic is 5111 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Yo, in my program I have two boxes on the screen, but sometimes when I start up the program they don't appear... before I put up the code, does anyone know what I may be doing wrong? They appear sometimes... Edit : Oh yeah, if you can't think of a reason, is there a way I could error trap it? something like...

if (GL_POLYGON == false)
    return 0;

I know that's wrong, but I think you get the idea [edited by - Kheteris on December 16, 2003 3:12:33 PM]

Share this post


Link to post
Share on other sites
Do you allocate memory for the boxes during runtime?
If so, the memory might nog be allocated correctly (or not at all).
Also be sure to set all variables to a default, for example if you create a float array : float a[100];, the data is not automatically set to 0.0f, so if you''d do this:

a[2]=100;
a[3]=75;
DrawRectangle(a[0],a[1],a[2],a[3]);

It might sometimes result in a rectangle from (0.0f,0.0f) to (100,75) and sometimes in a completely diffirent origin, so it might be an invalid rectangle.

Share this post


Link to post
Share on other sites
Well, I don''t use an array, but I do use variables, which the computer randomly selects (there is no default) and when they are constantly changing... could this be the problem?

glVertex3f(x+250,wspeed-30,z);

Share this post


Link to post
Share on other sites
quote:
Original post by Kheteris
Well, I don''t use an array, but I do use variables, which the computer randomly selects (there is no default) and when they are constantly changing... could this be the problem?

glVertex3f(x+250,wspeed-30,z);


you realize that a.) 250 and 30 are not floats, and b.) 250 and 30 are going to be WAAAAAY offscreen if you''re using a standard projection matrix

Share this post


Link to post
Share on other sites
With my projection they fit just fine , and I can zoom in and out if I need to... but let me check w/ 250 and -30

Edit: [few hours after post] well I am unable to change it now but does someone believe that if I add .0f to the end it would possible end the randomness?

[edited by - Kheteris on December 17, 2003 9:44:00 PM]

Share this post


Link to post
Share on other sites
float + int = float, so I don''t think thats the problem.

I think Living Monstrosity is probably right. you need to make sure every variable you use is initalized. Make sure the likes of x and y are set to proper values. and if not sure, step-through debug it.

| - Project-X - | - adDeath - | - my windows XP theme - | - email me - |

Share this post


Link to post
Share on other sites
What about the perspective of your window ?


// Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f,(GLfloat) width / (GLfloat) height, 0.1f, 5000.0f);


Cuz if the last variable (5000.0f in this example) is at 10 and your vertice at 50 or more, your cube will be never visible.

========================
Leyder Dylan (dylan.leyder@slug-production.be.tf
http://users.skynet.be/fa550206/Slug-Production/Index.htm/

[edited by - Leyder Dylan on December 18, 2003 12:01:47 PM]

Share this post


Link to post
Share on other sites
Damned, I always forgot how to add source code in a post. How is it ?

Do I need to begin with [ CODE ] and finish with [ /CODE ] (without the space)

My brain is overflowed ...

========================
Leyder Dylan (dylan.leyder@slug-production.be.tf
http://users.skynet.be/fa550206/Slug-Production/Index.htm/

Share this post


Link to post
Share on other sites