summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2013-01-13 14:58:25 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2013-01-13 14:58:25 +0000
commita662129a86855e082d8515d318c6a19ef54b4e13 (patch)
tree062b4e9e2656d58e150bf15e29ac9b93b098cd3a
parent34d2404010821f92296b15eb9dca6f8fd1bcafdf (diff)
download2013-gpudataviz-a662129a86855e082d8515d318c6a19ef54b4e13.tar.gz
2013-gpudataviz-a662129a86855e082d8515d318c6a19ef54b4e13.tar.bz2
2013-gpudataviz-a662129a86855e082d8515d318c6a19ef54b4e13.zip
Debut d'integration OpenCL / GL mais il manque une lib a linker... quelque part dans /opt/AMDAPP ???
git-svn-id: file:///var/svn/2013-gpudataviz/trunk@6 371a6b4a-a258-45f8-9dcc-bdd82ce0ac9d
-rw-r--r--src/boring_parts.cc22
-rw-r--r--src/boring_parts.h11
-rwxr-xr-xsrc/compil.sh8
-rw-r--r--src/gpudataviz.cc2
4 files changed, 36 insertions, 7 deletions
diff --git a/src/boring_parts.cc b/src/boring_parts.cc
index 3973c23..54c6863 100644
--- a/src/boring_parts.cc
+++ b/src/boring_parts.cc
@@ -1,5 +1,10 @@
#include "boring_parts.h"
+
+
+// TODO : only need OpenGL things, not GTK ones for now
+//#include "gtk_includes.h"
+
#define RETURN_IF_FAIL(expr) do { \
int res=(expr); \
if ( res != 0 ) return res; \
@@ -17,7 +22,6 @@
int initLibs() {
- // FIXME : unused
#ifdef HAS_OPENCL
RETURN_IF_FAIL( initOpenCL() );
#endif /*HAS_OPENCL*/
@@ -99,6 +103,22 @@ int initOpenCL() {
delete [] devices;
delete [] platforms;
+/*
+ if (!clGetGLContextInfoKHR)
+ {
+ clGetGLContextInfoKHR = (clGetGLContextInfoKHR_fn) clGetExtensionFunctionAddressForPlatform(platform, "clGetGLContextInfoKHR");
+ if (!clGetGLContextInfoKHR)
+ {
+ std::cout << "Failed to query proc address for clGetGLContextInfoKHR";
+ }
+ }
+*/
+ GLXContext gGlCtx = glXGetCurrentContext();
+ std::cout << "gGlCtx == " << gGlCtx << std::endl;
+ cl_context_properties cpsGL[] = { CL_CONTEXT_PLATFORM, (cl_context_properties)platform,
+ CL_GLX_DISPLAY_KHR, (intptr_t) glXGetCurrentDisplay(),
+ CL_GL_CONTEXT_KHR, (intptr_t) gGlCtx, 0
+ };
return 0;
}
#endif /*HAS_OPENCL*/
diff --git a/src/boring_parts.h b/src/boring_parts.h
index 4060f67..54fd7b3 100644
--- a/src/boring_parts.h
+++ b/src/boring_parts.h
@@ -1,6 +1,13 @@
#include <iostream>
-// TODO : only need OpenGL things, not GTK ones for now
-#include "gtk_includes.h"
+
+#include <gtkmm.h> /* Must included before X11/Xlib.h */
+//#include <GL/glew.h> /* Seems included by GL/glxew.h */
+#include <GL/glxew.h> /* For GLXContext, must appear before gl.h, includes X11/Xlib.h */
+#include <gtkglmm.h> /* Includes a GL/gl.h (the right one ??) */
+
+//#include <GL/gl.h>
+//#include <GL/glu.h>
+//#include <CL/cl_gl.h>
int initLibs();
diff --git a/src/compil.sh b/src/compil.sh
index bc21245..10cd630 100755
--- a/src/compil.sh
+++ b/src/compil.sh
@@ -10,11 +10,11 @@ AMDAPP_PATH="/opt/AMDAPP"
DEFINES=""
INCLUDES=""
-LIBS=""
+LIBS="-lglew"
# OpenCL
if [ -d "$AMDAPP_PATH/include" ]
-then DEFINES="-DHAS_OPENCL"
+then DEFINES="$DEFINES -DHAS_OPENCL"
INCLUDES="$INCLUDES -I $AMDAPP_PATH/include"
LIBS="$LIBS -lOpenCL"
else echo "WARNING : invalid AMDAPP_PATH : '$AMDAPP_PATH'"
@@ -32,8 +32,8 @@ fi
#set +x
function build_cxx() {
- echo "$PS4$CXX \$INCLUDES -o $BUILD_PATH/$1 -c $2"
- $CXX $INCLUDES -o $BUILD_PATH/$1 -c $2
+ echo "$PS4$CXX \$DEFINES \$INCLUDES -o $BUILD_PATH/$1 -c $2"
+ $CXX $DEFINES $INCLUDES -o $BUILD_PATH/$1 -c $2
}
function link_cxx() {
diff --git a/src/gpudataviz.cc b/src/gpudataviz.cc
index 954ef5e..e6e4ca5 100644
--- a/src/gpudataviz.cc
+++ b/src/gpudataviz.cc
@@ -2,6 +2,8 @@
#include "gpudataviz.h"
#include "boring_parts.h"
+
+//#include "gtk_includes.h"
#include "gtk_win_main.h"
#include "my_gtk_gl_scene_widget.h"