Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Di Apr 23, 2024 16:06

Foren-Übersicht » Programmierung » OpenGL
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 2 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: floating point division by zero
BeitragVerfasst: Mi Dez 11, 2013 13:06 
Offline
DGL Member

Registriert: Mi Dez 11, 2013 10:43
Beiträge: 2
Programmiersprache: Delphi XE5
Hi All,

I have the following code:

Code:
  1.  
  2.   glPushMatrix;
  3.  
  4.     glMatrixMode(GL_PROJECTION);
  5.     glLoadIdentity;
  6.     glViewport(0, 0, 1400, 700);
  7.     glOrtho(-(1400 / 700),
  8.              (1400 / 700),
  9.             -1, 1,
  10.             -10, 10);
  11.  
  12.     glMatrixMode(GL_MODELVIEW);
  13.     glLoadIdentity;
  14.  
  15.     // Enable Lighting
  16.     glEnable(GL_LIGHTING);
  17.  
  18.     // Enable Light0
  19.     glEnable(GL_LIGHT0);
  20.  
  21.     light0Pos[0] := 1;
  22.     light0Pos[1] := 1;
  23.     light0Pos[2] := 1;
  24.  
  25.     // Set The Lights Position
  26.     glLightfv(GL_LIGHT0, GL_POSITION, @light0Pos);
  27.     glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, @MaterialColor1);
  28.     glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, @specular1);
  29.  
  30.     glScalef(1, 1, 1);
  31.  
  32.     glLineWidth(1);
  33.     glBegin(GL_LINES);
  34.       glVertex3f(-1, 0,  -9);
  35.       glVertex3f( 1, 0,  -9);
  36.     glEnd;
  37.  
  38.     // Disable Lighting
  39.     glDisable(GL_LIGHTING);
  40.  
  41.     // Disable Light0
  42.     glDisable(GL_LIGHT0);
  43.  
  44.   glPopMatrix;
  45.  


If I run this code as a 32Bit application everything is fine but running this code as a 64Bit app I get this error message:
'Project x.exe raised exception class $C000008E with message 'c000008e FLOAT_DIVIDE_BY_ZERO'

The error appears when this executes :
glVertex3f(-1, 0, -9);
glVertex3f( 1, 0, -9);

Where these variables are :
Light0Pos : Array[0..3] of glFloat = (0.0, 0.0, 0.0, 1.0);

Const
MaterialColor1 : Array[1..4] of glFloat = (0.2, 0.1, 0.4, 1.0);
Specular1 : Array[1..4] of glFloat = (0.2, 0.2, 0.2, 1.0);

Any idea what I am doing wrong?

Thanks in advance.

I have :
Win 7 Pro 64Bit
Delphi XE5 Ent
AMD Radeon HD 7900 Series videocard


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: floating point division by zero
BeitragVerfasst: Do Dez 12, 2013 11:33 
Offline
DGL Member

Registriert: Mi Dez 11, 2013 10:43
Beiträge: 2
Programmiersprache: Delphi XE5
I pinpoint the error.
Seems that this line of code glEnable(GL_LINE_SMOOTH) causes the problem.
Strange but if I comment out this line everything is fine.


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 2 Beiträge ] 
Foren-Übersicht » Programmierung » OpenGL


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 55 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.067s | 17 Queries | GZIP : On ]