DingSongYun / oglsuperbible5

Automatically exported from code.google.com/p/oglsuperbible5
0 stars 0 forks source link

Chaper 5 SphereWorld gives a black screen (Linux x64) #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile SphereWorld on Linux x64
2. Run it.
3. Notice there is no world of spheres

What is the expected output? What do you see instead?
Expected: SphereWorld as shown in the book. Instead: a black screen

What version of the product are you using? On what operating system?
Linux arch 2.6.35-ARCH x86_64 GenuineIntel GNU/Linux
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: Quadro FX 880M/PCI/SSE2
OpenGL version string: 3.3.0 NVIDIA 260.19.21
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler

Please provide any additional information below.

Original issue reported on code.google.com by thomas.vdburgt@gmail.com on 25 Nov 2010 at 11:37

GoogleCodeExporter commented 9 years ago
I had the same issue, it's because of case differences between texture 
filenames in the code and on the filesystem. Either rename the *.tga files to 
be lowercase or change their names in the code.

Original comment by rafge...@gmail.com on 6 Dec 2010 at 2:38

GoogleCodeExporter commented 9 years ago
There are no texture files at all for the specific program. (SphereWorld)
This is what I was getting:
./SphereWorld 
Segmentation fault

After tracing it a bit, here is what I've found:

In the ChangeSize function two GLMatrixStacks are initialized

transformPipeline.SetMatrixStacks(modelViewMatrix, projectionMatrix);

It seems that in Linux (kubuntu10.10 64bit here) this function is NOT called 
prior to rendering and hence these two GLMatrixStacks are not initialised.

As a quick workarround you can try the following (It works for me)
at the end of main() you'll see
    SetupRC();
    glutMainLoop();   

Add a ChangeSize(1,1); line there, so it reads:
    SetupRC();
    ChangeSize(1,1);
    glutMainLoop();   

(that way we call ChangeSize and thus initialise the GLMatrixStacks before we 
actually use them)

The same applies to SphereWorld4...and it will probably apply to more...

Original comment by alkin...@gmail.com on 5 Feb 2011 at 6:16

GoogleCodeExporter commented 9 years ago
The second comment by Alkin* is not applicable in this case.

On Ubuntu, the sphereworld program from chapter 5 (and not from chapter 4) runs 
fine, but shows everything black. The root cause of this issue is filename 
cases, as explained in comment 1 by rafge*.

Also, chapter 4 sphereworld does not have textures. The one in chapter 5 does.

Original comment by nag.ra...@gmail.com on 13 Sep 2012 at 10:18