Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » OpenGL test (Error when compiled)
OpenGL test [message #45453] Mon, 16 November 2015 14:22 Go to next message
lovmy is currently offline  lovmy
Messages: 34
Registered: November 2015
Member

Hi,

sorry i don't speak very well English. I try to execute this:

#include "Fractale.h"
#include <CtrlLib/CtrlLib.h>
#include <GLCtrl/GLCtrl.h>

using namespace Upp;

struct OpenGLExample : GLCtrl
{
Point point;
virtual void GLPaint()
{
StdView();
double t = 13 * point.x;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLoadIdentity();
glPushMatrix();
glTranslatef(0, 0, -6);
glRotated(t / 30.0, 0, 1, 0);
glRotated(t / 40.0, 1, 0, 0);
glRotated(t / 5.0, 0, 0, 1);
glBegin(GL_TRIANGLE_FAN);
glColor4d(0.8, 0.4, 0.2, 1);
glVertex3f(0.0f, 0.0f, 0.0f);
for(int i = 0; i < 50; i++) {
double u = M_2PI * i / 49;
glColor4d(i / 50.0, 0.5 + i / 100.0, 0.7 - i / 150.0, 1);
glVertex3d(sin(u), cos(u), 1.0f);
}
glEnd();
glBegin(GL_TRIANGLE_FAN);
glColor4d(0.8, 0.4, 0.2, 1);
glVertex3f(0.0f, 0.0f, 3.0f);
for(int i = 0; i < 50; i++) {
double u = M_2PI * i / 49;
glColor4d(0.7, 0.5 - i / 100.0, 0.7 + i / 150.0, 1);
glVertex3d(sin(u), cos(u), 1.0f);
}
glEnd();
glPopMatrix();
t = 13 * point.y;
float sn = (float)sin(t / 300);
float cs = (float)cos(t / 300);
glTranslatef(sn + cs, sn, -6 - cs);
glRotated(t / 12.0, 0, 0, 1);
glRotated(t / 15.0, 0, 1, 0);
glRotated(t / 17.0, 1, 0, 0);
glBegin(GL_TRIANGLE_STRIP);
glVertex3f(0.0f, 0.0f, 0.0f);
glColor4d(1, 0, 0, 0.5);
glVertex3d(-1, 0, 0);
glVertex3d(1, 0, 0);
glVertex3d(0, 0.87, 0);
glColor4d(0, 1, 0, 0.5);
glVertex3d(0, 0, 1.67);
glEnd();
}

virtual void GLResize(int w, int h)
{
glViewport(0, 0, (GLsizei)w, (GLsizei)h);
}

virtual void MouseMove(Point p, dword)
{
point = p;
Refresh();
}
};

Fractale::Fractale()
{
CtrlLayout(*this, "Visualisateur de fractales");
bouton <<= THISBACK(Toto);
}

void Fractale::Toto()
{
texte <<= "Test";
}

GUI_APP_MAIN
{
Ctrl::GlobalBackPaint();

TopWindow Fractale;

OpenGLExample gl;
/* gl.SetFrame(InsetFrame());
Fractale.Add(gl.HSizePos(10, 10).VSizePos(10, 10)); */

Fractale.Sizeable().Zoomable();
Fractale.Open();
Fractale.Run();

// Fractale().Run();
}

No error in compiled, but linking error:

Undefined reference to Upp::GLCtrl::StdView()
Undefined reference to glClear
Undefined reference to glEnable
...

I'm under Ubuntu Linux 3.13.0-69-generic x86_64

Can you help me ? I'm newbie with Ultimate ++ and Theide.

Best Regards !
Re: OpenGL test [message #45455 is a reply to message #45453] Mon, 16 November 2015 17:22 Go to previous messageGo to next message
lovmy is currently offline  lovmy
Messages: 34
Registered: November 2015
Member

OK, i have add include directory in Setup->Build methods, it's work fine now.

But i want to add OpenGL into User class widget, can you help me ?

Best Regards !
Re: OpenGL test [message #45488 is a reply to message #45453] Mon, 23 November 2015 11:58 Go to previous message
lovmy is currently offline  lovmy
Messages: 34
Registered: November 2015
Member

OK it's work if i don't use designer.
Previous Topic: Raspberry Pi 2: readme file
Next Topic: Heap errors behavior is dependent on target machine.
Goto Forum:
  


Current Time: Tue Sep 17 04:16:30 CEST 2019

Total time taken to generate the page: 0.01478 seconds