Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GL/glew.h>
- #include <GLFW/glfw3.h>
- #include <assert.h>
- #include <stdio.h>
- void main( )
- {
- //Window init
- assert( glfwInit( ) == GLFW_TRUE );
- glfwWindowHint( GLFW_SAMPLES, 1 );
- glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 4 );
- glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 5 );
- glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE );
- glfwWindowHint( GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE );
- GLFWwindow *window = glfwCreateWindow( 800, 600, "FBO test", NULL, NULL );
- assert( window != NULL );
- glfwMakeContextCurrent( window );
- glewExperimental = GL_TRUE;
- assert( glewInit( ) == GLEW_OK );
- //Create textures
- GLuint tex[2];
- glCreateTextures( GL_TEXTURE_2D, 2, tex );
- glTextureStorage2D( tex[0], 1, GL_RGB8, 2048, 2048 );
- glTextureStorage2D( tex[1], 1, GL_RGB8, 1024, 1024 );
- //Create FBO
- GLuint fbo;
- glCreateFramebuffers( 1, &fbo );
- glNamedFramebufferTexture( fbo, GL_COLOR_ATTACHMENT0, tex[0], 0 );
- glNamedFramebufferTexture( fbo, GL_COLOR_ATTACHMENT1, tex[1], 0 );
- //Check completeness
- GLenum comp = glCheckNamedFramebufferStatus( fbo, GL_FRAMEBUFFER );
- if ( comp != GL_FRAMEBUFFER_COMPLETE )
- {
- printf( "0x%x\n", comp );
- printf( "0x%x - GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT\n", GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT );
- assert( comp != GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement