🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

OpenGl problem!

Started by
4 comments, last by RavNaz 23 years, 11 months ago
I exported a .map file, and converted the vertices to a pure list file. This file is then passed to my program which stores them in an 2dimensional array. This array is passed to glVertex3f( data[][], data[][], data[][]) So using the indices I loop thorugh the entire array and construct the object out of GL_TRIANGLES. Problem is however that a) the object once drawn is missing bits. b) the program crashes after several seconds. also the object is rotating which seems to work fine. Any ideas????
Advertisement
Try to step through it in debug mode. Have a look on the arrays while doing this. Maybe any of the operations tries to access an invalid (unassigned) memory area. You should also check the declaration of the array; is it assigned dynamically, or has it a constant size? If so, maybe your program crashes because you try to access fields of the array which point to no data.
It would be much easier to help you if you provided more information, better a snippet from your code!

hth anyway
pi~
Jan PieczkowskiBrainwave Studios
float data[1000][3];

for (ctr = 0 ; ctr<=340 ; ctr++)
fscanf(in, "%f %f %f", &data[ctr][0], &data[ctr][1], &data[ctr][2]);

for (rav = 0 ; rav<=340 ; rav++)
{
glBegin(GL_TRIANGLES);
glVertex3f(data[rav][0], data[rav][1], data[rav][2] );
glEnd();
}

Any ideas??


I doubt it will help your problem (well, maybe), but you should put glBegin/glEnd outside of your loop. glBegin and glEnd are somewhat expensive calls. And you don''t draw any triangles, only vertices. That''s bad. A triangle is made up from three vertices.

EL

----------------------------------------
"Inash neteia haeg joa kavari quilm..." SD4
----------------------------------------"Inash neteia haeg joa kavari quilm..." SD4
Demon lord, is right, it is the glBegin/glEnd calls, but he may be drawing triangles, it depends on what the file is using

-TipTup
TipTup.Com
I don''t know if this is a problem or not, but if you are using .map files from a Quake engine editor those vertices that you are using will never form the geometry that is shown in the editor. The vertices in that file are used to generate plane equations and then those planes are clipped against eachother to form the correct geometry. Again, I''m not sure if you are using a Quake editor, but its just a thought.

Nate Miller
http://nate.scuzzy.net

This topic is closed to new replies.

Advertisement