I have written some articles about how to use Mesa before. Try again now. Something has changed in Ubuntu 13.04.
First install:
Sudo apt-get install libgl1-mesa-dev
Sudo apt-get install libglu1-mesa-dev
Sudo apt-get install freeglut3-dev
Now you don't need NetBeans. Use CMake to create a project.
Contents of cmakelists.txt in the root directory:
Cmake_minimum_required (VERSION 2.8)
Project (vender)
Add_subdirectory (src bin)
The content of the cmakelists.txt file in the srcdirectory is as follows:
Cmake_minimum_required (VERSION 2.8)
Set (CMAKE_BUILD_TYPE Debug)
Set (PROJECT_INCLUDE_DIR ../include)
Include_directories ($ {PROJECT_INCLUDE_DIR })
AUX_SOURCE_DIRECTORY ($ {CMAKE_SOURCE_DIR}/src CPP_LIST1)
Add_executable (vender ${CPP_LIST1 })
Target_link_libraries (vender gl glu glut)
Add_definitions (-Wall)
Then let's take a look at the src/main. cc file content, which is the same as the code three years ago.
# Include <GL/glut. h>
Void init ();
Void display ();
Int main (int argc, char * argv []) {
Gluinit (& argc, argv );
Fig );
Gluinitwindowposition (0, 0 );
Gluinitwindowsize (300,300 );
Valley createwindow ("OpenGL 3D View ");
Init ();
Gludisplayfunc (display );
Glumainloop ();
Return 0;
}
Void init (){
GlClearColor (0.0, 0.0, 0.0, 0.0 );
GlMatrixMode (GL_PROJECTION );
GlOrtho (-5, 5,-5, 5, 5, 15 );
GlMatrixMode (GL_MODELVIEW );
GluLookAt (0, 0, 10, 0, 0, 0, 0, 1, 0 );
}
Void display (){
GlClear (GL_COLOR_BUFFER_BIT );
GlColor3f (1.0, 0, 0 );
Gluwireteapot (3 );
GlFlush ();
}
Running result:
I don't want to draw any graphics this time. I just want to know the type of my graphics card. Therefore, the Code deletion is as follows:
# Include <GL/glut. h>
# Include <iostream>
Using namespace std;
Int main (int argc, char * argv []) {
Gluinit (& argc, argv );
Fig );
Gluinitwindowposition (0, 0 );
Gluinitwindowsize (300,300 );
Valley createwindow ("OpenGL 3D View ");
GLubyte const * vender = glGetString (GL_VENDOR );
Cout <"GL_VENDOR:" <vender <endl;
GLubyte const * renderer = glGetString (GL_RENDERER );
Cout <"GL_RENDERER:" <renderer <endl;
GLubyte const * version = glGetString (GL_VERSION );
Cout <"GL_VERSION:" <version <endl;
Return 0;
}
Running result:
Www.bkjia.com @ linux :~ /Work/opengl/vendor/build/bin $./vender
GL_VENDOR: X. Org
GL_RENDERER: Gallium 0.4 on AMD JUNIPER
GL_VERSION: 3.0 Mesa 9.1.4
Recommended reading:
Open source 3D driver set Mesa released version 9.0
Mesa out-of-bounds memory damage Vulnerability (CVE-2013-1872)