OK I've got a problem that's REALLY ticking me off with my program. I have ported my engine over to OpenGL and when I use my debugger with the IDE project loaded, it runs perfectly windowed (go fullscreen and your system locks due to being debugged though). Now, when I shut down the IDE/project and run it from within explorer or by using run, it crates the window and right before the 3D view loads I get error 10H in 3dfxogl.dll and then an invalid page fault in kernel32.dll. Now why is it that it runs PERFECTLY in my debugger but will NOT run at all without being debugged?
Oh, if I close my project and run the debugger on it (or right click on the executeable in explorer and choose debug) it detects the crash and stops it's execution, but when I try to click the crash location it says "There's no line of code corresponding to this location". That's probably because the source isn't open! So what in the world is wrong here? I just don't get it.
-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]
Comments
[code]
for (int loop_m = 0; loop_m < numtriangles; loop_m++)
{
glBegin(GL_TRIANGLES);
glNormal3f( 0.0f, 0.0f, 1.0f);
glColor3f(1.0f, 0.0f, 0.0f);
x_m = sector1.triangle[loop_m].vertex[0].x;
y_m = sector1.triangle[loop_m].vertex[0].y;
z_m = sector1.triangle[loop_m].vertex[0].z;
u_m = sector1.triangle[loop_m].vertex[0].u;
v_m = sector1.triangle[loop_m].vertex[0].v;
glTexCoord2f(u_m,v_m); glVertex3f(x_m,y_m,z_m);
glColor3f(0.0f, 1.0f, 0.0f);
x_m = sector1.triangle[loop_m].vertex[1].x;
y_m = sector1.triangle[loop_m].vertex[1].y;
z_m = sector1.triangle[loop_m].vertex[1].z;
u_m = sector1.triangle[loop_m].vertex[1].u;
v_m = sector1.triangle[loop_m].vertex[1].v;
glTexCoord2f(u_m,v_m); glVertex3f(x_m,y_m,z_m);
glColor3f(0.0f, 0.0f, 1.0f);
//Crashes on the next line (x_m=blah)
x_m = sector1.triangle[loop_m].vertex[2].x;
y_m = sector1.triangle[loop_m].vertex[2].y;
z_m = sector1.triangle[loop_m].vertex[2].z;
u_m = sector1.triangle[loop_m].vertex[2].u;
v_m = sector1.triangle[loop_m].vertex[2].v;
glTexCoord2f(u_m,v_m); glVertex3f(x_m,y_m,z_m);
glEnd();
}
[/code]
That shouldn't be too hard to follow. It causes the error 10H in 3DFXOGL.DLL, which means as much to me as if a dog was trying to tell me (no offense to those of you who might be dogs) :P. Anyways, "sector1" is a struct with x number of "traingle" structs that are made of 3 "vertex" structs (0-2, naturally). Why does the third set work perfectly when the IDE project is open but then fails every time when it isn't?? That's what blows my mind.
-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]
This has happened to me more than one time.. For example, yesterday I finished a program, it was working perfectly well, everything was Ok, so I decided it was time to release it, so I changed configurations (i'm talking about MS VC++) to "Release" and compiled my program... What a surprise when I ran and used the program and it didn't worked well, it was doing weird things... Whatta ?.. It was working perfect in "Debug" version, I tried again and again, reinstalled Visual Stdio, and then got another PC and installed VC++ there, compiled, ...and same results!!!
I still dont know what is going on, I just know that the .exe compiled with "Debug information" is working ok, but the .exe compiled without "Debug information" is doing weird things :-( ..
Some weird things like this has happened to me before, and I have discoreved that to solve this, you have to rewrite your code to something else..
Another example, on another program I was doing time ago, when I inserted a for() statement in a particular function, and I tried to debug the program the computer would just freeze... ? but it would not freeze if I wasn't debuggin... ?.. The solution?, I changed my for() with a while() and that's it....
This is not only an MS VC++ issue, it also has happened with Borland..
See ya!
And yeah, I think you are right, I was already suspecting that I'm not coding very well ;-) jeje.. I need to do something about it..
See ya!!
- Jorge Gajn.
:
:
Oh blah, blah, blah! Lol! My memory code is just fine thanks to what you showed me a while back. It's actually a clipping problem in the 3D engine. I found it by moving the player start way outside the level and then disabling gravity (so he wouldn't fall into the abyss). Sure enough, when enough of the level went out of the view, CRASH! I'll start a post in my new board about clipping planes/regions and figure out how to fix it. Thanks for the help though.
-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]