PDA

View Full Version : OpenGL Superbible version 5 Samples black screen



Kreed
10-20-2010, 03:30 PM
Hey Everyone. I have been going through the latest superbible and I am trying to view the samples. Parts of chapter 8 and everything in every chapter after that gives me issues. The program runs, but shows a black screen, or just portions of the scenes.

I have the updated drivers for my Geforce 465 with support for OpenGL 4.1. I am also running Windows 7 64-bit So that can't be the issue.Does anyone know what may be the problem?

Thanks a lot,
Kreed

Groovounet
10-21-2010, 02:50 AM
It's possible that drivers has conformance issues with the standard that results with black screens. However, The Superbible is dedicated to OpenGL 3.3 and I find AMD and nVidia drivers fairly reliable with this version.

Do you have some glGetError or shader compilation logs?

Kreed
10-21-2010, 05:43 AM
When I run the hdr_msaa example, a console window appears behind the window for the application. The console keeps saying -
"The framebuffer is not complete -
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
A GL Error has occured

Every sample after that just crashes on run. For example "Perspective.exe has stopped working".

Also the Block_redux.exe example in chapter 13 flashes a console saying

"This system supports OpenGL Version 4.1.0.
!!! An error occurred trying to find a pixel format with the requested attribs.
!!! An error occured creating an OpenGL window

Kreed
10-21-2010, 01:05 PM
anyone have any ideas?

SPIRICN
01-07-2011, 01:39 AM
Having the exact same problem

I downloaded the latest drivers for my GeForce 9800GT and verified my OpenGL version (3.3) via the OpenGL Extension Viewer and the samples still don't work properly

I am also having trouble with some earlier samples for instance

Chapter7/Point Sprites sample, nothing is showing up on the screen(by the way no errors occurred, I checked)

Chapter 7/Texture Arrays, same thing, blank screen nothing showing up

after I built the project and ran the sample (using Visual Studio 2010) I got the following message

The shader at MoonShader.fp failed to compile with the following error:
0(15) : error C7531: global function texture2DArray requires "#extension GL_EXT_
gpu_shader4 : enable" before use


putting #extension GL_EXT_gpu_shader4 : enable in the MoonShader.fp file fixed the problem and I got the moon to render on the screen but still no stars

By the way I am running Windows 7 32-bit

mobeen
01-07-2011, 01:57 AM
Indeed most of the samples dont work straight out. THe default behaviour of gltools lib. func. (like gltLoadShaderPairWithAttributes) is to silently return a 0 value for a shader when there are errors. One thing I did was added a printf statement in the gltools library to show the info log of the shader at compile/link steps.

mobeen
01-07-2011, 02:15 AM
When I run the hdr_msaa example, a console window appears behind the window for the application. The console keeps saying -
"The framebuffer is not complete -
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
A GL Error has occured

You can change line 291 in hdr_msaa.cpp from

glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, hdrTextures[0], 0);
to

glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, hdrTextures[0], 0); this solves the incompleteness issue.
Strangely none of the fbo samples call
GLenum status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
if(status == GL_FRAMEBUFFER_COMPLETE)
printf("FBO setup ok.");
else
printf("FBO error.");
to check the framebuffer completeness.
The block redux sample does not work because the pixAttribs array given in source code is wrong (it is correct in book). In code it is given as

// Specify the important attributes we care about
int pixAttribs[] = { WGL_SUPPORT_OPENGL_ARB, 1, // Must support OGL rendering
WGL_DRAW_TO_WINDOW_ARB, 1, // pf that can run a window
WGL_ACCELERATION_ARB, 1, // must be HW accelerated
WGL_RED_BITS_ARB, 8, // 8 bits of red precision in window
WGL_GREEN_BITS_ARB, 8, // 8 bits of green precision in window
WGL_BLUE_BITS_ARB, 8, // 8 bits of blue precision in window
WGL_DEPTH_BITS_ARB, 16, // 16 bits of depth precision for window
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB, // pf should be RGBA type
0}; // NULL termination
when it should be this

int pixAttribs[] = { WGL_SUPPORT_OPENGL_ARB, 1, // Must support OGL rendering
WGL_DRAW_TO_WINDOW_ARB, 1, // pf that can run a window
WGL_RED_BITS_ARB, 8, // 8 bits of red precision in window
WGL_GREEN_BITS_ARB, 8, // 8 bits of green precision in window
WGL_BLUE_BITS_ARB, 8, // 8 bits of blue precision in window
WGL_DEPTH_BITS_ARB, 16, // 16 bits of depth precision for window
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB, // pf should be RGBA type
0}; // NULL termination
I have build all of the samples with success I will update the info on the svn googlecodes site.

SPIRICN
01-07-2011, 04:43 AM
Indeed most of the samples dont work straight out. THe default behaviour of gltools lib. func. (like gltLoadShaderPairWithAttributes) is to silently return a 0 value for a shader when there are errors.

gltLoadShaderPairWithAttributes [/B]didn't return 0 in Point Sprites sample yet still all I am getting is a blank screen (I tried running some of the samples executables on another PC and still didn't get anything)

By the way I downloaded the samples zip archive from http://www.starstonesoftware.com/OpenGL/ , is there perhaps a more up to date version of those somewhere ?

Groovounet
01-07-2011, 04:51 AM
Did you checkout the repository?

svn checkout http://oglsuperbible5.googlecode.com/svn/trunk/ oglsuperbible5-read-only

Richard has worked a lot to fix the samples I am not sure if everything is fixed but a lot of progress has been done.

mobeen
01-07-2011, 04:54 AM
Indeed most of the samples dont work straight out. THe default behaviour of gltools lib. func. (like gltLoadShaderPairWithAttributes) is to silently return a 0 value for a shader when there are errors.

gltLoadShaderPairWithAttributes [/B]didn't return 0 in Point Sprites sample yet still all I am getting is a blank screen (I tried running some of the samples executables on another PC and still didn't get anything)

By the way I downloaded the samples zip archive from http://www.starstonesoftware.com/OpenGL/ , is there perhaps a more up to date version of those somewhere ?
Get the svn version. I got the latest version from there and i dont get any problem with the point sprite sample. Let me know if u still cant get it working.

SPIRICN
01-07-2011, 05:59 AM
Got the svn version and it works perfectly, thanks!

Marksman
08-05-2012, 12:58 AM
Sorry to revive this, but for the sake of other people with the same issue... Another cause of the black screen is missing textures. A lot of the examples seem to have them missing or incorrectly cased ("moonlike" instead of "MoonLike"). It'd probably be a good idea to put some logging into your LoadTGA() function so you don't just silently fail.