mirror of https://github.com/fltk/fltk
Fix Visual Studio compiler warnings, make output visible...
on Windows w/o a console device ("DOS"/Debug window) if OpenGL3 is not available.
This commit is contained in:
parent
dea8a93bc2
commit
38e1d6b099
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// Tiny OpenGL v3 + glut demo program for the Fast Light Tool Kit (FLTK).
|
// Tiny OpenGL v3 + glut demo program for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
// Copyright 1998-2022 by Bill Spitzak and others.
|
// Copyright 1998-2024 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
// the file "COPYING" which should have been included with this file. If this
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
# include <GL/glew.h>
|
# include <GL/glew.h>
|
||||||
#endif
|
#endif
|
||||||
#include <FL/glut.H>
|
#include <FL/glut.H>
|
||||||
|
#include <FL/fl_ask.H>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -207,10 +208,14 @@ int main (int argc, char* argv[])
|
||||||
#endif
|
#endif
|
||||||
int gl_version_major;
|
int gl_version_major;
|
||||||
const char *glv = (const char*)glGetString(GL_VERSION);
|
const char *glv = (const char*)glGetString(GL_VERSION);
|
||||||
fprintf(stderr, "OpenGL version %s supported\n", glv);
|
|
||||||
sscanf(glv, "%d", &gl_version_major);
|
sscanf(glv, "%d", &gl_version_major);
|
||||||
|
fprintf(stderr, "OpenGL version %s supported\n", glv);
|
||||||
if (gl_version_major < 3) {
|
if (gl_version_major < 3) {
|
||||||
fprintf(stderr, "\nThis platform does not support OpenGL V3\n\n");
|
fprintf(stderr, "\nThis platform does not support OpenGL V3\n\n");
|
||||||
|
fflush(stderr);
|
||||||
|
// ensure that users see a message on Windows w/o console output:
|
||||||
|
fl_alert("OpenGL version %s supported.\n"
|
||||||
|
"This platform does not support OpenGL V3!",glv);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
initShaders();
|
initShaders();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// Tiny OpenGL v3 demo program for the Fast Light Tool Kit (FLTK).
|
// Tiny OpenGL v3 demo program for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
// Copyright 1998-2022 by Bill Spitzak and others.
|
// Copyright 1998-2024 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
// the file "COPYING" which should have been included with this file. If this
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
@ -132,7 +132,7 @@ public:
|
||||||
else if ((!valid())) {
|
else if ((!valid())) {
|
||||||
glViewport(0, 0, pixel_w(), pixel_h());
|
glViewport(0, 0, pixel_w(), pixel_h());
|
||||||
}
|
}
|
||||||
glClearColor(0.08, 0.8, 0.8, 1.0);
|
glClearColor(0.08f, 0.8f, 0.8f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
if (shaderProgram) {
|
if (shaderProgram) {
|
||||||
GLfloat p[]={0,0};
|
GLfloat p[]={0,0};
|
||||||
|
@ -172,7 +172,7 @@ public:
|
||||||
if (retval) return retval;
|
if (retval) return retval;
|
||||||
|
|
||||||
if (event == FL_PUSH && gl_version_major >= 3) {
|
if (event == FL_PUSH && gl_version_major >= 3) {
|
||||||
static float factor = 1.1;
|
static float factor = 1.1f;
|
||||||
GLfloat data[4];
|
GLfloat data[4];
|
||||||
glGetBufferSubData(GL_ARRAY_BUFFER, 0, 4*sizeof(GLfloat), data);
|
glGetBufferSubData(GL_ARRAY_BUFFER, 0, 4*sizeof(GLfloat), data);
|
||||||
if (data[0] < -0.88 || data[0] > -0.5) factor = 1/factor;
|
if (data[0] < -0.88 || data[0] > -0.5) factor = 1/factor;
|
||||||
|
|
Loading…
Reference in New Issue