fix fltk code
parent
0f334cc040
commit
1bfba0df5f
|
@ -19,29 +19,15 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/Fl_Box.H>
|
#include <FL/Fl_Box.H>
|
||||||
//#include "Fl_Gl_Choice.H"
|
|
||||||
#if 1 //---------------- Extract from Fl_Gl_Choice.H
|
|
||||||
#ifdef WIN32
|
|
||||||
# include <FL/gl.h>
|
|
||||||
# define GLContext HGLRC
|
|
||||||
#elif defined(__APPLE_QUARTZ__)
|
|
||||||
# include <OpenGL/gl.h>
|
|
||||||
# include <AGL/agl.h>
|
|
||||||
# define GLContext AGLContext
|
|
||||||
#else
|
|
||||||
# include <GL/glx.h>
|
|
||||||
# define GLContext GLXContext
|
|
||||||
#endif
|
|
||||||
GLContext fl_create_gl_context(XVisualInfo*);
|
|
||||||
void fl_set_gl_context(Fl_Window*, GLContext);
|
|
||||||
void fl_delete_gl_context(GLContext);
|
|
||||||
#endif //----------------
|
|
||||||
#include <fltk/xFl_Gl_Window_Group.H> //#include <FL/Fl_Gl_Window_Group.H>
|
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
#include <FL/gl.h>
|
#include <FL/gl.h>
|
||||||
|
|
||||||
|
#include <fltk/xFl_Gl_Window_Group.H>
|
||||||
|
|
||||||
#if 1 //HAVE_GL
|
#if 1 //HAVE_GL
|
||||||
|
|
||||||
#if !defined(GL_TEXTURE_RECTANGLE) && defined(WIN32)
|
#if !defined(GL_TEXTURE_RECTANGLE) && defined(WIN32)
|
||||||
|
@ -80,7 +66,6 @@ void Gl_Stand_In::dummy(void) {}
|
||||||
void Fl_Gl_Window_Group::init(void) {
|
void Fl_Gl_Window_Group::init(void) {
|
||||||
begin(); // Revert the end() in the Fl_Gl_Window constructor
|
begin(); // Revert the end() in the Fl_Gl_Window constructor
|
||||||
glstandin = new Gl_Stand_In(w(), h(), this);
|
glstandin = new Gl_Stand_In(w(), h(), this);
|
||||||
children_context = NULL;
|
|
||||||
texid = 0;
|
texid = 0;
|
||||||
RESET_FIELDS();
|
RESET_FIELDS();
|
||||||
}
|
}
|
||||||
|
@ -119,30 +104,21 @@ void Fl_Gl_Window_Group::adjust_offscr(int w, int h) {
|
||||||
void Fl_Gl_Window_Group::show() {
|
void Fl_Gl_Window_Group::show() {
|
||||||
Fl_Gl_Window::show();
|
Fl_Gl_Window::show();
|
||||||
|
|
||||||
if (!children_context) {
|
glDisable(GL_DEPTH_TEST);
|
||||||
children_context = fl_create_gl_context(fl_visual);
|
glDisable(GL_LIGHTING);
|
||||||
fl_set_gl_context(this, children_context);
|
glEnable(GL_TEXTURE_RECTANGLE);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
glDisable(GL_LIGHTING);
|
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glEnable(GL_TEXTURE_RECTANGLE);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glGenTextures(1, &texid);
|
||||||
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glBindTexture(GL_TEXTURE_RECTANGLE, texid);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
make_current();
|
||||||
glGenTextures(1, &texid);
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE, texid);
|
|
||||||
make_current();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Gl_Window_Group::hide() {
|
void Fl_Gl_Window_Group::hide() {
|
||||||
if (children_context) {
|
glDeleteTextures(1, &texid);
|
||||||
fl_set_gl_context(this, children_context);
|
texid = 0;
|
||||||
glDeleteTextures(1, &texid);
|
make_current();
|
||||||
texid = 0;
|
|
||||||
make_current();
|
|
||||||
fl_delete_gl_context(children_context);
|
|
||||||
children_context = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Fl_Gl_Window::hide();
|
Fl_Gl_Window::hide();
|
||||||
}
|
}
|
||||||
|
@ -197,8 +173,6 @@ void Fl_Gl_Window_Group::draw(void) {
|
||||||
Draws all children of the group.
|
Draws all children of the group.
|
||||||
*/
|
*/
|
||||||
void Fl_Gl_Window_Group::draw_children(void) {
|
void Fl_Gl_Window_Group::draw_children(void) {
|
||||||
fl_set_gl_context(this, children_context);
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glOrtho(0, w(), 0, h(), -1.0, 1.0);
|
glOrtho(0, w(), 0, h(), -1.0, 1.0);
|
||||||
|
|
Loading…
Reference in New Issue