Entries Tagged as ''

Exploring the WxGLcanvas test program on Ubuntu 8.04 using code::blocks and getting glut template setup.

fter a couple of days of messing around, I posted in the wxforums and found out how to get the samples  http://wiki.wxwidgets.org/WxGLCanvas, to work on Ubuntu with code::blocks.

Basically:

project>Build Options>Compiler Settings>Other Options:`wx-config –cxxflags`
project>Build Options>Linker Settng>Other Linking Options>
`wx-config –libs –gl-libs` -lGL -lglut

It’s been a while since I was on this kick so, I need to brush up on the wxstuff and the opengl stuff is something totally new for me.
Here’s the code.

// NOTE: To run, it is recommended not to be in Compiz or Beryl, they have shown some instability.
 
#include "wx/wx.h"
#include "wx/glcanvas.h"
 
#ifdef __WXMAC__
#include "GLUT/glut.h"
#else
#include "GL/glut.h"
#endif
 
#ifndef WIN32
#include <unistd.h> // FIXME: ¿This work/necessary in Windows?
                    //Not necessary, but if it was, it needs to be replaced by process.h AND io.h
#endif
 
class wxGLCanvasSubClass: public wxGLCanvas {
        void Render();
public:
    wxGLCanvasSubClass(wxFrame* parent);
    void Paintit(wxPaintEvent& event);
protected:
    DECLARE_EVENT_TABLE()
};
 
BEGIN_EVENT_TABLE(wxGLCanvasSubClass, wxGLCanvas)
    EVT_PAINT    (wxGLCanvasSubClass::Paintit)
END_EVENT_TABLE()
 
wxGLCanvasSubClass::wxGLCanvasSubClass(wxFrame *parent)
:wxGLCanvas(parent, wxID_ANY,  wxDefaultPosition, wxDefaultSize, 0, wxT("GLCanvas")){
    int argc = 1;
    char* argv[1] = { wxString((wxTheApp->argv)[0]).char_str() };
 
/*
NOTE: this example uses GLUT in order to have a free teapot model
to display, to show 3D capabilities. GLUT, however, seems to cause problems
on some systems. If you meet problems, first try commenting out glutInit(),
then try comeenting out all glut code
*/
    glutInit(&argc, argv);
}
 
 
void wxGLCanvasSubClass::Paintit(wxPaintEvent& WXUNUSED(event)){
    Render();
}
 
void wxGLCanvasSubClass::Render()
{
    SetCurrent();
    wxPaintDC(this);
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glViewport(0, 0, (GLint)GetSize().x, (GLint)GetSize().y);
 
    glBegin(GL_POLYGON);
        glColor3f(1.0, 1.0, 1.0);
        glVertex2f(-0.5, -0.5);
        glVertex2f(-0.5, 0.5);
        glVertex2f(0.5, 0.5);
        glVertex2f(0.5, -0.5);
        glColor3f(0.4, 0.5, 0.4);
        glVertex2f(0.0, -0.8);
    glEnd();
 
    glBegin(GL_POLYGON);
        glColor3f(1.0, 0.0, 0.0);
        glVertex2f(0.1, 0.1);
        glVertex2f(-0.1, 0.1);
        glVertex2f(-0.1, -0.1);
        glVertex2f(0.1, -0.1);
    glEnd();
 
// using a little of glut
    glColor4f(0,0,1,1);
    glutWireTeapot(0.4);
 
    glLoadIdentity();
    glColor4f(2,0,1,1);
    glutWireTeapot(0.6);
// done using glut
 
    glFlush();
    SwapBuffers();
}
 
class MyApp: public wxApp
{
    virtual bool OnInit();
    wxGLCanvas * MyGLCanvas;
};
 

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
    wxFrame *frame = new wxFrame((wxFrame *)NULL, -1,  wxT("Hello GL World"), wxPoint(50,50), wxSize(200,200));
    new wxGLCanvasSubClass(frame);

    frame->Show(TRUE);
    return TRUE;
}

Ok my brain is a bit fuzzy on all this. The first thing I need to look into is the “DECLARE_EVENT_TABLE()” .

I did a bit of googling and here is a link that got me up to speed on all this.

I also want to get the glut template working in code blocks.  I found source called cube.cpp that I wanted to try out.  I found some very nice work instructions here on how to get the glut template setup in code blocks here: http://fabianmejia.blogspot.com/2008/09/codeblocks-and-opengl.html

Getting wxglcanvas test program to run ubuntu with code::blocks

Ok… so I’ve been wanting to get my own custom app that uses opencascade, wxwidgets and linux code::blocks with eventual ports to windows.    There is a very nice OSS application called heekscad that can be consulted for reference.

I believe to set up an Opengl window using wxwidgets  WxGlCanvas is what I need.  I found some non-occ sample code just to figure out how WxGlcanvas ticks.   I found some references to it in HeeksCAD

[Edit.. Scroll to the bottom for what works... I was barking up a lot of wrong trees here.]

I think I need to explore Opengl a little bit before I go much further into the OCC stuff.

Actually, I think I need to back up a little further.
I loaded up the subclasswxglcanvas.cpp sample code and I’m getting the following errors:

obj/Debug/subclasswxglcanvas.o||In function `__static_initialization_and_destruction_0′:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|26|undefined reference to `wxEventHashTable::wxEventHashTable(wxEventTable const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|28|undefined reference to `wxEVT_PAINT’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|28|undefined reference to `wxEVT_NULL’|
obj/Debug/subclasswxglcanvas.o||In function `__tcf_1′:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|26|undefined reference to `wxEventHashTable::~wxEventHashTable()’|
obj/Debug/subclasswxglcanvas.o||In function `main’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|95|undefined reference to `wxEntry(int&, char**)’|
obj/Debug/subclasswxglcanvas.o||In function `wxCreateApp()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|95|undefined reference to `wxAppConsole::CheckBuildOptions(char const*, char const*)’|
obj/Debug/subclasswxglcanvas.o||In function `wxGLCanvasSubClass::Render()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|51|undefined reference to `wxGLCanvas::SetCurrent()’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|52|undefined reference to `wxPaintDC::wxPaintDC(wxWindow*)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|53|undefined reference to `glClearColor’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|54|undefined reference to `glClear’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|55|undefined reference to `glViewport’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|57|undefined reference to `glBegin’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|58|undefined reference to `glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|59|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|60|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|61|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|62|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|63|undefined reference to `glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|64|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|65|undefined reference to `glEnd’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|67|undefined reference to `glBegin’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|68|undefined reference to `glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|69|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|70|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|71|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|72|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|73|undefined reference to `glEnd’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|76|undefined reference to `glColor4f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|77|undefined reference to `glutWireTeapot’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|79|undefined reference to `glLoadIdentity’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|80|undefined reference to `glColor4f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|81|undefined reference to `glutWireTeapot’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|84|undefined reference to `glFlush’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|85|undefined reference to `wxGLCanvas::SwapBuffers()’|
obj/Debug/subclasswxglcanvas.o||In function `wxGLCanvasSubClass’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxNullPalette’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxDefaultSize’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxDefaultPosition’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|33|undefined reference to `wxConvLibc’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to `glutInit’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to `wxGLCanvas::~wxGLCanvas()’|
obj/Debug/subclasswxglcanvas.o||In function `MyApp::OnInit()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|100|undefined reference to `wxFrameNameStr’|
obj/Debug/subclasswxglcanvas.o||In function `wxGLCanvasSubClass’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxNullPalette’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxDefaultSize’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxDefaultPosition’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|33|undefined reference to `wxConvLibc’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to `glutInit’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to `wxGLCanvas::~wxGLCanvas()’|
obj/Debug/subclasswxglcanvas.o||In function `wxStringBase::Init()’:|
/usr/include/wx-2.8/wx/string.h|270|undefined reference to `wxEmptyString’|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options…|
||=== Build finished: 50 errors, 0 warnings ===|

I think I need to research this doc as to what is going on

The issue has to do with static and dynamic libraries where I found a reasonable explanation of the difference here:

This document pretty much explain what the problem is, only thing is I’m a little too tired have this sink in.  Perhaps a quick read tonight and a re-read over a cup of coffee.

http://www.nsnam.org/docs/linker-problems.doc

Ok.. I forgot to save some stuff and I need to retrace my steps….

I copied  subclasswxglcanvas.cpp from http://wiki.wxwidgets.org/WxGLCanvas and setup up code blocks
Build Options>Compiler Settings>Other options:`wx-config –cxxflags`

Build Options>Linker Settings>Other Linker Options>Other linker options: `wx-config –libs`

Ok… So when I do that I get this:
obj/Debug/subclasswxglcanvas.o||In function `wxGLCanvasSubClass::Render()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|51|undefined reference to `wxGLCanvas::SetCurrent()’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|53|undefined reference to `glClearColor’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|54|undefined reference to `glClear’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|55|undefined reference to `glViewport’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|57|undefined reference to `glBegin’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|58|undefined reference to `glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|59|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|60|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|61|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|62|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|63|undefined reference to `glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|64|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|65|undefined reference to `glEnd’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|67|undefined reference to `glBegin’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|68|undefined reference to `glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|69|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|70|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|71|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|72|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|73|undefined reference to `glEnd’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|76|undefined reference to `glColor4f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|77|undefined reference to `glutWireTeapot’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|79|undefined reference to `glLoadIdentity’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|80|undefined reference to `glColor4f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|81|undefined reference to `glutWireTeapot’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|84|undefined reference to `glFlush’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|85|undefined reference to `wxGLCanvas::SwapBuffers()’|
obj/Debug/subclasswxglcanvas.o||In function `wxGLCanvasSubClass’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to `glutInit’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to `wxGLCanvas::~wxGLCanvas()’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to `glutInit’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to `wxGLCanvas::~wxGLCanvas()’|
obj/Debug/subclasswxglcanvas.o:(.rodata+0xc8)||undefined reference to `wxGLCanvas::sm_eventTable’|
obj/Debug/subclasswxglcanvas.o||In function `~wxGLCanvasSubClass’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|17|undefined reference to `wxGLCanvas::~wxGLCanvas()’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|17|undefined reference to `wxGLCanvas::~wxGLCanvas()’|
obj/Debug/subclasswxglcanvas.o:(.rodata._ZTV18wxGLCanvasSubClass[vtable for wxGLCanvasSubClass]+0×8)||undefined reference to `wxGLCanvas::GetClassInfo() const’|
obj/Debug/subclasswxglcanvas.o:(.rodata._ZTV18wxGLCanvasSubClass[vtable for wxGLCanvasSubClass]+0x1d8)||undefined reference to `wxGLCanvas::OnInternalIdle()’|
obj/Debug/subclasswxglcanvas.o:(.rodata._ZTI18wxGLCanvasSubClass[typeinfo for wxGLCanvasSubClass]+0×8)||undefined reference to `typeinfo for wxGLCanvas’|
||=== Build finished: 39 errors, 0 warnings ===|

When I googled someone in the code:blocks forum with the same pain.
http://forums.codeblocks.org/index.php?topic=5769.0

So… I followed this thread… Basically I changed
Build Options>Linker Settings>Other Linker Options>Other linker options: `wx-config –libs`

To
Build Options>Linker Settings>Other Linker Options>Other linker options: `wx-config –libs –gl-libs`

I get this:
obj/Debug/subclasswxglcanvas.o||In function `wxGLCanvasSubClass::Render()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|77|undefined reference to `glutWireTeapot’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|81|undefined reference to `glutWireTeapot’|
obj/Debug/subclasswxglcanvas.o||In function `wxGLCanvasSubClass’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to `glutInit’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to `glutInit’|
||=== Build finished: 4 errors, 0 warnings ===|

Great…. The thread stops there. But supposed on the forum he posts further :(
Couldn’t find it…

found some stuff here looks like I need to link to glut somehow…

http://www.nabble.com/Linker-Errors-For-OpenGL—GLUT-%27Hello-World%27-Program.-td19449213.html

Oh…. hear is a tutorial on code::blocks with some specific issues regarding glut…
This is worth looking at:http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/

Ok…. This is weird… The error seems to have moved a bit… Not sure what I did but now I’m getting this error:

————– Build: Debug in opengltests —————

Compiling: subclasswxglcanvas.cpp
Linking console executable: bin/Debug/opengltests
: 1: Syntax error: EOF in backquote substitution
Process terminated with status 2 (0 minutes, 4 seconds)
0 errors, 0 warnings

Go… Figure.. What is that all about..
Duh…. http://www.developpez.net/forums/d650304/c-cpp/cpp/debuter/syntax-error-eof-in-backquote-substitution/

Ok… This is getting closer

http://www.linuxquestions.org/questions/linux-software-2/help-me-solve-glut-devel-dependencys-185369/

Ok…. I think I’ve come full circle now.

I made the following change:
Build Options>Linker Settings>Other Linker Options>Other linker options: `wx-config –libs –gl-libs –lglut` and I got this message:

obj/Debug/subclasswxglcanvas.o||In function `__static_initialization_and_destruction_0′:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|26|undefined reference to `wxEventHashTable::wxEventHashTable(wxEventTable const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|28|undefined reference to `wxEVT_PAINT’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|28|undefined reference to `wxEVT_NULL’|
obj/Debug/subclasswxglcanvas.o||In function `__tcf_1′:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|26|undefined reference to `wxEventHashTable::~wxEventHashTable()’|
obj/Debug/subclasswxglcanvas.o||In function `main’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|95|undefined reference to `wxEntry(int&, char**)’|
obj/Debug/subclasswxglcanvas.o||In function `wxCreateApp()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|95|undefined reference to `wxAppConsole::CheckBuildOptions(char const*, char const*)’|
obj/Debug/subclasswxglcanvas.o||In function `wxGLCanvasSubClass::Render()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|51|undefined reference to `wxGLCanvas::SetCurrent()’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|52|undefined reference to `wxPaintDC::wxPaintDC(wxWindow*)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|53|undefined reference to `glClearColor’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|54|undefined reference to `glClear’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|55|undefined reference to `glViewport’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|57|undefined reference to `glBegin’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|58|undefined reference to `glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|59|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|60|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|61|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|62|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|63|undefined reference to `glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|64|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|65|undefined reference to `glEnd’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|67|undefined reference to `glBegin’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|68|undefined reference to `glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|69|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|70|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|71|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|72|undefined reference to `glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|73|undefined reference to `glEnd’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|76|undefined reference to `glColor4f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|77|undefined reference to `glutWireTeapot’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|79|undefined reference to `glLoadIdentity’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|80|undefined reference to `glColor4f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|81|undefined reference to `glutWireTeapot’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|84|undefined reference to `glFlush’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|85|undefined reference to `wxGLCanvas::SwapBuffers()’|
obj/Debug/subclasswxglcanvas.o||In function `wxGLCanvasSubClass’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxNullPalette’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxDefaultSize’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxDefaultPosition’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|33|undefined reference to `wxConvLibc’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to `glutInit’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to `wxGLCanvas::~wxGLCanvas()’|
obj/Debug/subclasswxglcanvas.o||In function `MyApp::OnInit()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|100|undefined reference to `wxFrameNameStr’|
obj/Debug/subclasswxglcanvas.o||In function `wxGLCanvasSubClass’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxNullPalette’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxDefaultSize’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxDefaultPosition’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|33|undefined reference to `wxConvLibc’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to `glutInit’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to `wxGLCanvas::~wxGLCanvas()’|
obj/Debug/subclasswxglcanvas.o||In function `wxStringBase::Init()’:|
/usr/include/wx-2.8/wx/string.h|270|undefined reference to `wxEmptyString’|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options…|
||=== Build finished: 50 errors, 0 warnings ===|

So…. This brings me back to this page.
http://ubuntuforums.org/showthread.php?p=5907768

I think I must be missing something very options here….
WxWiki says.
This compiled and worked with ‘g++ main.cpp -o gl `Wx-Config –libs –cxxflags –gl-libs`’ (note the extra flag for Wx-Config) plus your platform’s flags to link against OpenGL and GLUT.

Hmm.
Found a link on the ubuntu forum:

http://ubuntuforums.org/showthread.php?t=296421

which pointed me here

I wound up posting on wxforums…

Basically, I had my linker settings messed up..
So in summary:

For the sample code found at http://wiki.wxwidgets.org/WxGLCanvas,

On Ubuntu 8.04, using code::blocks the following settings will get the thing running.

project>Build Options>Compiler Settings>Other Options:`wx-config –cxxflags`
project>Build Options>Linker Settng>Other Linking Options>
`wx-config –libs –gl-libs` -lGL -lglut

wxwidgets and opencascade

I was playing around with Heekscad and I have to say it’s pretty cool but there’s almost too much going on there at the moment for me to  really digest.
I was playing around with the code sample gtkmmopencascade using code::blocks as the IDE,but I’m really more interested in seeing if I can get something working opencascade’ish using wxwidgets and  code::blocks.
So did a little googling and I ran across this interesting post on the OCC forum….
I ran across this link:
http://www.opencascade.org/org/forum/thread_5750/

And hear is someone trying to do what I’m doing…
http://www.opencascade.org/org/forum/thread_13740/
Hm… Well… I think I’m going to try copying over the thread and see what I can get going.

gtkmm and opencascade for dummies

Ok… about a half a year ago or so, I’ve was going like a banchee with code::blocks, wxwidgets C++ and opencascade.  Then QT decided to go LPGL which caused me to go dead in my tracks.

Anyway…. I decide to to pick this up again…    I found a my Gtkmm project which I evidently got working around Nov 08 from the date on the executable file…

So my objective, for today is to copy the files over to a new folder and see if I can get this think to run in code::blocks which I think it should be easier to bounce around the code to understand what’s going around.

After I get a basic understanding of what’s going on with the window in linux, I think I try the equivalent in wxwidgets.  I probably can take a look at heekscad to get an Idea of what’s going on there.

At that point, I’;; probably be at a crossroad.  Either I keep  playing around in Linux, or try to get some stuff working crossplatform in Windows…  But… onwards….

Let’s see where I left off..
jonas@Ubuntu4:~/gtkmmocascadeoriginal$ ls -l
total 460
-rw-r–r– 1 jonas jonas   5284 2008-10-23 05:34 gtkmmocascade.cpp
-rw-r–r– 1 jonas jonas   2130 2008-11-10 06:49 gtkmmocascade.h
-rw-r–r– 1 jonas jonas 109080 2008-11-11 20:22 gtkmmocascade.o
-rw-r–r– 1 jonas jonas   3120 2008-11-09 00:50 main.cpp
-rw-r–r– 1 jonas jonas  75132 2008-11-11 20:22 main.o
-rwxr-xr-x 1 jonas jonas 182637 2008-11-11 20:22 makebottle
-rw-r–r– 1 jonas jonas   4700 2008-10-23 05:32 MakeBottle.cpp
-rw-r–r– 1 jonas jonas  48004 2008-11-11 20:22 MakeBottle.o
-rw-r–r– 1 jonas jonas   1535 2008-11-11 20:21 Makefile
-rw-r–r– 1 jonas jonas   1547 2008-10-23 05:33 Makefile~
-rw-r–r– 1 jonas jonas   1547 2008-10-23 05:33 Makefile.old

jonas@Ubuntu4:~/gtkmmocascadeoriginal$

All rightly…
I used the code::block gui to create a folder called gtkmm_occ and a project file called
I guess I’ll create folder called gtkmm_occ a project file call gtkmm_occ.cbp. I created a src sub folder src for and dumped my *.h and *.cpp files in there.

My make file looked like this.

CC=g++

TARGET=makebottle

OBJS= main.o \
MakeBottle.o \
gtkmmocascade.o

GTK_INCLUDES=`pkg-config gtkmm-2.4  gtkglextmm-1.2 –cflags `
GTK_LDFLAGS=`pkg-config  gtkmm-2.4  gtkglextmm-1.2 –libs`

OCC_INCLUDES_OLD=-DCSFDB -DNO_CXX_EXCEPTION -DNo_Exception  \
-DHAVE_CONFIG_H -DHAVE_WOK_CONFIG_H -DLIN -DLININTEL \
-I/usr/include/opencascade
#-I/opt/OpenCASCADE5.2/ros/src/WOKTclLib this directory doesn’t exist

OCC_INCLUDES=-DCSFDB \
-DHAVE_CONFIG_H -DHAVE_WOK_CONFIG_H -DLIN -DLININTEL \
-I/usr/include/opencascade
#  \
#             -I/opt/OpenCASCADE5.2/ros/src/WOKTclLib

OCC_LDFLAGS=-L/usr/lib

LIB_OCC= -lTKernel -lTKMath -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo \
-lTKPrim -lTKBool -lTKFeat -lTKFillet -lTKOffset -lTKHLR \
-lTKService -lTKV2d -lTKV3d -lTKPCAF -lTKCDF -lTKCAF \
-lPTKernel -lTKIGES -lTKSTEP -lTKSTL -lTKVRML -lTKShHealing \
-lTKXSBase -lTKPShape -lTKShapeSchema -lTKOpenGl  -lTKBO  \
-lTKBool -lTKTopAlgo -lTKPrim -lTKOffset -lTKFillet -lTKBO

CPPFLAGS= -Wno-deprecated -I./ $(GTK_INCLUDES) $(OCC_INCLUDES)
CFLAGS=$(CPPFLAGS)

LDFLAGS=$(GTK_LDFLAGS) $(OCC_LDFLAGS) $(LIB_OCC)

$(TARGET):$(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)

.PHONY: clean distclean

clean:
-rm -f $(OBJS)

distclean:
-rm -f $(TARGET)

.SUFFIXES: .cpp .o

.cpp.o:
$(CC) $(CPPFLAGS) -c $< -o $@

main.o          : main.cpp gtkmmocascade.h
MakeBottle.o    : MakeBottle.cpp
gtkmmocascade.o : gtkmmocascade.cpp gtkmmocascade.h

According the codeblocks FAQ

This is what I need to do:

Q: My project should be compiled with a custom makefile. Is it possible with Code::Blocks?

A: Yes, you can. You need to change one settings with Code::Blocks 8.02:

a) In your project’s Properties, Check “This is a custom makefile”.

And that’s it! :

Well not quite……
I get this error.

————– Build: Debug in gtkmm_occ —————

Using makefile: Makefile
make: *** No rule to make target `Debug’.  Stop.
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings

So…. Lets see what a lil’ googling pulls up.

Ok… found something interesting here:

http://forums.codeblocks.org/index.php?topic=7648.0%3Bprev_next=prev

Supposedly, I need to go to f it still doesn’t work, you may have to go to Project>Build Options> Make Commands tab it’s in the rightmost tab

You can change the Build target commands there. On my setup I use this:

“Build project target” was

$make -f $makefile $target

change to read:

$make -f $makefile all

Under
“Clean Project/Target:

Was:

$make -f $makefile clean$target

Change to read:

$make -f $makefile clean

Nope…. Didn’t work. :(

Ok… Plan B.. Loose the makefile start with a clean project.

I kept building and then I started adding folders where headers adding it to

project=>build options=>search directories

Once I started hitting the gtkmm is figured I had to figure out how to add this from the make

GTK_INCLUDES=`pkg-config gtkmm-2.4  gtkglextmm-1.2 –cflags `
GTK_LDFLAGS=`pkg-config  gtkmm-2.4  gtkglextmm-1.2 –libs`

I found the answer here:

In summary I basically got this sample code to compile in code block by entering the following:

project=>build options=>compiler settings=>other options

`pkg-config gtkmm-2.4  gtkglextmm-1.2 –cflags `

and in:

project=>build options =>linker settings=>other linker settings
`pkg-config  gtkmm-2.4  gtkglextmm-1.2 –libs`
-lTKernel -lTKMath -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo \
-lTKPrim -lTKBool -lTKFeat -lTKFillet -lTKOffset -lTKHLR \
-lTKService -lTKV2d -lTKV3d -lTKPCAF -lTKCDF -lTKCAF \
-lPTKernel -lTKIGES -lTKSTEP -lTKSTL -lTKVRML -lTKShHealing \
-lTKXSBase -lTKPShape -lTKShapeSchema -lTKOpenGl  -lTKBO  \
-lTKBool -lTKTopAlgo -lTKPrim -lTKOffset -lTKFillet -lTKBO

When I build an run I get a picture.  Although in the sample code I stumbled across I seem to be missing the thread in the makebottle code.  When I uncommented out I got some error messages.
But hey it’s a start.  This seems a little to easy… It seems like blind luck that this works.

Ok..  Just looking at this stuff I think I’m going to do a little reading on openGL
I found a good starting point here:
http://www.opengl.org/wiki/Getting_started

Messing around with heekscad

Ok… Life has been really busy for me lately and I really haven’t had a lot of time for fun projects.

Anyway… This heeks cad stuff is really intriguing to me. I have most of the OCC components installed so in theory this should be no biggie…
I found download instructions here.

Couple of issues with the instructions: You can download RapidSVN very easily from the synaptic package manager.
Also,  you need to have the folder created where you want to downloaded, otherwise RapidSVN terminates.

Follow the instructions and the darn thing works…… Now I just have to figure out how the package works….  All I have to say is wow.   If you’ve seen by my blog posts…. most of the stuff I try is usually not easy… It’s nice to have things go nicely for a change.

Googling for a tutorial…. No luck on the first get go…. But darn this looks interesting:

http://cadcamcae.wikia.com/wiki/CallToAction

getting D3 calender function in Mgtd

Ok… So I ran a conversion package to convert d3 to mgtd.
I have to say, I think at some levels I like mgtd better.    During the project review, I get loosing my focus using D3.  mgtd imho seems to handle that better.   On the other hand, D3 has a really sweet calender function for reminders that I’ve grown rather found of.    It would really be nice to get the calender in d3 into mgtd.
I get the impression that this is a matter of finding a plugin and installing it.

Lets see, I just found a link about plug-ins

http://www.hlplanet.com/phpbb/viewtopic.php?p=18

More Gtd stuff. Work Home.. D3 vs Mgtd

Ok… So I’ve been doing this GTD for a about a month or so and I guess I’m waste deep into it so far.

At work, I’ve been keeping up with keeping email inbox and outbox clean as well as my real inbox.  I feel that this is really helping.   I still need to go through my files and do some labeling, archiving etc…  On the digital side,  my @actions required folder got a bit overloaded this week because of some must do projects, but hopefully I’ll get that cleared out next week.  One thing that I’m not entirely satisfied with at the moment is my waiting for list.  At first, I through everything in one virtual sub folder, but that seemed like it was a bit overwhelming and hard to keep track of.  I later setup sub-folders by name of what I was waiting for response on, but it seems like I’m not getting these cleared out.  I could use some improvement in this area.  Hmmm… I new project to go on the list ;) Next step do a little Internet research.

On the home side, aside from knocking off the next actions.  I have some home improvement/maintenance projects that once complete will really make me feel like I’ve succeeded (at least I’ll get less grief from da wife).  I splurged a little bit on myself and got a Dymo Letratag label maker.  I shopped a few places and found target to have the best price at around 19.99 or so..  It seems that for whatever reason my home office is totally out of control.  The inbox is loaded up with who knows what.  So…. Once I tame that beast I know that I’ve really arrived.

So far I think, I’ve loaded up about 102 projects or so.  One of the things that I’ve not been happy with in D3 is that when I scroll down the list when I’m doing my weekly project review and what to edit the tiddler, I tend to loose track  of where I was at and I seem to fall out of the zone.   I like the look and feel of D3 but at this point, this is really starting to be an irritent.  It seems I like to organize things into projects and sub-projects and I get the impression that MGTD is a little stronger with that… I found some discussion on how to port from D3 to Mgtd.  http://www.estamos.de/blog/2008/09/05/getting-things-done-gtd-migration-from-d-cubed-to-monkeygtd/

Now that I have a little data to play width it would be interesting to test out mgtd.