C++ OpenGL (GLUT) Auflösung ändern

F

Furtano

Gast
Hi,

bisher stellt OpenGl (GLUT) nur richtig dar wenn die Auflösung quadratisch ist also z.B. 900x900.

Wähle ich 800x600 wird einfach 600x600 gemacht und die breite um 200 gestreckt und nicht erweitert.
Ich möchte aber auch in der Breite etwas anzeigen.


PHP:
void reshape (int w, int h)
{// 1280 x 720
	// Viewport = wie groß ist das OpenGL-Fenster im normalen Fenster das aufgemacht wird ?
   glViewport (0, 0, (GLsizei) w, (GLsizei) h); 

   glMatrixMode (GL_PROJECTION);
   // Einheitsmatrix setzen
   glLoadIdentity ();
   // Kamerabefehl
   glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
   glMatrixMode (GL_MODELVIEW);
}


int main(int argc, char** argv)
{// 1280 x 720
   glutInit(&argc, argv);
   // RGB - RGBA -> A steht für Alpha
   glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
   glutInitWindowSize (1280, 720); 
   glutInitWindowPosition (0, 0);
   glutCreateWindow (argv[0]);
   init ();
   // Funktions-Pointer: es wird z.B. immer display aufgerufen um das Bild neu zu zeichnen
   glutDisplayFunc(display); 
   glutReshapeFunc(reshape);
   glutKeyboardFunc(keyboard);
   
   glutMainLoop();

 
   return 0;
}
 
Nein,
das Problem ist, dass wenn ich ne andere als ne quadratische Auflösung nehme,
die breite einfach gestreckt wird. Also die vorhandenen Pixel werden einfach verdoppelt sozusagen.

Ich will aber bei einer 800x600 auflösung auch 800 Pixel haben die ich füllen kann.

Hier ein Bild um das Problem zu verdeutlichen!
 

Anhänge

  • opengl.jpg
    opengl.jpg
    76,1 KB · Aufrufe: 207
Zuletzt bearbeitet von einem Moderator:

Ähnliche Themen

Zurück
Oben