G
Cpp_Junky schrieb:
Dann bastel dir erstmal eine Ortho-Darstellung und mappe die genau auf deine Fenster-Größe. Dann holst du dir über 0815 Win32-Funktion die Maus-Koordinaten oder fängst die Fenster-Nachricht ab und malst die Linie.
Hört sich toll an - geht aber irgendwie nicht:
Ich poste mal das Problem als Code
[cpp]
case WM_LBUTTONUP: //Die Beiden Punkte für die Line
{
if(isSecond)
{
x2 = LOWORD(lParam);
y2 = HIWORD(lParam);
isSecond =! isSecond;
}
else
{
x1 = LOWORD(lParam);
y1 = HIWORD(lParam);
isSecond =! isSecond;
}
break;
}
//......Code.........
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glOrtho(-1.5,1.5,-1.5,1.5,-1.0,100);
//glOrtho(300.0,300.0,300.0,300.0,-1.0,100);
glTanslatef( 0.0f,0.0f,-1.0f);
//Hier die oben beschriebene Formel
//->konvertiert ein Koordinatensystem in ein Anderes
**float xGl1 = (1.5/300.0)*x1;
float yGl1 = (1.5/300.0)*y1;
float xGl2 = (1.5/300.0)x2;
float yGl2 = (1.5/300.0)y2;
glBegin(GL_LINES);
glColor3f(10.0f,10.0f, 0.0f);
glVertex2f(xGl1 ,yGl1);
glVertex2f(xGl2 ,yGl2);
glEnd();
SwapBuffers(hDC);
[/cpp]
Vielen Dank für die Hilfe