LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-22-2004, 05:50 PM   #1
norfenstein
LQ Newbie
 
Registered: Jan 2003
Distribution: Ubuntu
Posts: 12

Rep: Reputation: 0
Compiled OpenGL programs produce blank screens


I have OpenGL set up and working properly in Linux but whenever I compile a program that uses OpenGL for video I get only blank, black screens. The programs compile flawlessly and even run exactly as they should (sound, keyboard input, windowing, etc.) except I can't see anything. For example, the binary included in this simple tutorial works exactly as advertised, producing a captioned window with a white triangle in the center, pressing escape quits. If I compile it myself, however, using the included make file, I get a black empty window with a nice caption and pressing escape quits. I'm stumped, any help would be greatly appreciated.

linux 2.6.8.1
gcc 3.3.4
XFree86 4.3.0.1
nvidia driver 1.0-6111
 
Old 11-22-2004, 06:45 PM   #2
dvm
Member
 
Registered: Sep 2004
Posts: 62

Rep: Reputation: 16
Are you sure you're not changing anything? Every time (as long as I can remember) I had a blank screen was my fault.
Check your "reshape" or "resize' function callback and make sure you use a proper gluLookAt in the beginning of the "Display" function. Since the pre-built program is running ok, chances are you're messing something up.
Try starting with a simple thing as:
Code:
#include <GL/glut.h>

void display()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glLoadIdentity();
    glRectf(-0.5, -0.5, 0.5, 0.5);
    glutSwapBuffers();
}

int main(int argc, char *argv[])
{
    glutInitDisplayMode(GLUT_DOUBLE);
    glutInitWindowPosition(100, 100);
    glutInitWindowSize(100, 100);
    glutInit(&argc, argv);
    glutCreateWindow("Test");
    glutDisplayFunc(display);
    glutMainLoop();
}
Then compile with g++ <filename.cpp> -lglut
This should produce a small square in the middle of a small window.
If this doesn't work then I don't know what's wrong.
 
Old 11-22-2004, 10:46 PM   #3
norfenstein
LQ Newbie
 
Registered: Jan 2003
Distribution: Ubuntu
Posts: 12

Original Poster
Rep: Reputation: 0
I can't think of anything wrong code-wise with the programs I tested: one was a full game with source I didn't touch, two were simple test programs that worked for me on Windows (no Windows specific code), and just to be sure I tried that tutorial to rule out run-time issues. I tried your code (after installing glut) and it worked, so it looks like the problem is with SDL which was the common thread between all the ones that didn't work. I don't know what the actual issue could be though, since everything else SDL related works, including 2D graphics.
 
Old 12-04-2004, 02:37 PM   #4
norfenstein
LQ Newbie
 
Registered: Jan 2003
Distribution: Ubuntu
Posts: 12

Original Poster
Rep: Reputation: 0
Got the answer on a less trafficked forum. If anyone else is having the same problem, install the GL headers specific to your graphics card.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sony FS640/W Suse 9.3 no Xserver, blank screens eccentric4 Linux - Laptop and Netbook 2 09-25-2005 11:11 PM
How to remove compiled programs? piggysmile Linux - Software 2 03-22-2005 05:25 AM
Blank Screens Kane2002 Linux - Hardware 0 10-04-2004 08:42 AM
why ./ is used to run C++ compiled programs legend1079 Red Hat 4 03-23-2004 06:32 AM
blank screen on opengl xscreensavers n_hendrick Linux - Newbie 1 01-16-2004 03:55 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration