Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Alfox

Member Since 17 Mar 2014
Offline Last Active Oct 25 2014 07:17 AM

Topics I've Started

How to check where a point hit a triangle

22 October 2014 - 08:44 AM

Hi guys,

I have this problem:

I have a point as vector3 (x,y,z) in 3d space, and its direction (vector3 x,y,z).

In the scene there are also many triangles eachone with 3 vertex (each vertex as a vector3)

 

this point moves along its direction, how can I know:

1. what triagle is hitted (I have many of them)

2. where exactly is hitted, as x,y,z coordinates

 

I'm using c++ for my project.

 

Thanks


GLFW errors during c++ program compialtion on ubuntu

21 September 2014 - 08:13 AM

Hello!

I receive a lot of errors when I try to compile my c++ program. I am  on a Ubuntu 12.04 machine, this machine is a server that I control.

In order I had:

downloaded the source code of GLFW from official site, then followed the instruction

cd <glfw-root-dir>
mkdir build
cd build
cmake ..

after this in the "build" folder I launched the command

make

in the folder build/src I found the libglfw3.a and in the glfw folder root the /include folder.

I copied all the glfw folder into my project src/ folder,  and also copied libglfw3.a in src/lib folder. In this folder I had also libGLEW.a used to my project too.

 

I created this Makefile for my project:

#variables
MYINC=-I/isis/AlfonsoOricchio/RayTracing/src/glfw/include -I/isis/AlfonsoOricchio/RayTracing/src/glew/include -I/isis/AlfonsoOricchio/RayTracing/src
MYCUDAINC=-I/usr/local/cuda-5.5/include/
MYLIB=-L/isis/AlfonsoOricchio/RayTracing/src/lib -L/usr/local/cuda-5.5/lib64/ 
MYCMD=-lcudart -lglfw3 -lGLEW -lGL
NVCC=/usr/local/cuda-5.5/bin/nvcc

all: myexe

myexe: render.o controls.o objloader.o shader.o Ray.o 
	g++ render.o controls.o objloader.o shader.o Ray.o $(MYLIB) $(MYCMD) -o RayTracing


Ray.o: Ray.cpp
	g++ -c $(MYINC) $(MYCUDAINC) Ray.cpp
	
controls.o: controls.cpp
	g++ -c $(MYINC) controls.cpp
	
objloader.o: objloader.cpp
	g++ -c $(MYINC) objloader.cpp

shader.o: shader.cpp
	g++ -c $(MYINC) shader.cpp

render.o:
	$(NVCC) -c -arch=sm_20 render.cu 


clean: 
	rm -rf *o RayTracing

But when I run the make, the "myexe" call give me this errors:

g++ render.o controls.o objloader.o shader.o Ray.o -L/isis/AlfonsoOricchio/RayTracing/src/lib -L/usr/local/cuda-5.5/lib64/ -lcudart -lglfw3 -lGLEW -lGL -o RayTracing

/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwInitGammaRamp: error: undefined reference to 'XRRGetScreenResources'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwInitGammaRamp: error: undefined reference to 'XRRGetCrtcGammaSize'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwInitGammaRamp: error: undefined reference to 'XRRFreeScreenResources'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwPlatformGetGammaRamp: error: undefined reference to 'XRRGetCrtcGammaSize'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwPlatformGetGammaRamp: error: undefined reference to 'XRRGetCrtcGamma'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwPlatformGetGammaRamp: error: undefined reference to 'XRRFreeGamma'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwPlatformGetGammaRamp: error: undefined reference to 'XF86VidModeGetGammaRampSize'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwPlatformGetGammaRamp: error: undefined reference to 'XF86VidModeGetGammaRamp'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwPlatformSetGammaRamp: error: undefined reference to 'XRRAllocGamma'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwPlatformSetGammaRamp: error: undefined reference to 'XRRSetCrtcGamma'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwPlatformSetGammaRamp: error: undefined reference to 'XRRFreeGamma'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_gamma.c.o):x11_gamma.c:function _glfwPlatformSetGammaRamp: error: undefined reference to 'XF86VidModeSetGammaRamp'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function translateKey: error: undefined reference to 'XkbKeycodeToKeysym'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function translateKey: error: undefined reference to 'XkbKeycodeToKeysym'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function updateKeyCodeLUT: error: undefined reference to 'XkbGetKeyboard'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function updateKeyCodeLUT: error: undefined reference to 'XkbFreeKeyboard'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function getSupportedAtom: error: undefined reference to 'XInternAtom'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function detectEWMH: error: undefined reference to 'XInternAtom'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function detectEWMH: error: undefined reference to 'XInternAtom'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function detectEWMH: error: undefined reference to 'XFree'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function detectEWMH: error: undefined reference to 'XFree'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function detectEWMH: error: undefined reference to 'XFree'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function detectEWMH: error: undefined reference to 'XFree'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function initExtensions: error: undefined reference to 'XInternAtom'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function initExtensions: error: undefined reference to 'XF86VidModeQueryExtension'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function initExtensions: error: undefined reference to 'XRRQueryExtension'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function initExtensions: error: undefined reference to 'XRRQueryVersion'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function initExtensions: error: undefined reference to 'XQueryExtension'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function initExtensions: error: undefined reference to 'XIQueryVersion'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function initExtensions: error: undefined reference to 'XkbQueryExtension'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function initExtensions: error: undefined reference to 'XkbSetDetectableAutoRepeat'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function createNULLCursor: error: undefined reference to 'XCreatePixmap'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function createNULLCursor: error: undefined reference to 'XCreateGC'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function createNULLCursor: error: undefined reference to 'XFillRectangle'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function createNULLCursor: error: undefined reference to 'XCreatePixmapCursor'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function createNULLCursor: error: undefined reference to 'XFreePixmap'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function createNULLCursor: error: undefined reference to 'XFreeGC'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function terminateDisplay: error: undefined reference to 'XCloseDisplay'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function _glfwGrabXErrorHandler: error: undefined reference to 'XSetErrorHandler'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function _glfwReleaseXErrorHandler: error: undefined reference to 'XSync'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function _glfwReleaseXErrorHandler: error: undefined reference to 'XSetErrorHandler'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function _glfwInputXError: error: undefined reference to 'XGetErrorText'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function _glfwPlatformInit: error: undefined reference to 'XInitThreads'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function _glfwPlatformInit: error: undefined reference to 'XOpenDisplay'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function _glfwPlatformInit: error: undefined reference to 'XrmUniqueQuark'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_init.c.o):x11_init.c:function _glfwPlatformTerminate: error: undefined reference to 'XFreeCursor'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwSetVideoMode: error: undefined reference to 'XRRGetScreenResources'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwSetVideoMode: error: undefined reference to 'XRRGetCrtcInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwSetVideoMode: error: undefined reference to 'XRRGetOutputInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwSetVideoMode: error: undefined reference to 'XRRSetCrtcConfig'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwSetVideoMode: error: undefined reference to 'XRRFreeOutputInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwSetVideoMode: error: undefined reference to 'XRRFreeCrtcInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwSetVideoMode: error: undefined reference to 'XRRFreeScreenResources'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwRestoreVideoMode: error: undefined reference to 'XRRGetScreenResources'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwRestoreVideoMode: error: undefined reference to 'XRRGetCrtcInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwRestoreVideoMode: error: undefined reference to 'XRRSetCrtcConfig'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwRestoreVideoMode: error: undefined reference to 'XRRFreeCrtcInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwRestoreVideoMode: error: undefined reference to 'XRRFreeScreenResources'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetMonitors: error: undefined reference to 'XRRGetScreenResources'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetMonitors: error: undefined reference to 'XRRGetOutputPrimary'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetMonitors: error: undefined reference to 'XRRGetCrtcInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetMonitors: error: undefined reference to 'XRRFreeCrtcInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetMonitors: error: undefined reference to 'XRRGetOutputInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetMonitors: error: undefined reference to 'XRRFreeOutputInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetMonitors: error: undefined reference to 'XRRFreeCrtcInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetMonitors: error: undefined reference to 'XRRFreeOutputInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetMonitors: error: undefined reference to 'XRRFreeScreenResources'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetMonitorPos: error: undefined reference to 'XRRGetCrtcInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetVideoModes: error: undefined reference to 'XRRGetOutputInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_monitor.c.o):x11_monitor.c:function _glfwPlatformGetVideoModes: error: undefined reference to 'XRRFreeOutputInfo'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_time.c.o):x11_time.c:function getRawTime: error: undefined reference to 'clock_gettime'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_time.c.o):x11_time.c:function _glfwInitTimer: error: undefined reference to 'clock_gettime'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function translateChar: error: undefined reference to 'XLookupString'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XCreateColormap'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XCreateWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XChangeProperty'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XSaveContext'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XChangeWindowAttributes'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XSetWMProtocols'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XChangeProperty'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XAllocWMHints'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XSetWMHints'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XAllocSizeHints'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XSetWMNormalHints'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XAllocClassHint'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XSetClassHint'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XISelectEvents'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function createWindow: error: undefined reference to 'XRRSelectInput'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function hideCursor: error: undefined reference to 'XUngrabPointer'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function hideCursor: error: undefined reference to 'XDefineCursor'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function captureCursor: error: undefined reference to 'XGrabPointer'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function showCursor: error: undefined reference to 'XUngrabPointer'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function showCursor: error: undefined reference to 'XUndefineCursor'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function enterFullscreenMode: error: undefined reference to 'XGetScreenSaver'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function enterFullscreenMode: error: undefined reference to 'XSetScreenSaver'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function enterFullscreenMode: error: undefined reference to 'XChangeProperty'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function enterFullscreenMode: error: undefined reference to 'XSendEvent'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function enterFullscreenMode: error: undefined reference to 'XSendEvent'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function enterFullscreenMode: error: undefined reference to 'XRaiseWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function enterFullscreenMode: error: undefined reference to 'XSetInputFocus'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function enterFullscreenMode: error: undefined reference to 'XMoveWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function enterFullscreenMode: error: undefined reference to 'XResizeWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function leaveFullscreenMode: error: undefined reference to 'XSetScreenSaver'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function leaveFullscreenMode: error: undefined reference to 'XChangeProperty'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function leaveFullscreenMode: error: undefined reference to 'XSendEvent'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function processEvent: error: undefined reference to 'XSendEvent'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function processEvent: error: undefined reference to 'XGetEventData'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function processEvent: error: undefined reference to 'XFreeEventData'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function processEvent: error: undefined reference to 'XRRUpdateConfiguration'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwFindWindowByHandle: error: undefined reference to 'XFindContext'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwGetWindowProperty: error: undefined reference to 'XGetWindowProperty'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformDestroyWindow: error: undefined reference to 'XGetSelectionOwner'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformDestroyWindow: error: undefined reference to 'XDeleteContext'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformDestroyWindow: error: undefined reference to 'XUnmapWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformDestroyWindow: error: undefined reference to 'XDestroyWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformDestroyWindow: error: undefined reference to 'XFreeColormap'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformSetWindowTitle: error: undefined reference to 'Xutf8SetWMProperties'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformGetWindowPos: error: undefined reference to 'XTranslateCoordinates'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformGetWindowPos: error: undefined reference to 'XTranslateCoordinates'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformSetWindowPos: error: undefined reference to 'XMoveWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformSetWindowPos: error: undefined reference to 'XFlush'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformGetWindowSize: error: undefined reference to 'XGetWindowAttributes'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformSetWindowSize: error: undefined reference to 'XResizeWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformSetWindowSize: error: undefined reference to 'XAllocSizeHints'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformSetWindowSize: error: undefined reference to 'XSetWMNormalHints'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformSetWindowSize: error: undefined reference to 'XResizeWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformSetWindowSize: error: undefined reference to 'XFlush'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformIconifyWindow: error: undefined reference to 'XIconifyWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformRestoreWindow: error: undefined reference to 'XMapWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformShowWindow: error: undefined reference to 'XMapRaised'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformShowWindow: error: undefined reference to 'XFlush'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformHideWindow: error: undefined reference to 'XUnmapWindow'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformHideWindow: error: undefined reference to 'XFlush'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformPollEvents: error: undefined reference to 'XPending'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformPollEvents: error: undefined reference to 'XNextEvent'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformWaitEvents: error: undefined reference to 'XPending'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_window.c.o):x11_window.c:function _glfwPlatformSetCursorPos: error: undefined reference to 'XWarpPointer'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(glx_context.c.o):glx_context.c:function _glfwInitContextAPI: error: undefined reference to 'pthread_key_create'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(glx_context.c.o):glx_context.c:function _glfwTerminateContextAPI: error: undefined reference to 'pthread_key_delete'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(glx_context.c.o):glx_context.c:function _glfwPlatformMakeContextCurrent: error: undefined reference to 'pthread_setspecific'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(glx_context.c.o):glx_context.c:function _glfwPlatformGetCurrentContext: error: undefined reference to 'pthread_getspecific'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_clipboard.c.o):x11_clipboard.c:function _glfwPushSelectionToManager: error: undefined reference to 'XConvertSelection'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_clipboard.c.o):x11_clipboard.c:function _glfwPushSelectionToManager: error: undefined reference to 'XCheckIfEvent'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_clipboard.c.o):x11_clipboard.c:function _glfwPlatformSetClipboardString: error: undefined reference to 'XSetSelectionOwner'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_clipboard.c.o):x11_clipboard.c:function _glfwPlatformSetClipboardString: error: undefined reference to 'XGetSelectionOwner'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_clipboard.c.o):x11_clipboard.c:function _glfwPlatformGetClipboardString: error: undefined reference to 'XGetSelectionOwner'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_clipboard.c.o):x11_clipboard.c:function _glfwPlatformGetClipboardString: error: undefined reference to 'XConvertSelection'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_clipboard.c.o):x11_clipboard.c:function _glfwPlatformGetClipboardString: error: undefined reference to 'XCheckTypedEvent'
/isis/AlfonsoOricchio/RayTracing/src/lib/libglfw3.a(x11_clipboard.c.o):x11_clipboard.c:function _glfwPlatformGetClipboardString: error: undefined reference to 'XDeleteProperty'
collect2: ld returned 1 exit status

What Can I do?


screen view to 3d space

09 September 2014 - 08:37 AM

Hello,

this is my problem.

I have a camera with an origin point (Vector3 with x, y, z) and its vector3 direction , and a screen width and height.

I want to transform each pixel of the screen view in a vector3 in 3d space.

I found this code on internet, and adapted to my project:

glm::vec3 cd = CamGetDirection();
glm::vec3 cp = CamGetPosition();
glm::vec4 viewport = glm::vec4(0.0f, 0.0f, WINDOW_WIDTH, WINDOW_HEIGHT);
glm::mat4 tmpView = getViewMatrix();
glm::mat4 tmpProj = getProjectionMatrix();
glm::vec3 screenPosS = glm::vec3(0.0,0.0,0.0);
glm::vec3 screenPosE = glm::vec3((float)WINDOW_WIDTH, (float)WINDOW_HEIGHT,0.0);
glm::vec3 wpS = glm::unProject(screenPosS, tmpView, tmpProj, viewport);
glm::vec3 wpE = glm::unProject(screenPosE, tmpView, tmpProj, viewport);

CamGetDirection() give me the vec3 direction of the camera

CamGetPosition() of course give me the vec3 position of the camera

getViewMatrix() give me the view matrix and this is the code:

ViewMatrix = glm::lookAt(
			position,           // Camera is here
			position+direction, // and looks here : at the same position, plus "direction"
			up                  // Head is up (set to 0,-1,0 to look upside-down)
			);

getProjectionMatrix() is this:

ProjectionMatrix = glm::perspective(FoV /* FoV is 45.0f degree */, 4.0f / 3.0f, 0.1f, 100.0f);

glm::vec3 screenPosS and glm::vec3 screenPosE are two vec3 of the first pixel and last pixel of the screen view

 

WINDOW_WIDTH and WINDOW_HEIGHT are my screen project setting in this case 1024 and 768

 

It seems working but I'm not sure on the numbers, I printed this:

printf_s("CDir: %f %f %f\n",cd.x,cd.y,cd.z);
printf_s("CPos: %f %f %f\n",cp.x,cp.y,cp.z);
printf_s("WPStart: %f %f %f\n",wpS.x,wpS.y,wpS.z);
printf_s("WPEnd: %f %f %f\n",wpE.x,wpE.y,wpE.z);

and the output is:

Attached File  out.jpg   13.24KB   0 downloads

 

Can you confirm if this code works?

 

Thanks


How to import GLFW in eclipse C++ IDE

11 August 2014 - 09:54 AM

Hi guys

I have a problem to correctly linking GLFW under eclipse Luna C/C++ IDE

I already read this post:

http://www.gamedev.net/topic/647428-glfw3-linker-errors/

I tried his solution

If you are trying to link the static version of the library, libglfw3.a, you have to link gdi32 in this order.

  1. libglfw3.a
  2. gdi32
  3. opengl32

If you are linking in the dynamic link version of the library, glfw3dll.a, you shouldn't need to link gdi32.

 

 

but I received this error:

cannot find -llibglfw3.a              C/C++ Problem

So I changed libglfw3.a with the entire path. But I still receive the same error:

cannot find -lC:\Users\Alfonso-PC\workspace\ProvaGLFW\libglfw3.a    C/C++ Problem

Of corse I also include the .h folder under "Includes"

/ProvaGLFW/glfw/include

And the lib-mingw folder under "Library paths"

/ProvaGLFW/glfw/lib-mingw

How Can I solve this issue?

 


 


SOLVED: Render a vector to screen in opengl

25 June 2014 - 09:18 AM

Hello,

I have this simple code (just a green cube in scene):

// Include standard headers
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <windows.h>
// Include GLEW
#include <glew.h>
 
// Include GLFW
#include <glfw3.h>
GLFWwindow* window;
 
// Include GLM
#include <glm.hpp>
#include <gtc/matrix_transform.hpp>
using namespace glm;
 
#include "shader.hpp"
 
int main( void )
{
	// Initialise GLFW
	if( !glfwInit() )
	{
		fprintf( stderr, "Failed to initialize GLFW\n" );
		return -1;
	}
 
	glfwWindowHint(GLFW_SAMPLES, 4);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
 
	// Open a window and create its OpenGL context
	window = glfwCreateWindow( 1024, 768, "Cube", NULL, NULL);
	if( window == NULL ){
		fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n" );
		glfwTerminate();
		return -1;
	}
	glfwMakeContextCurrent(window);
 
	// Initialize GLEW
	glewExperimental = true; // Needed for core profile
	if (glewInit() != GLEW_OK) {
		fprintf(stderr, "Failed to initialize GLEW\n");
		return -1;
	}
 
	// Ensure we can capture the escape key being pressed below
	glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);
 
	// Dark blue background
	glClearColor(0.0f, 0.0f, 0.4f, 0.0f);
 
	// Enable depth test
	glEnable(GL_DEPTH_TEST);
	// Accept fragment if it closer to the camera than the former one
	glDepthFunc(GL_LESS); 
 
	GLuint VertexArrayID;
	glGenVertexArrays(1, &VertexArrayID);
	glBindVertexArray(VertexArrayID);
 
	// Create and compile our GLSL program from the shaders
	GLuint programID = LoadShaders( "TransformVertexShader.vertexshader", "ColorFragmentShader.fragmentshader" );
 
	// Get a handle for our "MVP" uniform
	GLuint MatrixID = glGetUniformLocation(programID, "MVP");
 
	// Projection matrix : 45° Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units
	glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f);
	// Camera matrix
	glm::mat4 View       = glm::lookAt(
								glm::vec3(4,3,-3), // Camera is at (4,3,-3), in World Space
								glm::vec3(0,0,0), // and looks at the origin
								glm::vec3(0,1,0)  // Head is up (set to 0,-1,0 to look upside-down)
						   );
	// Model matrix : an identity matrix (model will be at the origin)
	glm::mat4 Model      = glm::mat4(1.0f);
	// Our ModelViewProjection : multiplication of our 3 matrices
	glm::mat4 MVP        = Projection * View * Model; // Remember, matrix multiplication is the other way around
 
	// Our vertices. Tree consecutive floats give a 3D vertex; Three consecutive vertices give a triangle.
	// A cube has 6 faces with 2 triangles each, so this makes 6*2=12 triangles, and 12*3 vertices
	static const GLfloat g_vertex_buffer_data[] = { 
		-1.0f,-1.0f,-1.0f,
		-1.0f,-1.0f, 1.0f,
		-1.0f, 1.0f, 1.0f,
		 1.0f, 1.0f,-1.0f,
		-1.0f,-1.0f,-1.0f,
		-1.0f, 1.0f,-1.0f,
		 1.0f,-1.0f, 1.0f,
		-1.0f,-1.0f,-1.0f,
		 1.0f,-1.0f,-1.0f,
		 1.0f, 1.0f,-1.0f,
		 1.0f,-1.0f,-1.0f,
		-1.0f,-1.0f,-1.0f,
		-1.0f,-1.0f,-1.0f,
		-1.0f, 1.0f, 1.0f,
		-1.0f, 1.0f,-1.0f,
		 1.0f,-1.0f, 1.0f,
		-1.0f,-1.0f, 1.0f,
		-1.0f,-1.0f,-1.0f,
		-1.0f, 1.0f, 1.0f,
		-1.0f,-1.0f, 1.0f,
		 1.0f,-1.0f, 1.0f,
		 1.0f, 1.0f, 1.0f,
		 1.0f,-1.0f,-1.0f,
		 1.0f, 1.0f,-1.0f,
		 1.0f,-1.0f,-1.0f,
		 1.0f, 1.0f, 1.0f,
		 1.0f,-1.0f, 1.0f,
		 1.0f, 1.0f, 1.0f,
		 1.0f, 1.0f,-1.0f,
		-1.0f, 1.0f,-1.0f,
		 1.0f, 1.0f, 1.0f,
		-1.0f, 1.0f,-1.0f,
		-1.0f, 1.0f, 1.0f,
		 1.0f, 1.0f, 1.0f,
		-1.0f, 1.0f, 1.0f,
		 1.0f,-1.0f, 1.0f
	};
 
	// One color for each vertex. They were generated randomly.
	static const GLfloat g_color_buffer_data[] = { 
		0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f,
				0.583f,  0.771f,  0.014f
	};
 
	GLuint vertexbuffer;
	glGenBuffers(1, &vertexbuffer);
	glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
	glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);
 
	GLuint colorbuffer;
	glGenBuffers(1, &colorbuffer);
	glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
	glBufferData(GL_ARRAY_BUFFER, sizeof(g_color_buffer_data), g_color_buffer_data, GL_STATIC_DRAW);
 
	do{
              std::vector<GLfloat> pixel(1024*768*3);
              glReadPixels(0, 0, 1024, 768, GL_RGB, GL_FLOAT, &pixel[0]);
              std::cout << "R G B: " << pixel[0]<< " "<<pixel[1]<< " "<<pixel[2] << "\n"; //not really needed
       
		// Clear the screen
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
		// Use our shader
		glUseProgram(programID);
 
		// Send our transformation to the currently bound shader, 
		// in the "MVP" uniform
		glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]);
 
		// 1rst attribute buffer : vertices
		glEnableVertexAttribArray(0);
		glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
		glVertexAttribPointer(
			0,                  // attribute. No particular reason for 0, but must match the layout in the shader.
			3,                  // size
			GL_FLOAT,           // type
			GL_FALSE,           // normalized?
			0,                  // stride
			(void*)0            // array buffer offset
		);
 
		// 2nd attribute buffer : colors
		glEnableVertexAttribArray(1);
		glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
		glVertexAttribPointer(
			1,                                // attribute. No particular reason for 1, but must match the layout in the shader.
			3,                                // size
			GL_FLOAT,                         // type
			GL_FALSE,                         // normalized?
			0,                                // stride
			(void*)0                          // array buffer offset
		);
 
		// Draw the triangle !
		glDrawArrays(GL_TRIANGLES, 0, 12*3); // 12*3 indices starting at 0 -> 12 triangles
 
		glDisableVertexAttribArray(0);
		glDisableVertexAttribArray(1);
 
		// Swap buffers
		glfwSwapBuffers(window);
		glfwPollEvents();
 
	} // Check if the ESC key was pressed or the window was closed
	while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS &&
		   glfwWindowShouldClose(window) == 0 );
 
	// Cleanup VBO and shader
	glDeleteBuffers(1, &vertexbuffer);
	glDeleteBuffers(1, &colorbuffer);
	glDeleteProgram(programID);
	glDeleteVertexArrays(1, &VertexArrayID);
 
	// Close OpenGL window and terminate GLFW
	glfwTerminate();
 
	return 0;
}

As you can see I have this lines:

std::vector<GLfloat> pixel(1024*768*3);
glReadPixels(0, 0, 1024, 200, GL_RGB, GL_FLOAT, &pixel[0]);

Now, how Can I pass the pixel vector to Opengl for render him and not the standard way?

I need this because I want to manipulate in same way the pixel vector and than pass him to opengl for render.

But I don't know how to do that.

 

Thanks


PARTNERS