PDA

View Full Version : OpenGL Hello World



jucestain
05-09-2012, 07:24 AM
Hello,

I followed the instructions here:

http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-2:-Hello-World:-The-Slideshow.html

I was able to compile and run it but it runs VERY slow, maybe 1fps or something on that order. I'm running a 580gtx on Ubuntu 11.04 64bit. I compiled and ran the same code on my laptop through a 32 bit ubuntu virtual machine and it runs faster (albeit still slow since it's a virtual machine). Does anyone know of anything that could possibly make this code run very slowly?

The libraries I have installed are:
freeglut3
freeglut3-dev
libglew1.5
libglew1.5-dev
libglu1-mesa
libglu1-mesa-dev
libgl1-mesa-glx
libgl1-mesa-dev

Thanks.

stefkos
05-09-2012, 01:36 PM
Do you have 3d support for this card? Maybe its working on framebuffer.
What resolution did you set?

jucestain
05-09-2012, 02:04 PM
Do you have 3d support for this card? Maybe its working on framebuffer.
What resolution did you set?

Not sure, but the 580gtx is only a few years old and was Nvidia's flagship GTX card for a while. I also have graphics drivers installed as well as the appropriate opengl libraries (to my knowledge). The resolution is small, like 400x300. Puzzling because this runs faster on my laptop... This is also a very simple/basic script. Seems like it should run fast without problems...

menzel
05-10-2012, 01:23 AM
The 580 supports up to OpenGL 4.2, is very fast and well supported on linux. Make sure you have the NVidia drivers installed and not the open source drivers. Check glewinfo to verify the driver vendor and OpenGL version (first few lines). My linkerflags for a simple GLFW based project is 'libglfw.a -lXrandr -lX11 -lGLU -lGL -pthread -lm' (GLFW is a bit simpler than GLUT but very well supported and nice to work with). Note that I link -lGL and not against Mesa.

jucestain
05-10-2012, 09:32 AM
The 580 supports up to OpenGL 4.2, is very fast and well supported on linux. Make sure you have the NVidia drivers installed and not the open source drivers. Check glewinfo to verify the driver vendor and OpenGL version (first few lines). My linkerflags for a simple GLFW based project is 'libglfw.a -lXrandr -lX11 -lGLU -lGL -pthread -lm' (GLFW is a bit simpler than GLUT but very well supported and nice to work with). Note that I link -lGL and not against Mesa.

glewinfo gives:

GLEW version 1.5.2
Reporting capabilities of display :0, visual 0x2b
Running on a GeForce GTX 580/PCI/SSE2 from NVIDIA Corporation
OpenGL version 4.2.0 NVIDIA 285.05.33 is supported

Note that 285.05.33 is driver that is supported by CUDA even though there are more recent revisions. The libraries I link to are:

-lGL -lglut -lGLEW -lm

It compiles and runs correctly, just does so very slooowly. Interestingly, I downloaded an ran the tutors demos and they run just fine... Not sure what the issue is. I attached the files and makefile if anyone with linux can test it out. Thanks.

713

menzel
05-10-2012, 11:22 AM
I don't see anything in that code that would measure the performance (no FPS or similar). Maybe the animation is bound to the refreshrate and VSync leads to different results.