A lot to ask for....

Started by
8 comments, last by Kheteris 20 years, 4 months ago
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]
Advertisement
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.
- growl -
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);
Well where is the camera pointing to? What''s the projection your using too.

- DarkNebula
it's just facing straight, it is 2d

edit: i see other objects aswell, but the boxes don't always appear

[edited by - kheteris on December 17, 2003 4:30:27 PM]
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
-eldee;another space monkey;[ Forced Evolution Studios ]
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]
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 - |
What about the perspective of your window ?

// Calculate The Aspect Ratio Of The WindowgluPerspective(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]
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
Damned, I always forgot how to add source code in a post. How is it ?

Do I need to begin with and finish with (without the space)

My brain is overflowed ...

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

This topic is closed to new replies.

Advertisement