From e6dfbf176d594524c779613205e864e33fe0d4e8 Mon Sep 17 00:00:00 2001 From: Tats Date: Sat, 15 Mar 2014 22:02:13 -0400 Subject: [PATCH] Removed wxWidget prototypes --- prototypes/wx-01-simple/build.sh | 3 - prototypes/wx-01-simple/example.png | Bin 13385 -> 0 bytes prototypes/wx-01-simple/main.cpp | 373 ------------------ prototypes/wx-02-input-output/Common.cpp | 52 --- prototypes/wx-02-input-output/Common.h | 38 -- .../DestinationGLCanvas.cpp | 71 ---- .../wx-02-input-output/DestinationGLCanvas.h | 49 --- prototypes/wx-02-input-output/Mapper.h | 174 -------- .../wx-02-input-output/MapperGLCanvas.cpp | 120 ------ .../wx-02-input-output/MapperGLCanvas.h | 56 --- prototypes/wx-02-input-output/Paint.h | 92 ----- prototypes/wx-02-input-output/Shape.h | 66 ---- .../wx-02-input-output/SourceGLCanvas.cpp | 109 ----- .../wx-02-input-output/SourceGLCanvas.h | 50 --- prototypes/wx-02-input-output/build.sh | 3 - prototypes/wx-02-input-output/example.png | Bin 13385 -> 0 bytes prototypes/wx-02-input-output/main.cpp | 63 --- prototypes/wx-03-polyline/build.sh | 3 - prototypes/wx-03-polyline/main.cpp | 369 ----------------- 19 files changed, 1691 deletions(-) delete mode 100755 prototypes/wx-01-simple/build.sh delete mode 100644 prototypes/wx-01-simple/example.png delete mode 100644 prototypes/wx-01-simple/main.cpp delete mode 100644 prototypes/wx-02-input-output/Common.cpp delete mode 100644 prototypes/wx-02-input-output/Common.h delete mode 100644 prototypes/wx-02-input-output/DestinationGLCanvas.cpp delete mode 100644 prototypes/wx-02-input-output/DestinationGLCanvas.h delete mode 100644 prototypes/wx-02-input-output/Mapper.h delete mode 100644 prototypes/wx-02-input-output/MapperGLCanvas.cpp delete mode 100644 prototypes/wx-02-input-output/MapperGLCanvas.h delete mode 100644 prototypes/wx-02-input-output/Paint.h delete mode 100644 prototypes/wx-02-input-output/Shape.h delete mode 100644 prototypes/wx-02-input-output/SourceGLCanvas.cpp delete mode 100644 prototypes/wx-02-input-output/SourceGLCanvas.h delete mode 100755 prototypes/wx-02-input-output/build.sh delete mode 100644 prototypes/wx-02-input-output/example.png delete mode 100644 prototypes/wx-02-input-output/main.cpp delete mode 100755 prototypes/wx-03-polyline/build.sh delete mode 100644 prototypes/wx-03-polyline/main.cpp diff --git a/prototypes/wx-01-simple/build.sh b/prototypes/wx-01-simple/build.sh deleted file mode 100755 index 91a8fec..0000000 --- a/prototypes/wx-01-simple/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -# libwxgtk2.8-dev -g++ main.cpp -o run `wx-config --libs --cxxflags --gl-libs` -lglut -lGL -lSOIL -I/usr/include diff --git a/prototypes/wx-01-simple/example.png b/prototypes/wx-01-simple/example.png deleted file mode 100644 index ffb8a2c1664e7ea2a0b61fce458c9c555c71638c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13385 zcmeI3=T}o(+wNBg1OyTrN()6%ib@fJ5NZ%bigXo3n&JkjCWMIe1XNU{C`d0s5+QV? zgJ9SwL8Tc2Q3%Zd5s-)?g47qsc=pS4&L42b`LMratdTJ?=A75O@85N;xmF(7Se=6k zN(ce~05vl`V+Q~r)b{m)0A%|Uquk;P0J4DD8KVogv*$-*k~J|;xZg9ShU@%?>#97y zc76T$=jvA1$oGU`zhRU44TdCc3;#$`OGDwsG4;{N=3YwZEHk2Y-E)W;RF z4e%CzDcTic(;=Q8mRlrgI$AQ;R zgNKDqIH{$k+M@mjDnloa-#`AXPSml+{e*G>{tn1}sncPP!>GS%<&8E+Clk;vFm?9d z3H__kzcuu4m;KA3f5G^#b^L3t|HhC1Be(q<(Eh(ljP4|%`wzHczg5c}uUA}A{E?>I z`HII^^!KNLCaK#lb#d!AZ-0qBvN3QV?ki5{?B)w7AnC{Nnl^uUOHz9EkXaP&&Ec?- z(~n>IfvJ#T0`srt&aHc~k*0Jvm#R+JdYehrVW6_@);R8y%8yqQ`7%#_Iyjto!BiIc z{r(i-SNZP{|IdZ`6;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~>AC$EA;9dc)tU0s?$Q4P3fSHz diff --git a/prototypes/wx-01-simple/main.cpp b/prototypes/wx-01-simple/main.cpp deleted file mode 100644 index 7de3b8b..0000000 --- a/prototypes/wx-01-simple/main.cpp +++ /dev/null @@ -1,373 +0,0 @@ -// NOTE: To run, it is recommended not to be in Compiz or Beryl, they have shown some instability. -// Needs: libwxgtk2.8-dev libsoil-dev -// g++ main.cpp -o run `wx-config --libs --cxxflags --gl-libs` -lSOIL - -#include -#include -#include -#include -#include - -#ifndef WIN32 -#include // FIXME: ¿This work/necessary in Windows? - //Not necessary, but if it was, it needs to be replaced by process.h AND io.h -#endif - -typedef struct _Quad -{ - int x1; - int x2; - int x3; - int x4; - int y1; - int y2; - int y3; - int y4; -} Quad; - -static void -move_point (Quad *src, Quad *dst, int index, int x, int y) -{ - printf ("move_point (index=%d, x=%d, y=%d)\n", index, x, y); - switch (index) - { - case 1: - src->x1 += x; - src->y1 += y; - break; - case 2: - src->x2 += x; - src->y2 += y; - break; - case 3: - src->x3 += x; - src->y3 += y; - break; - case 4: - src->x4 += x; - src->y4 += y; - break; - case 5: - dst->x1 += x; - dst->y1 += y; - break; - case 6: - dst->x2 += x; - dst->y2 += y; - break; - case 7: - dst->x3 += x; - dst->y3 += y; - break; - case 8: - dst->x4 += x; - dst->y4 += y; - break; - } -} - -GLuint load_image (const char *imagepath, float *image_width, float *image_height) -{ - int width, height; - GLuint textureID = 0; - - unsigned char * data = - SOIL_load_image(imagepath, &width, &height, 0, SOIL_LOAD_RGB ); - textureID = SOIL_create_OGL_texture ( - data, width, height, 3, textureID, 0); - - // TODO: free data? - - (* image_width) = width; - (* image_height) = height; - - return textureID; -} - -class wxGLCanvasSubClass: public wxGLCanvas -{ - void Render(); - public: - wxGLCanvasSubClass(wxFrame* parent); - void Paintit(wxPaintEvent& event); - void movePoint(int index, int x, int y); - protected: - DECLARE_EVENT_TABLE() - private: - GLuint texture; - float image_width; - float image_height; - Quad src; - Quad dst; - - void OnChar(wxKeyEvent & event); - - void OnMouseEvent(wxMouseEvent& event); - void setup_texture(); -}; - -BEGIN_EVENT_TABLE(wxGLCanvasSubClass, wxGLCanvas) - EVT_PAINT (wxGLCanvasSubClass::Paintit) - EVT_KEY_DOWN (wxGLCanvasSubClass::OnChar) - EVT_MOUSE_EVENTS(wxGLCanvasSubClass::OnMouseEvent) -// EVT_ENTER_WINDOW(wxGLCanvasSubClass::OnMouseEnter) -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() }; -} - -void wxGLCanvasSubClass::Paintit(wxPaintEvent& WXUNUSED(event)) -{ - Render(); -} - -void wxGLCanvasSubClass::OnChar(wxKeyEvent & event) -{ - static int current = 0; - printf("hello"); - switch (event.GetKeyCode()) - { - case WXK_TAB: - current = (current + 1) % 8; - printf ("Current = %d\n", current); - break; - case WXK_UP: - move_point (&src, &dst, current + 1, 0, 1); - break; - case WXK_DOWN: - move_point (&src, &dst, current + 1, 0, -1); - break; - case WXK_LEFT: - move_point (&src, &dst, current + 1, -1, 0); - break; - case WXK_RIGHT: - move_point (&src, &dst, current + 1, 1, 0); - break; - default: - printf ("Unhandled key"); - break; - } - Render(); -} - -void wxGLCanvasSubClass::OnMouseEvent(wxMouseEvent& event) -{ - printf("x=%d y=%d LeftIsDown=%d\n", event.GetX(), event.GetY(), (int)event.LeftIsDown()); - SetFocus(); -} - -void wxGLCanvasSubClass::setup_texture() -{ - texture = load_image ("example.png", &image_width, &image_height); - - //source - src.x1 = 0; - src.y1 = 0; - - src.x2 = 320; - src.y2 = 0; - - src.x3 = 320; - src.y3 = 240; - - src.x4 = 0; - src.y4 = 240; - - //destination - dst.x1 = -320; - dst.y1 = -240; - - dst.x2 = 0; - dst.y2 = -240; - - dst.x3 = 0; - dst.y3 = 0; - - dst.x4 = -320; - dst.y4 = 0; // 240; -} - -void wxGLCanvasSubClass::Render() -{ - static bool texture_is_set = false; - float ratio; - - SetCurrent(); - wxPaintDC dc(this); - - if (! texture_is_set) - { - this->setup_texture(); - texture_is_set = true; - } - ratio = (float) GetSize().x / (float) GetSize().y; - - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); -// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glViewport(0, 0, (GLint) GetSize().x, (GLint) GetSize().y); - - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); - glOrtho (-ratio, ratio, -1.f, 1.f, 1.f, -1.f); - glMatrixMode (GL_MODELVIEW); - - glLoadIdentity (); - - // Now, draw - // DRAW THE TEXTURE - glPushMatrix (); - - // Enable blending mode (for alphas). - glEnable (GL_BLEND); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - - glDisable (GL_LIGHTING); - glEnable (GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, texture); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - - // Draw source texture (not moving). - glColor4f (1, 1, 1, 0.5f); - glBegin (GL_QUADS); - { - glTexCoord2f (0, 0); - glVertex3f (0, 0, 0); - - glTexCoord2f (1, 0); - glVertex3f (1, 0, 0); - - glTexCoord2f (1, 1); - glVertex3f (1, 1, 0); - - glTexCoord2f (0, 1); - glVertex3f (0, 1, 0); - } - glEnd (); - - // Project source texture and sent it to destination. - glColor4f (1, 1, 1, 1.0f); - glBegin (GL_QUADS); - { - glTexCoord2f (src.x1 / image_width, src.y1 / image_height); - glVertex3f (dst.x1 / image_width, dst.y1 / image_height, 0); - - glTexCoord2f (src.x2 / image_width, src.y2 / image_height); - glVertex3f (dst.x2 / image_width, dst.y2 / image_height, 0); - - glTexCoord2f (src.x3 / image_width, src.y3 / image_height); - glVertex3f (dst.x3 / image_width, dst.y3 / image_height, 0); - - glTexCoord2f (src.x4 / image_width, src.y4 / image_height); - glVertex3f (dst.x4 / image_width, dst.y4 / image_height, 0); - } - glEnd (); - - glDisable(GL_TEXTURE_2D); - - glColor4f (1, 1, 1, 1); - - // Source quad. - glLineWidth(5); - glBegin (GL_LINE_STRIP); - { - glVertex3f(src.x1 / image_width, src.y1 / image_height, 0); - glVertex3f(src.x2 / image_width, src.y2 / image_height, 0); - glVertex3f(src.x3 / image_width, src.y3 / image_height, 0); - glVertex3f(src.x4 / image_width, src.y4 / image_height, 0); - glVertex3f(src.x1 / image_width, src.y1 / image_height, 0); - } - glEnd (); - - glColor4f (1, 0, 0, 1); - - // Destination quad. - glBegin (GL_LINE_STRIP); - { - glVertex3f(dst.x1 / image_width, dst.y1 / image_height, 0); - glVertex3f(dst.x2 / image_width, dst.y2 / image_height, 0); - glVertex3f(dst.x3 / image_width, dst.y3 / image_height, 0); - glVertex3f(dst.x4 / image_width, dst.y4 / image_height, 0); - glVertex3f(dst.x1 / image_width, dst.y1 / image_height, 0); - } - glEnd (); - - glDisable (GL_TEXTURE_2D); - glPopMatrix (); - - // Done drawing - - glFlush(); - SwapBuffers(); -} - -void wxGLCanvasSubClass::movePoint(int index, int x, int y) -{ - move_point (&src, &dst, index, x, y); -} - -class MyApp: public wxApp -{ - private: - virtual bool OnInit(); - wxGLCanvasSubClass * MyGLCanvas; - int FilterEvent(wxEvent& event); -}; - -int MyApp::FilterEvent(wxEvent& event) -{ - static int current = 0; - if ((event.GetEventType() == wxEVT_KEY_DOWN)) - { - switch (((wxKeyEvent&)event).GetKeyCode()) - { - case WXK_TAB: - current = (current + 1) % 8; - printf ("Current = %d\n", current); - return true; - break; - case WXK_UP: - MyGLCanvas->movePoint(current + 1, 0, 1); - return true; - break; - case WXK_DOWN: - MyGLCanvas->movePoint(current + 1, 0, -1); - return true; - break; - case WXK_LEFT: - MyGLCanvas->movePoint(current + 1, -1, 0); - return true; - break; - case WXK_RIGHT: - MyGLCanvas->movePoint(current + 1, 1, 0); - return true; - break; - default: - printf ("Unhandled key"); - break; - } - } - return -1; -} - -IMPLEMENT_APP(MyApp) - -bool MyApp::OnInit() -{ - wxFrame *frame = new wxFrame((wxFrame *) NULL, -1, wxT("Hello GL World"), wxPoint(50, 50), wxSize(640, 480)); - MyGLCanvas = new wxGLCanvasSubClass(frame); - -// frame->SetWindowStyle(wxWANTS_CHARS); - frame->Show(TRUE); - return TRUE; -} diff --git a/prototypes/wx-02-input-output/Common.cpp b/prototypes/wx-02-input-output/Common.cpp deleted file mode 100644 index 8f6ee49..0000000 --- a/prototypes/wx-02-input-output/Common.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Common.cpp - * - * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "Common.h" - -std::tr1::shared_ptr Common::currentMapping; -std::tr1::shared_ptr Common::currentMapper; - -void Common::initializeLibremapper(int frameWidth, int frameHeight) { - Image* img = new Image("example.png"); - - float centerX = frameWidth / 2; - float centerY = frameHeight / 2; - float textureHalfWidth = img->getWidth() / 2; - float textureHalfHeight = img->getHeight() / 2; -// printf("Common: %f %f %f %f\n", centerX, centerY, textureHalfWidth, textureHalfHeight); - - TextureMapping* tm = new TextureMapping( - img, - - // Destination. - new Quad(Point(centerX-textureHalfWidth, centerY-textureHalfHeight), - Point(centerX+textureHalfWidth, centerY-textureHalfHeight), - Point(centerX+textureHalfWidth, centerY+textureHalfHeight), - Point(centerX-textureHalfWidth, centerY+textureHalfHeight)), - - // Input. - new Quad(Point(centerX-textureHalfWidth, centerY-textureHalfHeight), - Point(centerX+textureHalfWidth, centerY-textureHalfHeight), - Point(centerX+textureHalfWidth, centerY+textureHalfHeight), - Point(centerX-textureHalfWidth, centerY+textureHalfHeight)) - ); - Common::currentMapping.reset( tm ); - Common::currentMapper.reset( new QuadTextureMapper( tm ) ); -} - diff --git a/prototypes/wx-02-input-output/Common.h b/prototypes/wx-02-input-output/Common.h deleted file mode 100644 index ede3e08..0000000 --- a/prototypes/wx-02-input-output/Common.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Common.h - * - * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef COMMON_H_ -#define COMMON_H_ - -#include - -#include "Paint.h" -#include "Shape.h" -#include "Mapper.h" - -class Common { -public: - static std::tr1::shared_ptr currentMapping; - static std::tr1::shared_ptr currentMapper; - - static void initializeLibremapper(int frameWidth, int frameHeight); -}; - -#endif /* COMMON_H_ */ diff --git a/prototypes/wx-02-input-output/DestinationGLCanvas.cpp b/prototypes/wx-02-input-output/DestinationGLCanvas.cpp deleted file mode 100644 index 5b32167..0000000 --- a/prototypes/wx-02-input-output/DestinationGLCanvas.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * DestinationGLCanvas.cpp - * - * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "DestinationGLCanvas.h" - -DestinationGLCanvas::DestinationGLCanvas(wxFrame *parent) : - MapperGLCanvas(parent) { -// int argc = 1; -// char* argv[1] = { wxString((wxTheApp ->argv)[0]).char_str() }; -} - -void DestinationGLCanvas::doRender() { - // TODO: Ceci est un hack necessaire car tout est en fonction de la width/height de la texture. - // Il faut changer ca. - std::tr1::shared_ptr textureMapping = std::tr1::static_pointer_cast(Common::currentMapping); - wxASSERT(textureMapping != NULL); - - std::tr1::shared_ptr texture = std::tr1::static_pointer_cast(textureMapping->getPaint()); - wxASSERT(texture != NULL); - - if (texture->getTextureId() == 0) - { - texture->loadTexture(); - texture->setPosition( (GetClientSize().x - texture->getWidth()) / 2, - (GetClientSize().y - texture->getHeight()) / 2 ); - } - - // Now, draw - // DRAW THE TEXTURE - glPushMatrix(); - - // Draw the mapping. - Common::currentMapper->draw(); - - // Draw the quad. - Quad& quad = getQuad(); - - glColor4f(1, 0, 0, 1); - - // Destination quad. - // Source quad. - glLineWidth(5); - glBegin (GL_LINE_STRIP); - { - for (int i=0; i<5; i++) { - glVertex3f(quad.getVertex(i % 4).x, - quad.getVertex(i % 4).y, - 0); - } - } - glEnd (); - - glPopMatrix(); -} - diff --git a/prototypes/wx-02-input-output/DestinationGLCanvas.h b/prototypes/wx-02-input-output/DestinationGLCanvas.h deleted file mode 100644 index e668176..0000000 --- a/prototypes/wx-02-input-output/DestinationGLCanvas.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * DestinationGLCanvas.h - * - * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef DESTINATIONGLCANVAS_H_ -#define DESTINATIONGLCANVAS_H_ - -#include -#include -#include -#include -#include - -#include "MapperGLCanvas.h" - -class DestinationGLCanvas: public MapperGLCanvas { -public: - DestinationGLCanvas(wxFrame* parent); - - virtual Quad& getQuad() { - std::tr1::shared_ptr textureMapping = std::tr1::static_pointer_cast(Common::currentMapping); - wxASSERT(textureMapping != NULL); - - std::tr1::shared_ptr quad = std::tr1::static_pointer_cast(Common::currentMapping->getShape()); - wxASSERT(quad != NULL); - - return (*quad); - } - -private: - virtual void doRender(); -}; - -#endif /* DESTINATIONGLCANVAS_H_ */ diff --git a/prototypes/wx-02-input-output/Mapper.h b/prototypes/wx-02-input-output/Mapper.h deleted file mode 100644 index a4fb31d..0000000 --- a/prototypes/wx-02-input-output/Mapper.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Mapper.h - * - * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef MAPPER_H_ -#define MAPPER_H_ - -#include "Shape.h" -#include "Paint.h" - -#include - -#include -#include -#include -#include -#include - -class Mapping -{ -protected: - std::tr1::shared_ptr _paint; - std::tr1::shared_ptr _shape; - -public: - Mapping(Paint* paint, Shape* shape) - : _paint(paint), _shape(shape) - {} - - virtual void build() { - _paint->build(); - _shape->build(); - } - -public: - std::tr1::shared_ptr getPaint() const { return _paint; } - std::tr1::shared_ptr getShape() const { return _shape; } -}; - -class TextureMapping : public Mapping -{ -private: - std::tr1::shared_ptr _inputShape; - -public: - TextureMapping(Paint* paint, - Shape* shape, - Shape* inputShape) - : Mapping(paint, shape), - _inputShape(inputShape) - {} - - virtual void build() { - Mapping::build(); - _inputShape->build(); - } -public: - std::tr1::shared_ptr getInputShape() const { return _inputShape; } -}; - -class Mapper -{ -protected: - std::tr1::shared_ptr _mapping; - Mapper(Mapping* mapping) : _mapping(mapping) {} - virtual ~Mapper() {} - -public: - virtual void draw() = 0; -}; - -//class ShapeDrawer -//{ -//protected: -// std:tr1::shared_ptr _shape; -// -//public: -// ShapeDrawer(const std:tr1::shared_ptr& shape) : _shape(shape) {} -// virtual ~ShapeDrawer() {} -// -// virtual void draw() = 0; -//}; -// -//class QuadDrawer -//{ -//public: -// QuadDrawer(const std:tr1::shared_ptr& quad) : ShapeDrawer(quad) {} -// -// virtual void draw() { -// std::tr1::shared_ptr quad = std::tr1::static_pointer_cast(_shape); -// wxASSERT(quad != NULL); -// -// glColor4f (1, 1, 1, 1); -// -// // Source quad. -// glLineWidth(5); -// glBegin (GL_LINE_STRIP); -// { -// for (int i=0; i<5; i++) { -// glVertex3f(quad->getVertex(i % 4).x / (GLfloat)texture->getWidth(), -// quad->getVertex(i % 4).y / (GLfloat)texture->getHeight(), -// 0); -// } -// } -// glEnd (); -// } -//}; - -class QuadTextureMapper : public Mapper -{ -public: - QuadTextureMapper(TextureMapping* mapping) : Mapper(mapping) {} - virtual ~QuadTextureMapper() {} - - virtual void draw() { - std::tr1::shared_ptr textureMapping = std::tr1::static_pointer_cast(_mapping); - wxASSERT(textureMapping != NULL); - - std::tr1::shared_ptr texture = std::tr1::static_pointer_cast(textureMapping->getPaint()); - wxASSERT(texture != NULL); - - std::tr1::shared_ptr quad = std::tr1::static_pointer_cast(textureMapping->getShape()); - wxASSERT(quad != NULL); - - std::tr1::shared_ptr inputQuad = std::tr1::static_pointer_cast(textureMapping->getInputShape()); - wxASSERT(inputQuad != NULL); - - printf("Texid: %d\n", texture->getTextureId()); - // Project source texture and sent it to destination. - - glEnable (GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, texture->getTextureId()); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - glColor4f(1, 1, 1, 1.0f); - glBegin(GL_QUADS); - { - for (int i=0; i<4; i++) - { - glTexCoord2f( ( inputQuad->getVertex(i).x - texture->getX() ) / (GLfloat) texture->getWidth(), - ( inputQuad->getVertex(i).y - texture->getY() ) / (GLfloat) texture->getHeight()); - glVertex3f( quad->getVertex(i).x, - quad->getVertex(i).y, - 0); - } - } - glEnd(); - - glDisable(GL_TEXTURE_2D); - } -}; - - -#endif /* MAPPER_H_ */ diff --git a/prototypes/wx-02-input-output/MapperGLCanvas.cpp b/prototypes/wx-02-input-output/MapperGLCanvas.cpp deleted file mode 100644 index 5142d69..0000000 --- a/prototypes/wx-02-input-output/MapperGLCanvas.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * MapperGLCanvas.cpp - * - * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "MapperGLCanvas.h" - -wxGLContext* MapperGLCanvas::sharedContext = 0; - -BEGIN_EVENT_TABLE (MapperGLCanvas, wxGLCanvas) - EVT_PAINT (MapperGLCanvas::Paintit) - EVT_KEY_DOWN (MapperGLCanvas::OnChar) - EVT_MOUSE_EVENTS(MapperGLCanvas::OnMouseEvent) -// EVT_ENTER_WINDOW(MapperGLCanvas::OnMouseEnter) -END_EVENT_TABLE() - - -MapperGLCanvas::MapperGLCanvas(wxFrame *parent) : - wxGLCanvas(parent, sharedContext, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, - wxT("GLCanvas")) { - if (!sharedContext) { - sharedContext = GetContext(); - } - // int argc = 1; - // char* argv[1] = { wxString((wxTheApp ->argv)[0]).char_str() }; -} - -void MapperGLCanvas::Paintit(wxPaintEvent& WXUNUSED(event)) { - GetParent()->Refresh(); - Render(); -} - -void MapperGLCanvas::OnChar(wxKeyEvent & event) { - static int current = 0; - int xMove = 0; - int yMove = 0; - switch (event.GetKeyCode()) { - case WXK_TAB: - current = (current + 1) % 4; - break; - case WXK_UP: - yMove = -1; - break; - case WXK_DOWN: - yMove = +1; - break; - case WXK_LEFT: - xMove = -1; - break; - case WXK_RIGHT: - xMove = +1; - break; - default: - printf("Unhandled key"); - break; - } - - Quad& quad = getQuad(); - Point p = quad.getVertex(current); - p.x += xMove; - p.y += yMove; - quad.setVertex(current, p); - - Render(); -} - -void MapperGLCanvas::OnMouseEvent(wxMouseEvent& event) { - printf("x=%d y=%d LeftIsDown=%d\n", event.GetX(), event.GetY(), - (int) event.LeftIsDown()); - SetFocus(); -} - -void MapperGLCanvas::Render() { - if (!sharedContext) { - sharedContext = GetContext(); - } - SetCurrent(*sharedContext); - wxPaintDC dc(this); - - enterRender(); - doRender(); - exitRender(); -} - -void MapperGLCanvas::enterRender() { - - glClearColor(0.0, 0.0, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, (GLint) GetSize().x, (GLint) GetSize().y); - - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); - glOrtho ( - 0.0f, (float) GetSize().x, // left, right - (float) GetSize().y, 0.0f, // bottom, top - -1.0, 1.0f); - glMatrixMode (GL_MODELVIEW); -// glLoadIdentity (); // FIXME? is this needed here? -} - -void MapperGLCanvas::exitRender() { - glFlush(); - SwapBuffers(); -} - - diff --git a/prototypes/wx-02-input-output/MapperGLCanvas.h b/prototypes/wx-02-input-output/MapperGLCanvas.h deleted file mode 100644 index 46351f5..0000000 --- a/prototypes/wx-02-input-output/MapperGLCanvas.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * MapperGLCanvas.h - * - * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef MAPPERGLCANVAS_H_ -#define MAPPERGLCANVAS_H_ - -#include -#include - -#include "Common.h" -#include "Shape.h" - -class MapperGLCanvas: public wxGLCanvas { -private: - static wxGLContext* sharedContext; - -public: - MapperGLCanvas(wxFrame* parent); - virtual ~MapperGLCanvas() {} - - virtual void Paintit(wxPaintEvent& event); - - virtual Quad& getQuad() = 0; - -protected: - DECLARE_EVENT_TABLE() - - virtual void Render(); - virtual void enterRender(); - virtual void doRender() = 0; - virtual void exitRender(); - -private: - virtual void OnChar(wxKeyEvent& event); - virtual void OnMouseEvent(wxMouseEvent& event); - -}; - -#endif /* MAPPERGLCANVAS_H_ */ diff --git a/prototypes/wx-02-input-output/Paint.h b/prototypes/wx-02-input-output/Paint.h deleted file mode 100644 index 377cde1..0000000 --- a/prototypes/wx-02-input-output/Paint.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Paint.h - * - * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef PAINT_H_ -#define PAINT_H_ - -#include -#include -#include - -class Paint -{ -protected: - Paint() {} -public: - virtual ~Paint() {} - virtual void build() {} -}; - -class Texture : public Paint -{ -protected: - GLuint textureId; - int x; - int y; - - Texture(GLuint textureId_=0) : textureId(textureId_) {} - virtual ~Texture() {} - -public: - GLuint getTextureId() const { return textureId; } - virtual void loadTexture() = 0; - virtual int getWidth() const = 0; - virtual int getHeight() const = 0; - - virtual void setPosition(int xPos, int yPos) { - x = xPos; - y = yPos; - } - virtual int getX() const { return x; } - virtual int getY() const { return y; } -}; - -class Image : public Texture -{ -protected: - std::string imagePath; - int width; - int height; - int x; - int y; - unsigned char* imageData; - -public: - Image(const std::string imagePath_) : Texture(), imagePath(imagePath_), width(-1), height(-1), x(-1), y(-1) { - imageData = SOIL_load_image(imagePath.c_str(), &width, &height, 0, SOIL_LOAD_RGB ); - wxASSERT(imageData); - } - virtual ~Image() {} - - virtual void loadTexture() { - textureId = SOIL_create_OGL_texture ( imageData, width, height, 3, textureId, 0); - // TODO: free data? - } - - virtual void build() { - } - - virtual int getWidth() const { return width; } - virtual int getHeight() const { return height; } - - -}; - -#endif /* PAINT_H_ */ diff --git a/prototypes/wx-02-input-output/Shape.h b/prototypes/wx-02-input-output/Shape.h deleted file mode 100644 index 279e235..0000000 --- a/prototypes/wx-02-input-output/Shape.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Shape.h - * - * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef SHAPE_H_ -#define SHAPE_H_ - -#include -#include - -struct Point -{ - double x; - double y; - Point(double x_, double y_) : x(x_), y(y_) {} -}; - -class Shape -{ -public: - std::vector vertices; - Shape() {} - Shape(std::vector vertices_) : vertices(vertices_) {} - virtual ~Shape() {} - - virtual void build() {} - - const Point& getVertex(int i) { return vertices[i]; } - void setVertex(int i, Point v) { vertices[i] = v; } - void setVertex(int i, double x, double y) - { - vertices[i].x = x; - vertices[i].y = y; - } -}; - -class Quad : public Shape -{ -public: - Quad() {} - Quad(Point p1, Point p2, Point p3, Point p4) { - vertices.push_back(p1); - vertices.push_back(p2); - vertices.push_back(p3); - vertices.push_back(p4); - } - virtual ~Quad() {} -}; - -#endif /* SHAPE_H_ */ diff --git a/prototypes/wx-02-input-output/SourceGLCanvas.cpp b/prototypes/wx-02-input-output/SourceGLCanvas.cpp deleted file mode 100644 index 6ccd03a..0000000 --- a/prototypes/wx-02-input-output/SourceGLCanvas.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * SourceGLCanvas.cpp - * - * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "SourceGLCanvas.h" - -SourceGLCanvas::SourceGLCanvas(wxFrame *parent) : - MapperGLCanvas(parent) { -// int argc = 1; -// char* argv[1] = { wxString((wxTheApp ->argv)[0]).char_str() }; -} - -void SourceGLCanvas::doRender() { - // TODO: Ceci est un hack necessaire car tout est en fonction de la width/height de la texture. - // Il faut changer ca. - std::tr1::shared_ptr textureMapping = std::tr1::static_pointer_cast(Common::currentMapping); - wxASSERT(textureMapping != NULL); - - std::tr1::shared_ptr texture = std::tr1::static_pointer_cast(textureMapping->getPaint()); - wxASSERT(texture != NULL); - - if (texture->getTextureId() == 0) { - texture->loadTexture(); - texture->setPosition( (GetClientSize().x - texture->getWidth()) / 2, - (GetClientSize().y - texture->getHeight()) / 2 ); - } - // Now, draw - // DRAW THE TEXTURE - glPushMatrix(); - - // Enable blending mode (for alphas). - glEnable (GL_BLEND); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - glDisable (GL_LIGHTING); - glEnable (GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, texture->getTextureId()); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - // TODO: Exact projection of texture - // see http://stackoverflow.com/questions/15242507/perspective-correct-texturing-of-trapezoid-in-opengl-es-2-0 - - // Draw source texture (not moving) in the center of the area. - - float centerX = GetClientSize().x / 2; - float centerY = GetClientSize().y / 2; - float textureHalfWidth = texture->getWidth() / 2; - float textureHalfHeight = texture->getHeight() / 2; - - //printf("SRC: %f %f %f %f\n", centerX, centerY, textureHalfWidth, textureHalfHeight); - glColor4f (1, 1, 1, 1.0f); - glBegin (GL_QUADS); - { - glTexCoord2f (0, 0); - glVertex3f (texture->getX(), texture->getY(), 0); - - glTexCoord2f (1, 0); - glVertex3f (texture->getX()+texture->getWidth(), texture->getY(), 0); - - glTexCoord2f (1, 1); - glVertex3f (texture->getX()+texture->getWidth(), texture->getY()+texture->getHeight(), 0); - - glTexCoord2f (0, 1); - glVertex3f (texture->getX(), texture->getY()+texture->getHeight(), 0); - } - glEnd (); - - glDisable(GL_TEXTURE_2D); - - // Draw the quad. - Quad& quad = getQuad(); - - glColor4f(1, 0, 0, 1); - - // Source quad. - // Source quad. - glLineWidth(5); - glBegin (GL_LINE_STRIP); - { - for (int i=0; i<5; i++) { - glVertex3f(quad.getVertex(i % 4).x, - quad.getVertex(i % 4).y, - 0); - } - } - glEnd (); - - glPopMatrix(); -} - diff --git a/prototypes/wx-02-input-output/SourceGLCanvas.h b/prototypes/wx-02-input-output/SourceGLCanvas.h deleted file mode 100644 index 270bec0..0000000 --- a/prototypes/wx-02-input-output/SourceGLCanvas.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SourceGLCanvas.h - * - * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef SOURCEGLCANVAS_H_ -#define SOURCEGLCANVAS_H_ - -#include -#include -#include -#include -#include - -#include "MapperGLCanvas.h" - -class SourceGLCanvas: public MapperGLCanvas { -public: - SourceGLCanvas(wxFrame* parent); - - virtual Quad& getQuad() { - std::tr1::shared_ptr textureMapping = std::tr1::static_pointer_cast(Common::currentMapping); - wxASSERT(textureMapping != NULL); - - std::tr1::shared_ptr inputQuad = std::tr1::static_pointer_cast(textureMapping->getInputShape()); - wxASSERT(inputQuad != NULL); - - return (*inputQuad); - } - -private: - virtual void doRender(); -}; - - -#endif /* DESTINATIONGLCANVAS_H_ */ diff --git a/prototypes/wx-02-input-output/build.sh b/prototypes/wx-02-input-output/build.sh deleted file mode 100755 index 1f32ba8..0000000 --- a/prototypes/wx-02-input-output/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -# libwxgtk2.8-dev -g++ main.cpp Common.cpp DestinationGLCanvas.cpp SourceGLCanvas.cpp MapperGLCanvas.cpp -o run `wx-config --libs --cxxflags --gl-libs` -lglut -lGL -lSOIL -I/usr/include diff --git a/prototypes/wx-02-input-output/example.png b/prototypes/wx-02-input-output/example.png deleted file mode 100644 index ffb8a2c1664e7ea2a0b61fce458c9c555c71638c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13385 zcmeI3=T}o(+wNBg1OyTrN()6%ib@fJ5NZ%bigXo3n&JkjCWMIe1XNU{C`d0s5+QV? zgJ9SwL8Tc2Q3%Zd5s-)?g47qsc=pS4&L42b`LMratdTJ?=A75O@85N;xmF(7Se=6k zN(ce~05vl`V+Q~r)b{m)0A%|Uquk;P0J4DD8KVogv*$-*k~J|;xZg9ShU@%?>#97y zc76T$=jvA1$oGU`zhRU44TdCc3;#$`OGDwsG4;{N=3YwZEHk2Y-E)W;RF z4e%CzDcTic(;=Q8mRlrgI$AQ;R zgNKDqIH{$k+M@mjDnloa-#`AXPSml+{e*G>{tn1}sncPP!>GS%<&8E+Clk;vFm?9d z3H__kzcuu4m;KA3f5G^#b^L3t|HhC1Be(q<(Eh(ljP4|%`wzHczg5c}uUA}A{E?>I z`HII^^!KNLCaK#lb#d!AZ-0qBvN3QV?ki5{?B)w7AnC{Nnl^uUOHz9EkXaP&&Ec?- z(~n>IfvJ#T0`srt&aHc~k*0Jvm#R+JdYehrVW6_@);R8y%8yqQ`7%#_Iyjto!BiIc z{r(i-SNZP{|IdZ`6;(49wc!;P)zSUehP??v^xM{)_N;B<>Xvf$H($54q0q`0DZiFa z-2rv2Kb}@NTi^bBe|benx9=cZW@}{*SB}kDI_~!S-Rj1-sHljg61NuVyt|t3Uvlns}d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m_SAUH%=$DfBA(W5l6zK=PfwYkSmJRsI=ht`@XB3d~Yv*1&r8V#z@O*Si zDj(-ezDK2P6s65H`M~fX^varyEH4_8s<}t6*X4+v1(q-yV0XctN5;E`Vc(=2KY4`k zcCo>75pUv1dOaIBen!TUl{?{4Umao$Su$JFwV7OD6`!lP_fSU$x~8k`iw5MhO00?= zoURBh^n7^X@=*C+HfAlWviP|9Z~shHyC5nDfjqr<@1JCI6r@IqKGk(-Tqtnki}VYy(}9^^|ZPv zqxJncB)5H+PfF3)jG`_CXg=DVB`-#Yn6~%857=rGek+fog$-~5x-wc8#E8Y;XoEz4x$6h24&UI z-~jyY!VY~5fo`WOIvGD&M0uViUnew$@^(3sJikd0X$W|*=#Y2YmgjSM4;8O#U zwf3l;pVywf=ehW6c?FCpw@|iD8{{-1@!0T6oWlK}%yzbkk>GVQdAykW1)hoU1REt7 zPkq+bnUkWk#&&Q6?}s1cvyqvE0%vyC9V0e+))J?RG1_=w!B9|6Z$dlV`8n7C;+3K!*d z;M>YG-#P5K(osHhC`8TH0jwPmU|m7D2%K8QE|2NKkYG16cW02PsVf<-IXS z)n@5B1_}a>z$~T)gN5YJJo(&os@9ZNILs9Gw(;6 z@f+Kuy&^w_XVfsWj^fi)D497BUUW3np>XaPj$vbag<%Q^p?~V-G0lF3K%}sY~K#nz?o>oj4S(JT4t+}yJUq* zdq94(>8P)vq$#2@F17sI2pZr>8;vaKPVZ1ZI%ySdbGr)M70HP~1j(#Vl~Ut|lc%Ha zJ?E#RPdU!(Ae}gq zJZ%mksCLh&7zmWOLyHT^8Z>?}yDI<)(haNC^*Aaaf|r*%1(dP{Rn{aA6^((CI-+gG zy~(r{M>)cN7VVm_MMloKi!#;7&)samP6|VO(d3>w);%-FWd?;Zx b3RF0eGJ`!~>AC$EA;9dc)tU0s?$Q4P3fSHz diff --git a/prototypes/wx-02-input-output/main.cpp b/prototypes/wx-02-input-output/main.cpp deleted file mode 100644 index 10c89b4..0000000 --- a/prototypes/wx-02-input-output/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// NOTE: To run, it is recommended not to be in Compiz or Beryl, they have shown some instability. - -#include -#include "Common.h" -#include "DestinationGLCanvas.h" -#include "SourceGLCanvas.h" - -#include -#include - -#ifndef WIN32 -#include // 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 MyApp: public wxApp -{ - virtual bool OnInit(); - SourceGLCanvas * sourceCanvas; - DestinationGLCanvas * destinationCanvas; -//public: -// int FilterEvent(wxEvent& event); -}; - -IMPLEMENT_APP(MyApp) - -bool MyApp::OnInit() -{ - wxFrame *frame = new wxFrame((wxFrame *) NULL, -1, wxT("Libremapping"), wxPoint(50, 50), wxSize(640, 480)); - - wxBoxSizer* topSizer = new wxBoxSizer( wxHORIZONTAL ); - sourceCanvas = new SourceGLCanvas(frame); - destinationCanvas = new DestinationGLCanvas(frame); - - topSizer->Add(sourceCanvas, 1, wxEXPAND); - topSizer->AddSpacer(10); - topSizer->Add(destinationCanvas, 1, wxEXPAND); - -// frame->SetWindowStyle(wxWANTS_CHARS); - frame->SetSizer(topSizer); - - // HACK: values 320x480 should be retrieved automatically - Common::initializeLibremapper(320, 480); - - frame->Show(TRUE); - - - - return TRUE; -} -// -//int MyApp::FilterEvent(wxEvent& event) { -// printf("Event: %d %d\n", event.GetEventType(), wxEVT_KEY_DOWN); -// -// if (event.GetEventType() == wxEVT_CHAR) { -// printf("Char: %d\n", ((wxKeyEvent&)event).GetKeyCode()); -// return true; -// } -// -// return -1; -//} -// - diff --git a/prototypes/wx-03-polyline/build.sh b/prototypes/wx-03-polyline/build.sh deleted file mode 100755 index b092221..0000000 --- a/prototypes/wx-03-polyline/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -# libwxgtk2.8-dev -g++ main.cpp -o run `wx-config --libs --cxxflags --gl-libs` diff --git a/prototypes/wx-03-polyline/main.cpp b/prototypes/wx-03-polyline/main.cpp deleted file mode 100644 index 424c094..0000000 --- a/prototypes/wx-03-polyline/main.cpp +++ /dev/null @@ -1,369 +0,0 @@ -// NOTE: To run, it is recommended not to be in Compiz or Beryl, they have shown some instability. -// Needs: libwxgtk2.8-dev -// g++ main.cpp -o run `wx-config --libs --cxxflags --gl-libs` - -#include -#include -#include -#include -#include - -#ifndef WIN32 -#include // FIXME: ¿This work/necessary in Windows? - //Not necessary, but if it was, it needs to be replaced by process.h AND io.h -#endif - -typedef enum -{ - LINES = 0, - POLYGON = 1 -} Style; - -/* - * Left: place point - * Right: remove previous point - * Middle: invisible line. (no line) - */ -class Point -{ - public: - Point(float x, float y) - { - this->x = x; - this->y = y; - } - float x; - float y; -}; - -class PolyLine -{ - public: - void addPoint(Point point); - void removeLastPoint(); - void clear(); - void draw(); - unsigned int size(); - void setStyle(Style style); - private: - std::vector points; - Style style; -}; - -void PolyLine::setStyle(Style style) -{ - this->style = style; -} - -unsigned int PolyLine::size() -{ - return points.size(); -} - -void PolyLine::addPoint(Point point) -{ - points.push_back(point); -} - -void PolyLine::removeLastPoint() -{ - if (points.size() >= 1) - points.erase(points.end()); -} -void PolyLine::clear() -{ - points.clear(); -} - -void PolyLine::draw() -{ - std::vector::const_iterator iter; - - glPushMatrix (); - if (style == LINES) - glBegin (GL_LINE_STRIP); - else if (style == POLYGON) - glBegin (GL_POLYGON); - for (iter = points.begin(); iter != points.end(); iter++) - glVertex3f ((*iter).x, (*iter).y, 0.0f); - glEnd (); - glPopMatrix (); -} - -class Manager -{ - public: - void addPoint(Point point); - void addPolyLine(Point point); - void removeLastPoint(); - void draw(); - void clear(); - void setStyle(Style style); - Style getStyle(); - private: - std::vector lines; - unsigned int current; - Style style; -}; - -void Manager::setStyle(Style style) -{ - this->style = style; -} - -Style Manager::getStyle() -{ - return style; -} - -void Manager::addPoint(Point point) -{ - if (lines.size() == 0) - { - lines.push_back(PolyLine()); - current = 0; - } - lines[current].addPoint(point); -} - -void Manager::addPolyLine(Point point) -{ - lines.push_back(PolyLine()); - current++; - lines[current].addPoint(point); -} - -void Manager::removeLastPoint() -{ - // TODO: return bool - if (lines.size() > 0) - { - if (lines[current].size() == 0) - if (current == 0) - lines.clear(); - else - { - lines.erase(lines.end()); - current--; - } - else - lines[current].removeLastPoint(); - } -} - -void Manager::draw() -{ - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glDisable (GL_TEXTURE_2D); - glEnable(GL_LINE_SMOOTH); - glLineWidth(3.0f); - glDisable (GL_LIGHTING); - glColor3f (0.2f, 1.0f, 0.2f); - - std::vector::iterator iter; - for (iter = lines.begin(); iter != lines.end(); iter++) - { - (*iter).setStyle(style); - (*iter).draw(); - } -} - -void Manager::clear() -{ - lines.clear(); -} - -void draw_marquee(float x, float y) -{ - const int length = 30; - const int distance = 10; - - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glDisable (GL_TEXTURE_2D); - glEnable(GL_LINE_SMOOTH); - glLineWidth(3.0f); - glDisable (GL_LIGHTING); - glColor3f (1.0f, 0.0f, 0.0f); - - glBegin(GL_LINES); - glVertex3f(x - (length + distance), y, 0.0f); - glVertex3f(x - distance, y, 0.0f); - glEnd(); - - glBegin(GL_LINES); - glVertex3f(x + (length + distance), y, 0.0f); - glVertex3f(x + distance, y, 0.0f); - glEnd(); - - glBegin(GL_LINES); - glVertex3f(x, y - (length + distance), 0.0f); - glVertex3f(x, y - distance, 0.0f); - glEnd(); - - glBegin(GL_LINES); - glVertex3f(x, y + (length + distance), 0.0f); - glVertex3f(x, y + distance, 0.0f); - glEnd(); -} - -class MyCanvas: public wxGLCanvas -{ - void Render(); - public: - MyCanvas(wxFrame* parent); - void evt_paint_cb(wxPaintEvent& event); - protected: - DECLARE_EVENT_TABLE() - private: - void evt_mouse_events_cb (wxMouseEvent& event); - void evt_key_down_cb (wxKeyEvent& event); - void setup_polyline (); - Manager manager; - float mousex; - float mousey; -}; - -BEGIN_EVENT_TABLE(MyCanvas, wxGLCanvas) - EVT_PAINT (MyCanvas::evt_paint_cb) - EVT_KEY_DOWN (MyCanvas::evt_key_down_cb) - EVT_MOUSE_EVENTS(MyCanvas::evt_mouse_events_cb) -END_EVENT_TABLE() - -MyCanvas::MyCanvas(wxFrame *parent) -:wxGLCanvas(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, wxT("GLCanvas")) -{ - int argc = 1; - char* argv[1] = { wxString((wxTheApp->argv)[0]).char_str() }; -} - -void MyCanvas::evt_paint_cb(wxPaintEvent& WXUNUSED(event)) -{ - Render(); -} - -void MyCanvas::evt_mouse_events_cb(wxMouseEvent& event) -{ - //printf("x=%d y=%d LeftIsDown=%d\n", event.GetX(), event.GetY(), (int) event.LeftIsDown()); - bool should_render = false; - Point point = Point(mousex, mousey); - mousex = (float) event.GetX(); - mousey = (float) event.GetY(); - - should_render = true; - if (event.LeftIsDown()) - { - manager.addPoint(point); - should_render = true; - } - else if (event.RightIsDown()) - { - // FIXME - manager.removeLastPoint(); - manager.removeLastPoint(); - should_render = true; - } - else if (event.MiddleIsDown()) - { - manager.addPolyLine(point); - should_render = true; - } - else - { - manager.removeLastPoint(); - manager.addPoint(point); - should_render = true; - } - // if (event.Leaving()) { } - // else if (event.Entering()) { } - - if (should_render) - Render(); - // To catch keyboard events - SetFocus(); -} - -void MyCanvas::evt_key_down_cb(wxKeyEvent & event) -{ - bool should_render = false; - switch (event.GetKeyCode()) - { - case WXK_TAB: - if (manager.getStyle() == POLYGON) - manager.setStyle(LINES); - else - manager.setStyle(POLYGON); - should_render = true; - break; - case WXK_UP: - break; - case WXK_DOWN: - break; - case WXK_LEFT: - break; - case WXK_RIGHT: - break; - default: - break; - } - if (should_render) - Render(); -} - -void MyCanvas::setup_polyline() -{ - manager.clear(); -} - -void MyCanvas::Render() -{ - static bool polyline_is_set = false; - - SetCurrent(); - wxPaintDC(this); - - if (! polyline_is_set) - { - setup_polyline(); - polyline_is_set = true; - } - - glClearColor(0.0, 0.0, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, (GLint) GetSize().x, (GLint) GetSize().y); - - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); - glOrtho ( - 0.0f, (float) GetSize().x, // left, right - (float) GetSize().y, 0.0f, // bottom, top - -1.0, 1.0f); - glMatrixMode (GL_MODELVIEW); - glLoadIdentity (); // FIXME? is this needed here? - - manager.draw(); - draw_marquee(mousex, mousey); - - glFlush(); - SwapBuffers(); -} - -class MyApp: public wxApp -{ - private: - virtual bool OnInit(); - MyCanvas * MyGLCanvas; -}; - -IMPLEMENT_APP(MyApp) - -bool MyApp::OnInit() -{ - wxFrame *frame = new wxFrame((wxFrame *) NULL, -1, wxT("LibreMapping - PolyLine Prototype"), wxPoint(50, 50), wxSize(640, 480)); - //frame->SetWindowStyle(wxWANTS_CHARS); - MyGLCanvas = new MyCanvas(frame); - - frame->Show(TRUE); - return TRUE; -}