Hi all,
I have to start working on a code that contains some fragments of OpenGL and which compiles without problems on Windows.
The problem is that I need to compile this code on Linux. The last time I used OpenGL was more than 10 years ago, so I'm not sure what changes I have to do in order to have it running on this system.
The following is the relevant part of the code
OGLDisplayWidget.h
Code :#ifndef __OGLDisplayWidget_H #define __OGLDisplayWidget_H #define GL_GLEXT_PROTOTYPES #include <QtGui/QtGui> #include <QtGui/QMainWindow> #if defined(WIN32) || defined(WIN64) #include <QGLWidget> #else //linux #include <QtOpenGL/QGLWidget> #include </home/Qt/4.8.1/gcc/include/QtOpenGL/QGLPixelBuffer> #endif class nc_demonstrator; class ImageAcquisition; #define BUFFER_OFFSET(bytes) ((GLubyte*) NULL + (bytes)) class OGLDisplayWidget : public QGLWidget, protected Ui_ImageDisplay { Q_OBJECT public: OGLDisplayWidget(QWidget *parent = NULL, QWidget *demo = NULL); ~OGLDisplayWidget(); //Revoir son utilite car plusieurs parametres semblent deja passe nc_demonstrator *NcDemonstrator; ImageAcquisition *test; NcImage* CreateStaticImage(NcImage *MyVunuImage, int width, int height); void FreeStaticImage(NcImage* MyVunuImage); void ClearImage() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } DeviceImage ImageToDisplay; float ZoomXScale, ZoomYScale, ZoomXRefPoint, ZoomYRefPoint; int GotImage; QReadWriteLock DisplayLock; QColor colorTable[256]; unsigned int *lut; unsigned int *ColoredImage; int ColorEnable; int ColorStatusChanged; void ColorPalette(); void ImageOnDisplay(DeviceImage ImageObject) {DisplayLock.lockForWrite(); ImageToDisplay = ImageObject; DisplayLock.unlock();} void UpdateHisto(); protected: void initializeGL(); void paintGL(); void leaveEvent(QEvent *event){ emit LeaveWidget(); } void mouseMoveEvent(QMouseEvent *mouseEvent); private: int elapsed; QGLPixelBuffer *AltOnBoardBuffer; unsigned short *VunuMap; unsigned int *VunuMapColor; QImage *ImageReceived; GLuint textureId; GLuint pboId; }; #endif
OGLDisplayWidget.cpp
Code :#include "OGLDisplayWidget.h" #include<ctime> #include<time.h> #ifdef WIN32 #include <GL/gl.h> #include "glext.h" PFNGLGENBUFFERSPROC VunuglGenBuffers; PFNGLBINDBUFFERPROC VunuglBindBuffer; PFNGLDELETEBUFFERSPROC VunuglDeleteBuffers; PFNGLBUFFERDATAPROC VunuglBufferData; #endif void OGLDisplayWidget::initializeGL() { #ifdef WIN32 // get the pointer to the GL functions VunuglGenBuffers = (PFNGLGENBUFFERSPROC)wglGetProcAddress("glGenBuffersARB"); VunuglBindBuffer = (PFNGLBINDBUFFERPROC) wglGetProcAddress("glBindBuffer"); VunuglDeleteBuffers = (PFNGLDELETEBUFFERSPROC) wglGetProcAddress("glDeleteBuffers"); VunuglBufferData = (PFNGLBUFFERDATAPROC) wglGetProcAddress("glBufferData"); #endif QGLFormat glFmt; glFmt.setSwapInterval(1); // 1= vsync on QGLFormat::setDefaultFormat(glFmt); [B] VunuglGenBuffers(1, &pboId);[/B] glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } void OGLDisplayWidget::animate() { DisplayLock.lockForRead(); [B] VunuglBindBuffer( GL_PIXEL_UNPACK_BUFFER, pboId);[/B] [B] VunuglBufferData(GL_PIXEL_UNPACK_BUFFER, 2*NcDemonstrator->imageWidth*NcDemonstrator->imageHeight, (unsigned short*)ImageToDisplay.constData(), GL_STREAM_DRAW);[/B] DisplayLock.unlock(); if (GotImage == 1) updateGL(); }
When I compile the error messages I get are:
On void OGLDisplayWidget::initializeGL() (first black line)
#error: 'VunuglGenBuffers' was not declared in this scope#
On void OGLDisplayWidget::animate() (second and third black line)
#error: 'VunuglGenBuffers' was not declared in this scope#
Any suggestion on how to solve this issue will be much appreciated.
cheers
Juanito



