You are not logged in.

#1 2009-08-05 01:13:02

kronig
Member
Registered: 2009-05-25
Posts: 22

[SOLVED] GLUT single buffered windows dont render!

Have a DELL Inspiron E1405 with Intel 945GMS, xorg 1.6.3, direct rendering on, xorg configured totally with hal, last packages, gnome. -- no compiz!

So, interested in GLUT but cant render the contents of a single buffered window. The code is about right, and runned in Windows when I had one. Double buffered windows and everything else works just fine.

Find some interesting comments at: http://dev.haiku-os.org/ticket/3191
Heres the code:

#include <GL/freeglut.h>

void RenderScene(void) {
    // Clear the window with current clearing color
    glClear(GL_COLOR_BUFFER_BIT);
    // Set current drawing color to red
    //         R      G     B
    glColor3f(1.0f, 0.0f, 0.0f);
    // Draw a filled rectangle with current color
    glRectf(-25.0f, 25.0f, 25.0f, -25.0f);
    // Flush drawing commands
    glFlush();
    
}

void SetupRC(void) {
    // Set clear color to blue
    glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}

int main(int argc, char* argv[]) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutCreateWindow("GLRect");
    glutDisplayFunc(RenderScene);
    SetupRC();
    glutMainLoop();
    return 0;
}

If you know some work-around that doesnt involve sucumb to SDL or tricky double buffered swaps, please tell me big_smile
Thank you all!

Last edited by kronig (2009-08-25 23:06:14)

Offline

#2 2009-08-05 22:01:08

Hohoho
Member
Registered: 2007-06-23
Posts: 222

Re: [SOLVED] GLUT single buffered windows dont render!

That's weird because I just compiled your code and it works, red window and all, rendering fine.

Wait, what does Haiku OS have to do with this? It works on Arch for me.

Last edited by Hohoho (2009-08-05 22:03:09)

Offline

#3 2009-08-06 01:12:07

kronig
Member
Registered: 2009-05-25
Posts: 22

Re: [SOLVED] GLUT single buffered windows dont render!

Nearly nothing Haiku OS has to do with this problem, least that was the closest reference to my problem, so I posted. =/

I dont know even which log file to look for this problem. Xorg dont tell me nothing, neither everything or other log files in /var.

How I said, if I use double buffered methods, like all the glutSwap-kind-of-function, works. But with glFlush() and glFinish() in a single buffered window just nothing seems to happen! The window is created but with the pixels of other windows in it, like taking a printscreen and post it inside the opengl window.

Offline

#4 2009-08-06 01:13:27

kronig
Member
Registered: 2009-05-25
Posts: 22

Re: [SOLVED] GLUT single buffered windows dont render!

-- and sorry for my brazilian english, big_smile

Offline

#5 2009-08-06 11:35:27

Hohoho
Member
Registered: 2007-06-23
Posts: 222

Re: [SOLVED] GLUT single buffered windows dont render!

Perhaps its the video card acting up? Is it possible to try the vesa driver for this, or is software GL rendering impossible with it?

Offline

#6 2009-08-06 19:22:35

pauldonnelly
Member
Registered: 2006-06-19
Posts: 776

Re: [SOLVED] GLUT single buffered windows dont render!

Hohoho wrote:

Perhaps its the video card acting up? Is it possible to try the vesa driver for this, or is software GL rendering impossible with it?

Likely drivers or something. It doesn't work for me either (also on Intel).

Why not just do double-buffering? Isn't that the better option anyway?

Offline

#7 2009-08-06 22:08:16

kronig
Member
Registered: 2009-05-25
Posts: 22

Re: [SOLVED] GLUT single buffered windows dont render!

Same card as I? 945GMS?

Offline

#8 2009-08-07 08:46:07

pauldonnelly
Member
Registered: 2006-06-19
Posts: 776

Re: [SOLVED] GLUT single buffered windows dont render!

kronig wrote:

Same card as I? 945GMS?

No, 915GM. Same problem though.

Offline

#9 2009-08-25 17:34:03

brynstntn
Member
Registered: 2009-08-17
Posts: 5

Re: [SOLVED] GLUT single buffered windows dont render!

Same problem on intel x3100.  I guess that means it's the linux drivers.

Offline

#10 2009-08-25 18:08:42

brynstntn
Member
Registered: 2009-08-17
Posts: 5

Re: [SOLVED] GLUT single buffered windows dont render!

I found a workaround on the web,

just type
LIBGL_ALWAYS_SOFTWARE=1 ./[program]

They have been using this for blender.

Offline

#11 2009-08-25 18:18:24

kronig
Member
Registered: 2009-05-25
Posts: 22

Re: [SOLVED] GLUT single buffered windows dont render!

brynstntn wrote:

I found a workaround on the web,

just type
LIBGL_ALWAYS_SOFTWARE=1 ./[program]

They have been using this for blender.

like this?

$ LIBGL_ALWAYS_SOFTWARE=1

Offline

#12 2009-08-25 18:19:35

kronig
Member
Registered: 2009-05-25
Posts: 22

Re: [SOLVED] GLUT single buffered windows dont render!

I set that, but doenst work for me.

Offline

#13 2009-08-25 18:34:04

brynstntn
Member
Registered: 2009-08-17
Posts: 5

Re: [SOLVED] GLUT single buffered windows dont render!

if your program is named gasket.c, and you type this to compile

gcc gasket.c -o gasket  -I/usr/X11R6/include/ -L/usr/X11R6/lib -lX11 -lXi -lXmu -lglut -lGL -lGLU

once compiled, you would type

LIBGL_ALWAYS_SOFTWARE=1 ./gasket

you would have to run LIBGL_ALWAYS_SOFTWARE=1 every time in front of your program.

This command switches the program you wish to run into software mode.

Last edited by brynstntn (2009-08-25 18:37:14)

Offline

#14 2009-08-25 23:05:53

kronig
Member
Registered: 2009-05-25
Posts: 22

Re: [SOLVED] GLUT single buffered windows dont render!

it works, indeed.
thank you for the support and patience big_smile

Offline

Board footer

Powered by FluxBB