summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-09-27 14:12:39 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-09-27 14:12:39 +0200
commit59fc60ea4cb8db6ee43a1ac37cd4bbbefcb87faa (patch)
tree072de9da3e8f6c0b69f0872320ff7ad117e6aee9 /examples
parent2ffd4e4f1af16b17a286ff354603a717f5d828a5 (diff)
Simpler code to support FLTK widgets in macOS OpenGL 3 windows.
Also, the application-level code to add widgets to a GL3 window becomes platform-independent.
Diffstat (limited to 'examples')
-rw-r--r--examples/OpenGL3test.cxx11
1 files changed, 1 insertions, 10 deletions
diff --git a/examples/OpenGL3test.cxx b/examples/OpenGL3test.cxx
index 9de83b5bd..edcb56d93 100644
--- a/examples/OpenGL3test.cxx
+++ b/examples/OpenGL3test.cxx
@@ -128,23 +128,17 @@ public:
glEnableVertexAttribArray((GLuint)colourAttribute );
glVertexAttribPointer((GLuint)positionAttribute, 4, GL_FLOAT, GL_FALSE, 8*sizeof(GLfloat), 0);
glVertexAttribPointer((GLuint)colourAttribute , 4, GL_FLOAT, GL_FALSE, 8*sizeof(GLfloat), (char*)0+4*sizeof(GLfloat));
+ glUseProgram(shaderProgram);
}
else if ((!valid())) {
glViewport(0, 0, pixel_w(), pixel_h());
}
glClearColor(0.08, 0.8, 0.8, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
- glUseProgram(shaderProgram);
GLfloat p[]={0,0};
glUniform2fv(positionUniform, 1, (const GLfloat *)&p);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-#ifndef __APPLE__
- // suggested by https://stackoverflow.com/questions/22293870/mixing-fixed-function-pipeline-and-programmable-pipeline-in-opengl
- // Switch from GL3-style to GL1-style drawing;
- // good under Windows, X11 and Wayland; impossible under macOS.
- glUseProgram(0);
Fl_Gl_Window::draw(); // Draw FLTK child widgets.
-#endif
}
virtual int handle(int event) {
static int first = 1;
@@ -233,9 +227,6 @@ void button_cb(Fl_Widget *, void *) {
}
void add_widgets(Fl_Gl_Window *g) {
-#ifdef __APPLE__
- g = fl_mac_prepare_add_widgets_to_GL3_win(g);
-#endif
Fl::set_color(FL_FREE_COLOR, 255, 0, 0, 140); // partially transparent red
g->begin();
// Create here widgets to go above the GL3 scene