minor Configure / makefiles updates

Removed mor (egcs) warnings
  Updated version to 2.0.1 in version.h
  Several corrections for strict compilers
  OpenGL updates
  new wxApp::InitVisual() for overriding in order to set non-default visual
    (unportable, of course)
  Added makefiles for DialogEd and Tex2Rtf
  made wxGTK compile with Tex2Rtf
  Added BEGIN_DRAG event to tree ctrl
  Added missing #include to lexel.l (unistd.h) (MSW?)
  new wxGTK.spec
  turned one or two more #ifdef into #if


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1349 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-01-08 20:33:18 +00:00
parent ed38ec7e34
commit bbe0af5b15
67 changed files with 1777 additions and 1309 deletions

View File

@@ -1,5 +1,5 @@
#
# wGLCanvas source makefile for Unix
# wxGLCanvas source makefile for Unix
#
# Copyright 1998, Robert Roebling
#
@@ -18,8 +18,8 @@ NONE=
# define library name
LIB_TARGET=wx_opengl_gtk
LIB_MAJOR=0
LIB_MINOR=1
LIB_MAJOR=1
LIB_MINOR=0
# define library sources

View File

@@ -13,12 +13,24 @@
#pragma implementation "glcanvas.h"
#endif
#include "wx/wxprec.h"
#include "glcanvas.h"
#include "wx/frame.h"
#include "wx/colour.h"
#include "glcanvas.h"
#include <gdk/gdkx.h>
#include "wx/module.h"
#include "wx/app.h"
#include "gtk/gtk.h"
#include "gdk/gdk.h"
extern "C" {
#include "gdk/gdkx.h"
}
//---------------------------------------------------------------------------
// global variables
//---------------------------------------------------------------------------
XVisualInfo *g_visual_info = (XVisualInfo*) NULL;
//---------------------------------------------------------------------------
// wxGLContext
@@ -28,66 +40,57 @@ IMPLEMENT_CLASS(wxGLContext,wxObject)
wxGLContext::wxGLContext( bool WXUNUSED(isRGB), wxWindow *win, const wxPalette& WXUNUSED(palette) )
{
m_window = win;
m_widget = win->m_wxwindow;
m_window = win;
m_widget = win->m_wxwindow;
int data[] = {GLX_RGBA,GLX_RED_SIZE,1,GLX_GREEN_SIZE,1,
GLX_BLUE_SIZE,1,GLX_DOUBLEBUFFER,None};
Display *display = GDK_WINDOW_XDISPLAY( m_widget->window );
XVisualInfo *visual_info = glXChooseVisual( display, DefaultScreen(display), data );
wxCHECK_RET( g_visual_info != NULL, "invalid visual for OpenGl" );
m_glContext = glXCreateContext( GDK_DISPLAY(), g_visual_info, None, GL_TRUE );
wxCHECK_RET( visual_info != NULL, "Couldn't choose visual for OpenGl" );
wxCHECK_RET( m_glContext != NULL, "Couldn't create OpenGl context" );
m_glContext = glXCreateContext( display, visual_info, None, GL_TRUE );
wxCHECK_RET( m_glContext != NULL, "Couldn't create OpenGl context" );
glXMakeCurrent( display, GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
}
wxGLContext::~wxGLContext()
{
if (m_glContext)
{
Display *display = GDK_WINDOW_XDISPLAY( m_widget->window );
glXMakeCurrent( display, GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
if (m_glContext)
{
glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
glXDestroyContext( display, m_glContext );
}
glXDestroyContext( GDK_DISPLAY(), m_glContext );
}
}
void wxGLContext::SwapBuffers()
{
if (m_glContext)
{
Display *display = GDK_WINDOW_XDISPLAY( m_widget->window );
glXSwapBuffers( display, GDK_WINDOW_XWINDOW( m_widget->window ) );
}
if (m_glContext)
{
glXSwapBuffers( GDK_DISPLAY(), GDK_WINDOW_XWINDOW( m_widget->window ) );
}
}
void wxGLContext::SetCurrent()
{
if (m_glContext)
{
Display *display = GDK_WINDOW_XDISPLAY( m_widget->window );
glXMakeCurrent( display, GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
}
if (m_glContext)
{
glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
}
}
void wxGLContext::SetColour(const char *colour)
{
float r = 0.0;
float g = 0.0;
float b = 0.0;
wxColour *col = wxTheColourDatabase->FindColour(colour);
if (col)
{
r = (float)(col->Red()/256.0);
g = (float)(col->Green()/256.0);
b = (float)(col->Blue()/256.0);
glColor3f( r, g, b);
}
float r = 0.0;
float g = 0.0;
float b = 0.0;
wxColour *col = wxTheColourDatabase->FindColour(colour);
if (col)
{
r = (float)(col->Red()/256.0);
g = (float)(col->Green()/256.0);
b = (float)(col->Blue()/256.0);
glColor3f( r, g, b);
}
}
void wxGLContext::SetupPixelFormat()
@@ -100,7 +103,7 @@ void wxGLContext::SetupPalette( const wxPalette& WXUNUSED(palette) )
wxPalette wxGLContext::CreateDefaultPalette()
{
return wxNullPalette;
return wxNullPalette;
}
//---------------------------------------------------------------------------
@@ -118,44 +121,79 @@ wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id,
int *WXUNUSED(attribList), const wxPalette& palette):
wxScrolledWindow(parent, id, pos, size, style, name)
{
m_glContext = new wxGLContext( TRUE, this, palette );
m_glContext = new wxGLContext( TRUE, this, palette );
}
wxGLCanvas::~wxGLCanvas()
{
if (m_glContext) delete m_glContext;
if (m_glContext) delete m_glContext;
}
void wxGLCanvas::SwapBuffers()
{
if (m_glContext) m_glContext->SwapBuffers();
if (m_glContext) m_glContext->SwapBuffers();
}
void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event))
{
int width, height;
GetClientSize(& width, & height);
int width, height;
GetClientSize(& width, & height);
if (m_glContext)
{
m_glContext->SetCurrent();
if (m_glContext)
{
m_glContext->SetCurrent();
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
glMatrixMode(GL_MODELVIEW);
}
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
glMatrixMode(GL_MODELVIEW);
}
}
void wxGLCanvas::SetCurrent()
{
if (m_glContext) m_glContext->SetCurrent();
if (m_glContext) m_glContext->SetCurrent();
}
void wxGLCanvas::SetColour( const char *colour )
{
if (m_glContext) m_glContext->SetColour( colour );
if (m_glContext) m_glContext->SetColour( colour );
}
//--------------------------------------------------------------------
// wxGLModule
//--------------------------------------------------------------------
class wxGLModule : public wxModule
{
public:
virtual bool OnInit();
virtual void OnExit();
private:
DECLARE_DYNAMIC_CLASS(wxGLModule)
};
IMPLEMENT_DYNAMIC_CLASS(wxGLModule, wxModule)
bool wxGLModule::OnInit()
{
int data[] = { GLX_RGBA,GLX_RED_SIZE,1,GLX_GREEN_SIZE,1,
GLX_BLUE_SIZE,1,GLX_DOUBLEBUFFER,None};
g_visual_info = glXChooseVisual( GDK_DISPLAY(), DefaultScreen(GDK_DISPLAY()), data );
wxCHECK_MSG( g_visual_info != NULL, FALSE, "Couldn't choose visual for OpenGl" );
wxVisualSetByExternal = gdkx_visual_get(g_visual_info->visualid);
wxColormapSetByExternal = gdk_colormap_new( gdkx_visual_get(g_visual_info->visualid), TRUE );
return TRUE;
}
void wxGLModule::OnExit()
{
}