Rendering a skybox using a cube map with OpenGL and GLSL

I realized in my previous posts the use of OpenGL wasn't up to spec. This post will attempt to implement skybox functionality using the more recent specifications. We'll use GLSL to implement a couple simple shaders. We will create an OpenGL program object to which we will bind our vertex and fragment shaders. A Vertex Buffer Object will be used to store our cube vertices and another to store the indices for the faces. Using a cube map texture will allow our vertices to double as texture coordinates. Will will also use the OpenGL Mathematics library and the keyboard and joystick handler from my previous posts to update the rotation on the skybox. Below is a screen capture and video rendering of the result.

A frame captured from our skybox rendering.

A frame captured from our skybox rendering.



Below is an example of a skybox texture (result of a Google image search.. let me know if this image belongs to you). In this implementation I used GIMP to cut the texture into six images, two for each of the three axes.

An example skybox texture.

An example skybox texture.

The code to load our images into a cube map texture looks something like what follows. We can pass each of our six images to the overloaded setupCubeMap function. This will generate a cube map texture, set some parameters, and specify the texture images.

void setupCubeMap(GLuint& texture) {
	glActiveTexture(GL_TEXTURE0);
	glEnable(GL_TEXTURE_CUBE_MAP);
	glGenTextures(1, &texture);
	glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
}

void setupCubeMap(GLuint& texture, SDL_Surface *xpos, SDL_Surface *xneg, SDL_Surface *ypos, SDL_Surface *yneg, SDL_Surface *zpos, SDL_Surface *zneg) {
	setupCubeMap(texture);
	glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, xpos->w, xpos->h, 0, xpos->format->BytesPerPixel == 4 ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, xpos->pixels);
	glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA, xneg->w, xneg->h, 0, xneg->format->BytesPerPixel == 4 ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, xneg->pixels);
	glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA, ypos->w, ypos->h, 0, ypos->format->BytesPerPixel == 4 ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, ypos->pixels);
	glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA, yneg->w, yneg->h, 0, yneg->format->BytesPerPixel == 4 ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, yneg->pixels);
	glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA, zpos->w, zpos->h, 0, zpos->format->BytesPerPixel == 4 ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, zpos->pixels);
	glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA, zneg->w, zneg->h, 0, zneg->format->BytesPerPixel == 4 ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, zneg->pixels);
}

void deleteCubeMap(GLuint& texture) {
	glDeleteTextures(1, &texture);
}

We can use these functions like below.

	SDL_Surface *xpos = IMG_Load("media/xpos.png");	SDL_Surface *xneg = IMG_Load("media/xneg.png");
	SDL_Surface *ypos = IMG_Load("media/ypos.png");	SDL_Surface *yneg = IMG_Load("media/yneg.png");
	SDL_Surface *zpos = IMG_Load("media/zpos.png");	SDL_Surface *zneg = IMG_Load("media/zneg.png");
	GLuint cubemap_texture;
	setupCubeMap(cubemap_texture, xpos, xneg, ypos, yneg, zpos, zneg);
	SDL_FreeSurface(xneg);	SDL_FreeSurface(xpos);
	SDL_FreeSurface(yneg);	SDL_FreeSurface(ypos);
	SDL_FreeSurface(zneg);	SDL_FreeSurface(zpos);

	// rendering

	deleteCubeMap(cubemap_texture);

As mentioned, using a cube map texture will allow our vertices to double as texture coordinates. Our vertex shader will generate texture coordinates from the vertex and pass those coordinates on to our fragment shader. Below, our vertex shader evaluates the position by multiplying the incoming vertex by our model view projection matrix and outputs our texture coordinate based on the vertex. In our program we will grab a handle to the vertex and PVM variables to set their values before drawing our elements.

#version 330

in vec3 vertex;
out vec3 texCoord;
uniform mat4 PVM;

void main() {
	gl_Position = PVM * vec4(vertex, 1.0);
	texCoord = vertex;
}

The fragment shader below accepts the incoming texture coordinate and uses the cube map to output the fragment color based on the texture coordinate.

#version 330

in vec3 texCoord;
out vec4 fragColor;
uniform samplerCube cubemap;

void main (void) {
	fragColor = texture(cubemap, texCoord);
}

In our program we need to do the following to set up our shader program (don't forget to initialize your extension wrangler once you have created an OpenGL context ):

  1. Create a vertex and fragment shader. glCreateShader
  2. Specify the source for each shader. glShaderSource
  3. Compile the shaders. glCompileShader
  4. Create an OpenGL program object. glCreateProgram
  5. Attach the shaders to the program object. glAttachShader
  6. Link the program object. glLinkProgram
  7. Use the program. glUseProgram
  8. We also need to grab the location of any attributes and uniforms. glGetAttribLocation and glGetUniformLocation
	// initialize the extension wrangler
	glewInit();

	// load our shaders and compile them.. create a program and link it
	GLuint glShaderV = glCreateShader(GL_VERTEX_SHADER);
	GLuint glShaderF = glCreateShader(GL_FRAGMENT_SHADER);
	const GLchar* vShaderSource = loadFile("src/vertex.sh");
	const GLchar* fShaderSource = loadFile("src/fragment.sh");
	glShaderSource(glShaderV, 1, &vShaderSource, NULL);
	glShaderSource(glShaderF, 1, &fShaderSource, NULL);
	delete [] vShaderSource;
	delete [] fShaderSource;
	glCompileShader(glShaderV);
	glCompileShader(glShaderF);
	GLuint glProgram = glCreateProgram();
	glAttachShader(glProgram, glShaderV);
	glAttachShader(glProgram, glShaderF);
	glLinkProgram(glProgram);
	glUseProgram(glProgram);

	// shader logs
	int  vlength,    flength;
	char vlog[2048], flog[2048];
	glGetShaderInfoLog(glShaderV, 2048, &vlength, vlog);
	glGetShaderInfoLog(glShaderF, 2048, &flength, flog);
	std::cout << vlog << std::endl << std::endl << flog << std::endl << std::endl;

	// grab the pvm matrix and vertex location from our shader program
	GLint PVM    = glGetUniformLocation(glProgram, "PVM");
	GLint vertex = glGetAttribLocation(glProgram, "vertex");

At this point we have set up a cube map texture and a shader program, but we still need to specify the vertices for the skybox. We will implement a Vertex Buffer Object to store both the vertices and the indices. Below we generate a buffer, bind it, and specify the data for each. We have eight vertices for the skybox. The skybox will be rendered with quadrilaterals, so we have six faces, each with four indices.

	// cube vertices for vertex buffer object
	GLfloat cube_vertices[] = {
	  -1.0,  1.0,  1.0,
	  -1.0, -1.0,  1.0,
	   1.0, -1.0,  1.0,
	   1.0,  1.0,  1.0,
	  -1.0,  1.0, -1.0,
	  -1.0, -1.0, -1.0,
	   1.0, -1.0, -1.0,
	   1.0,  1.0, -1.0,
	};
	GLuint vbo_cube_vertices;
	glGenBuffers(1, &vbo_cube_vertices);
	glBindBuffer(GL_ARRAY_BUFFER, vbo_cube_vertices);
	glBufferData(GL_ARRAY_BUFFER, sizeof(cube_vertices), cube_vertices, GL_STATIC_DRAW);
	//glBindBuffer(GL_ARRAY_BUFFER, 0);

	// cube indices for index buffer object
	GLushort cube_indices[] = {
	  0, 1, 2, 3,
	  3, 2, 6, 7,
	  7, 6, 5, 4,
	  4, 5, 1, 0,
	  0, 3, 7, 4,
	  1, 2, 6, 5,
	};
	GLuint ibo_cube_indices;
	glGenBuffers(1, &ibo_cube_indices);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_cube_indices);
	glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(cube_indices), cube_indices, GL_STATIC_DRAW);
	//glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

We also need to enable our vertex attribute and specify its format.

	glEnableVertexAttribArray(vertex);
	glVertexAttribPointer(vertex, 3, GL_FLOAT, GL_FALSE, 0, 0);

We are almost there, but we need to specify our model view projection matrix. For now we will do something like below. In our loop we will have another matrix to handle rotations based on user input.

	glm::mat4 Projection = glm::perspective(45.0f, (float)WIDTH / (float)HEIGHT, 0.1f, 100.0f); 
	glm::mat4 View       = glm::mat4(1.0f);
	glm::mat4 Model      = glm::scale(glm::mat4(1.0f),glm::vec3(50,50,50));

In our loop we update the alpha and beta rotations based on user input and update our transformation matrix.

		if (kb.getKeyState(KEY_UP))    alpha += 180.0f*elapsed0;
		if (kb.getKeyState(KEY_DOWN))  alpha -= 180.0f*elapsed0;
		if (kb.getKeyState(KEY_LEFT))  beta  -= 180.0f*elapsed0;
		if (kb.getKeyState(KEY_RIGHT)) beta  += 180.0f*elapsed0;
		jp[0] = js.joystickPosition(0);
		alpha += jp[0].y*elapsed0*180.0f;
		beta  += jp[0].x*elapsed0*180.0f;

		glm::mat4 RotateX = glm::rotate(glm::mat4(1.0f), alpha, glm::vec3(-1.0f, 0.0f, 0.0f));
		glm::mat4 RotateY = glm::rotate(RotateX, beta, glm::vec3(0.0f, 1.0f, 0.0f));
		glm::mat4 M = Projection * View * Model * RotateY;
		glUniformMatrix4fv(PVM, 1, GL_FALSE, glm::value_ptr(M));

Finally, a call to glDrawElements will render our skybox.

		glDrawElements(GL_QUADS, sizeof(cube_indices)/sizeof(GLushort), GL_UNSIGNED_SHORT, 0);

If you have any questions, comments, or suggestions, let me know.

Download this project: skybox_20130404correction.tar.bz2

22 thoughts on “Rendering a skybox using a cube map with OpenGL and GLSL

  1. The author of the original sky texture titled "miramar" is Jockum Skoglund aka hipshot and it is published under the following licence: "Modify however you like, just cred me for my work, maybe link to my page".

    The texture is available in jpg here: http://www.zfight.com/misc/images/textures/envmaps/miramar_large.jpg

    And the original as six tga here:
    http://www.zfight.com/misc/files/textures/envmap_miramar.rar

    hipshot published his textures here:
    - http://forums.epicgames.com/threads/506748-My-skies-and-and-cliff-textures-(large-images!).
    - http://www.quake3world.com/forum/viewtopic.php?t=9242

    I would recomend the keywords "skybox" and "cubemap" to search for similar images, or use one of these as sample to search similar images.

    There are some commercial tools to render these images, such as Vue from cornucopia3d or terragen, both have gratis (free as in beer) limited versions. As for a libre (free as in speech) alternative, the best so far I've seen in picogen.

    As for editing, use GIMP and the Resynthesizer plug-in ( http://logarithmic.net/pfh/resynthesizer also consider this patch: http://registry.gimp.org/node/15118 ) which is very good to manipulate textures.

  2. Love your code, simple effective. Everything work except your shader. My old gateway laptop reports that it does not support version 3.30 of glsl (max version suported is 1.20).

    Can you rewrite the shaders to support glsl 1.20 and email them to me.

    Thanks

    • Hi Shomari..

      The following shaders seemed to do the trick.. let me know if they work for you.

      Vertex Shader

      #version 120

      in vec3 vertex;
      varying vec3 texCoord;
      uniform mat4 PVM;

      void main() {
      gl_Position = PVM * vec4(vertex, 1.0);
      texCoord = vertex;
      }

      Fragment Shader

      #version 120

      varying vec3 texCoord;
      //varying vec4 fragColor;
      uniform samplerCube cubemap;

      void main (void) {
      gl_FragColor = textureCube(cubemap, texCoord);
      }

  3. /usr/bin/ld: cannot find -lvlc
    collect2: ошибка: выполнение ld завершилось с кодом возврата 1
    make: *** [all] Ошибка 1

    how to fix this error?

    • Hey Don..

      I'm not sure what Linux distro you are using, but on my Debian machine I would install the VLC development files via..

      #sudo apt-get install libvlc-dev

      .. but now that I think about it, you shouldn't need to link that library for this project anyway. Just remove the -lvlc from the Makefile. That should do it.

      • Тhanks for your reply!)
        Installed the library vlc. cube is drawn. joystick works. But the keyboard does not respond ((
        Help, please!

        • Take a look at the device nodes on your system under /dev/input/

          For this project in skybox/src/keyboard.h you'll find the #define for the keyboard device, KEYBOARD_DEV. You could try swapping that with a different device until you find your keyboard.

          See if that does the trick.

          • Hey Keith!

            I want to start by thanking you for all the tutorials.
            So, I can't control with my keyboard nor with my mouse to move and look around in the skybox. I tried what you said to change the eventX but didn't make any changes. To press F however takes me into fullscreen and F back to window mode.

            How can solve this to start moving and looking?

            Thanks in advance
            Ramael

          • Hey Ramael,

            I made a few modifications to the project download. I'm not confident those mods were the solution, but you could try it out.

            When I run the application, the keyboard constructor outputs the keyboard device name. Do you get any output from the constructor?

            keith@keith:~/tsting/skybox$ bin/main
            Name: AT Translated Set 2 keyboard

            I haven't built any mouse support into this project. Unless you've added that support, it's supposed to function with the keyboard or joystick. One way to possibly skirt the keyboard issue would be to update the main.cc file with this code. I'm still curious why the keyboard object isn't working properly for a few people. Keep me updated.

            	// rotation angles
            	float alpha = 0.0f, beta = 0.0f;
            	bool up = false, down = false, left = false, right = false;
            
            	while(active) {
            		while (SDL_PollEvent(&event)) {
            			switch (event.type) {
            			case SDL_QUIT:
            				active = false;
            				break;
            			case SDL_KEYDOWN:
            				switch (event.key.keysym.sym) {
            				case SDLK_g:
            					grab = true;
            					break;
            				case SDLK_v:
            					video ^= true; elapsed1 = 0.0;
            					break;
            				case SDLK_f:
            					fullscreen ^= true;
            					screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32, (fullscreen ? SDL_FULLSCREEN : 0) | SDL_HWSURFACE | SDL_OPENGL);
            					break;
            				case SDLK_UP: up = true; break;
            				case SDLK_DOWN: down = true; break;
            				case SDLK_LEFT: left = true; break;
            				case SDLK_RIGHT: right = true; break;
            				}
            				break;
            			case SDL_KEYUP:
            				switch (event.key.keysym.sym) {
            				case SDLK_UP: up = false; break;
            				case SDLK_DOWN: down = false; break;
            				case SDLK_LEFT: left = false; break;
            				case SDLK_RIGHT: right = false; break;
            				}
            				break;
            			}
            		}
            
            		// time elapsed since last frame
            		elapsed0 = t0.elapsed(true);
            
            		// update frame based on input state
            		/*if (kb.getKeyState(KEY_UP))    alpha += 180.0f*elapsed0;
            		if (kb.getKeyState(KEY_DOWN))  alpha -= 180.0f*elapsed0;
            		if (kb.getKeyState(KEY_LEFT))  beta  -= 180.0f*elapsed0;
            		if (kb.getKeyState(KEY_RIGHT)) beta  += 180.0f*elapsed0;*/
            		// update frame based on input state
            		if (up)    alpha += 180.0f*elapsed0;
            		if (down)  alpha -= 180.0f*elapsed0;
            		if (left)  beta  -= 180.0f*elapsed0;
            		if (right) beta  += 180.0f*elapsed0;
            
  4. Hi,
    A slight correction, in OpenGL 3.3 core profile you cannot do this
    glEnable(GL_TEXTURE_CUBE_MAP);
    This generates an invalid operation.

  5. See if that does the trick.
    keyboard is event4
    but when I connect it, nothing happens to the crust of the skybox
    Please!!
    help me understand? what is the problem?

    • Hey Don..

      I just had an issue on another system.. the /dev/input/event0 node was set to be readable only by root. You might try suing to root and see if that works.. might just be a read issue. Also, the cKeyboard constructor is set up to output the keyboard device name.. does this output anything on your system?

  6. g++ src/keyboard.cc -c -o lib/keyboard.o
    g++ src/joystick.cc -c -o lib/joystick.o
    g++ src/glhelper.cc -c -o lib/glhelper.o
    g++ src/timer.cc -c -o lib/timer.o
    g++ main.cc lib/keyboard.o lib/joystick.o lib/glhelper.o lib/timer.o -o bin/main -L/usr/lib `sdl-config --cflags --libs` -lSDL_ttf -lSDL_image `pkg-config opencv --cflags --libs` -lGL -lGLU -lvlc -lpthread
    mimo@mimo-VPCEB4S1R:~/Рабочий стол/keyboard$ bin/main
    Name: Logitech Logitech Dual Action
    Version: 131328
    Axes: 6
    Buttons: 12
    mimo@mimo-VPCEB4S1R:~/Рабочий стол/keyboard$ make
    g++ src/joystick.cc -c -o lib/joystick.o
    g++ main.cc lib/keyboard.o lib/joystick.o lib/glhelper.o lib/timer.o -o bin/main -L/usr/lib `sdl-config --cflags --libs` -lSDL_ttf -lSDL_image `pkg-config opencv --cflags --libs` -lGL -lGLU -lvlc -lpthread
    mimo@mimo-VPCEB4S1R:~/Рабочий стол/keyboard$ bin/main
    Name: A4TECH USB Device
    Version: 131328
    Axes: 37
    Buttons: 57
    mimo@mimo-VPCEB4S1R:~/Рабочий стол/keyboard$ make
    g++ main.cc lib/keyboard.o lib/joystick.o lib/glhelper.o lib/timer.o -o bin/main -L/usr/lib `sdl-config --cflags --libs` -lSDL_ttf -lSDL_image `pkg-config opencv --cflags --libs` -lGL -lGLU -lvlc -lpthread
    mimo@mimo-VPCEB4S1R:~/Рабочий стол/keyboard$ bin/main
    Name: A4TECH USB Device
    Version: 131328
    Axes: 37
    Buttons: 57
    mimo@mimo-VPCEB4S1R:~/Рабочий стол/keyboard$ ^C
    mimo@mimo-VPCEB4S1R:~/Рабочий стол/keyboard$

    • Hey Don..

      I'm not seeing the cKeyboard constructor elicit any information regarding your keyboard device. The cJoystick object is outputting the Name/Version/Axes/Buttons information. I assume you have been updating the KEYBOARD_DEV define in the keyboard.h header file. Actually.. I just reviewed the documentation for the open() function, and the documentation states that the open() function returns a non-negative integer for the file descriptor. In the keyboard.cc source file try changing the conditional, if (keyboard_fd > 0) {, to if (keyboard_fd >= 0) {. Let me know if that gets you anywhere.

  7. Thanks for the reply. I didn't understand everything fully before! I already had my Xbox 360 controller connected to the computer but I tried the keyboard. So I can say this:

    1. Without doing the modification you posted in the comments, the it works (!) to look around with my Xbox 360 controller (USB to PC).

    2. If i plug the Xbox 360 controller out and try to remake it, I get segmentation fault.

    3. By doing the modification you posted in the comments the keyboard now works (arrows buttons).

    Thanks for everything and nice tutorials, keep up the good work!

    • Awesome. Glad you got it working.

      My keyboard and joystick objects could use some work (more error checking/polling devices). They are a bit basic.

  8. Hi Keith,
    I see you're using SDL to load cubemap. Is there anyway we can load cube map without using external library? I wrote my own code to load texture ( will return a GLuint data), can we make use of it?
    Thanks

    • Hey Vu,

      Yeah, the setupCubemap() function could be rewritten. It really just needs the dimensions and the buffer data of the images. SDL is really only used to load the images in this case, so as long as you have a way to load images, you could drop SDL altogether.

  9. Hi keith,
    I have complied your code in ubuntu14 successfully,but when I run the main generated in file "bin",the terminal comes with a lot of horrible warning. as follow
    4.4.0 NVIDIA 340.29
    4.40 NVIDIA via Cg compiler
    1.10.0
    GL_AMD_multi_draw_indirect GL_AMD_seamless_cubemap_per_texture GL_ARB_arrays_of_arrays GL_ARB_base_instance GL_ARB_bindless_texture GL_ARB_blend_func_extended GL_ARB_buffer_storage GL_ARB_clear_buffer_object GL_ARB_clear_texture GL_ARB_color_buffer_float GL_ARB_compatibility GL_ARB_compressed_texture_pixel_storage GL_ARB_conservative_depth GL_ARB_compute_shader GL_ARB_compute_variable_group_size GL_ARB_copy_buffer GL_ARB_copy_image GL_ARB_debug_output GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_draw_buffers_blend GL_ARB_draw_indirect GL_ARB_draw_elements_base_vertex GL_ARB_draw_instanced GL_ARB_enhanced_layouts GL_ARB_ES2_compatibility GL_ARB_ES3_compatibility GL_ARB_explicit_attrib_location GL_ARB_explicit_uniform_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_layer_viewport GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_no_attachments GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4 GL_ARB_get_program_binary GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_indirect_parameters GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_internalformat_query2 GL_ARB_invalidate_subdata GL_ARB_map_buffer_alignment GL_ARB_map_buffer_range GL_ARB_multi_bind GL_ARB_multi_draw_indirect GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_occlusion_query2 GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_program_interface_query GL_ARB_provoking_vertex GL_ARB_robust_buffer_access_behavior GL_ARB_robustness GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_seamless_cubemap_per_texture GL_ARB_separate_shader_objects GL_ARB_shader_atomic_counters GL_ARB_shader_bit_encoding GL_ARB_shader_draw_parameters GL_ARB_shader_group_vote GL_ARB_shader_image_load_store GL_ARB_shader_image_size GL_ARB_shader_objects GL_ARB_shader_precision GL_ARB_query_buffer_object GL_ARB_shader_storage_buffer_object GL_ARB_shader_subroutine GL_ARB_shader_texture_lod GL_ARB_shading_language_100 GL_ARB_shading_language_420pack GL_ARB_shading_language_include GL_ARB_shading_language_packing GL_ARB_shadow GL_ARB_sparse_texture GL_ARB_stencil_texturing GL_ARB_sync GL_ARB_tessellation_shader GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_buffer_range GL_ARB_texture_compression GL_ARB_texture_compression_bptc GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_cube_map_array GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_gather GL_ARB_texture_mirror_clamp_to_edge GL_ARB_texture_mirrored_repeat GL_ARB_texture_multisample GL_ARB_texture_non_power_of_two GL_ARB_texture_query_levels GL_ARB_texture_query_lod GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_texture_rgb10_a2ui GL_ARB_texture_stencil8 GL_ARB_texture_storage GL_ARB_texture_storage_multisample GL_ARB_texture_swizzle GL_ARB_texture_view GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_transform_feedback_instanced GL_ARB_transpose_matrix GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_attrib_64bit GL_ARB_vertex_attrib_binding GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_vertex_type_10f_11f_11f_rev GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_texture_float GL_ATI_texture_mirror_once GL_S3_s3tc GL_EXT_texture_env_add GL_EXT_abgr GL_EXT_bgra GL_EXT_bindable_uniform GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_Cg_shader GL_EXT_depth_bounds_test GL_EXT_direct_state_access GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXTX_framebuffer_mixed_formats GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_shader_objects GL_EXT_separate_specular_color GL_EXT_shader_image_load_store GL_EXT_shader_integer_mix GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture3D GL_EXT_texture_array GL_EXT_texture_buffer_object GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_latc GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_shared_exponent GL_EXT_texture_sRGB GL_EXT_texture_sRGB_decode GL_EXT_texture_storage GL_EXT_texture_swizzle GL_EXT_timer_query GL_EXT_transform_feedback2 GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_EXT_vertex_attrib_64bit GL_EXT_x11_sync_object GL_EXT_import_sync_object GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_KHR_debug GL_KTX_buffer_region GL_NV_bindless_multi_draw_indirect GL_NV_bindless_multi_draw_indirect_count GL_NV_bindless_texture GL_NV_blend_equation_advanced GL_NV_blend_square GL_NV_compute_program5 GL_NV_conditional_render GL_NV_copy_depth_to_color GL_NV_copy_image GL_NV_depth_buffer_float GL_NV_depth_clamp GL_NV_draw_texture GL_NV_ES1_1_compatibility GL_NV_ES3_1_compatibility GL_NV_explicit_multisample GL_NV_fence GL_NV_float_buffer GL_NV_fog_distance GL_NV_fragment_program GL_NV_fragment_program_option GL_NV_fragment_program2 GL_NV_framebuffer_multisample_coverage GL_NV_geometry_shader4 GL_NV_gpu_program4 GL_NV_gpu_program4_1 GL_NV_gpu_program5 GL_NV_gpu_program5_mem_extended GL_NV_gpu_program_fp64 GL_NV_gpu_shader5 GL_NV_half_float GL_NV_light_max_exponent GL_NV_multisample_coverage GL_NV_multisample_filter_hint GL_NV_occlusion_query GL_NV_packed_depth_stencil GL_NV_parameter_buffer_object GL_NV_parameter_buffer_object2 GL_NV_path_rendering GL_NV_pixel_data_range GL_NV_point_sprite GL_NV_primitive_restart GL_NV_register_combiners GL_NV_register_combiners2 GL_NV_shader_atomic_counters GL_NV_shader_atomic_float GL_NV_shader_atomic_int64 GL_NV_shader_buffer_load GL_NV_shader_storage_buffer_object GL_NV_texgen_reflection GL_NV_texture_barrier GL_NV_texture_compression_vtc GL_NV_texture_env_combine4 GL_NV_texture_expand_normal GL_NV_texture_multisample GL_NV_texture_rectangle GL_NV_texture_shader GL_NV_texture_shader2 GL_NV_texture_shader3 GL_NV_transform_feedback GL_NV_transform_feedback2 GL_NV_vdpau_interop GL_NV_vertex_array_range GL_NV_vertex_array_range2 GL_NV_vertex_attrib_integer_64bit GL_NV_vertex_buffer_unified_memory GL_NV_vertex_program GL_NV_vertex_program1_1 GL_NV_vertex_program2 GL_NV_vertex_program2_option GL_NV_vertex_program3 GL_NVX_conditional_render GL_NVX_gpu_memory_info GL_NVX_nvenc_interop GL_NV_shader_thread_group GL_NV_shader_thread_shuffle GL_KHR_blend_equation_advanced GL_SGIS_generate_mipmap GL_SGIS_texture_lod GL_SGIX_depth_texture GL_SGIX_shadow GL_SUN_slice_accum
    Segmentation fault (core dumped)

    I am new to OpenGl in Linux and hope you can help me.

  10. Pingback: Opengl Skybox Texturing Error | DL-UAT

Leave a Reply

Your email address will not be published. Required fields are marked *