mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 06:56:24 +08:00
Changed OpenGL support for the Mac OS X platform: use cocoa instead of deprecated AGL.
All changes are mac-specific, except a very minor change in file src/gl_draw.cxx where string drawing wrongly claimed to support @symbol, not possible because symbols are drawn using non-GL primitives. Unchanged application code can use the new FLTK code. In addition, the new code allows mac applications to draw OpenGL scenes at high resolution on so-called 'retina' displays, but this requires some support from app code. They must call, before opening GL windows, Fl::use_high_resolution(1); and change their glViewport() calls as follows glViewport(0, 0, pxel_w(), pixel_h()); This uses 2 new member functions of the Fl_Gl_Window class, pixel_w() and pixel_h() returning the window dimensions in pixel units, that is, twice the w() and h() when the window is mapped on a retina display. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10498 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+2
-1
@@ -84,7 +84,7 @@ void shape_window::draw() {
|
||||
valid(1);
|
||||
// printf("init\n");
|
||||
glLoadIdentity();
|
||||
glViewport(0,0,w(),h());
|
||||
glViewport(0,0,pixel_w(),pixel_h());
|
||||
}
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glColor3f(.5,.6,.7);
|
||||
@@ -267,6 +267,7 @@ int arg(int, char **argv, int &i) {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
Fl::use_high_res_GL(1);
|
||||
int i=0;
|
||||
if (Fl::args(argc,argv,i,arg) < argc)
|
||||
Fl::fatal("Options are:\n -2 = 2 windows\n -f = startup fullscreen\n%s",Fl::help);
|
||||
|
||||
Reference in New Issue
Block a user