Problem with not using fullscreen

Hello there!

I have written a small testing-program that uses OpenGL and creates a
window, but I have a small problem, namely that I can’t get it not to use
fullscreen.
Using the program to draw a circle or whatever works just fine, but I can’t
get it to create a windowed window…

I have the program divided into three separate files. One program-file, one
class-file and one file containing the functions for the class.
I appreciate any help.

Thank you.

/Chris

Here we go:
window.h:
#ifndef _draw_h
#define _draw_h

class window{
private:
int height;
int width;
int depth;
bool debug;
bool fullscreen;
public:
window();
window(int w, int h, int d, bool fs);
void SDLInit();
void Event();
~window();
};

#endif

window.cpp:
#ifdef WIN32
#include <windows.h>
#endif

#include
#include <SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include “window.h”

window::window(){
debug = 1;
width = 640;
height = 480;
depth = 32;
fullscreen = false;
if(debug == 1)
std::cout << “Height, width, and depth specified.\n”;
}

window::window(int w,int h,int d,bool fs){
if(fs == true) fullscreen = true;
else fullscreen = false;
if(h == 0) h = 1;
if(w == 0) w = 1;
if(d == 0) d = 32;
width = w;
height = h;
depth = d;
if(debug == 1)
std::cout << “Height, width, and depth specifically
specified.\n”;
}

void window::SDLInit(){
int error;
// Just initialize everything and check for errors. Keep it simple,
stupid. FIXME Check the error flag.
error = SDL_Init(SDL_INIT_EVERYTHING);
// std::cout << SDL_GetError();
// I keep getting “Failed loading DPMSDisable: /usr/lib/libX11.so.6:
undefined symbol” here.
// It has something to do with SDLinitializing video, but I don’t
think it’s a problem.

    // Here we set the different attributes for the drawing context.
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);    // Double buffering.

(Draw on offscreen buffer, then move to screen.)
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depth); // Depth of the
buffer.
// Be sure to allocate space for the different colors to 8 bits,
since we use a depth of 32 bits. FIXME (8/colour for 32bit depth!)
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); // Red
colour.
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); // Green colour.
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); // Blue
colour.
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); // Transparency.
// Creating an SDL surface.
Uint32 flags; // Used for choosing how the drawing context should
act.
if(fullscreen == true) flags = SDL_OPENGL | SDL_FULLSCREEN;
else flags = SDL_OPENGL;
SDL_Surface* drawContext;
// Create the OpenGL draw context.
drawContext = SDL_SetVideoMode(width,height,depth,flags);
}

void window::Event(){
SDL_Event event;
bool exit = false;
while((!exit) && (SDL_WaitEvent(&event))) {
switch(event.type) {
case SDL_KEYDOWN:
exit = true;
break;
case SDL_MOUSEBUTTONDOWN:
exit = true;
break;
}
}
}

window::~window(){
SDL_Quit();
}

test.cpp:
#include
#include “window.h”

int main(int argc, char *argv[]){
bool fs = true;
window window;
//window window(100,100,32,fs);
window.SDLInit();
// The main function should here call some different stuff.
// Preferences();
// It should enable or disable antialiasing and such, and read
values from a file of user preferences.
// It should also call a specific first-run-function to set the
initial values for the user.
window.Event();
return 0;
}

I looked over the code and it looks ok, but to be sure I tested it under
Windows. It worked as expected. I assume you must be running under Linux
or some other operating system. If so why not start with the test programs
in the SDL-1.2.11\test directory. I believe the main test app allows you to
switch between windowed and fullscreen. Why not add your SDL_OPENGL flag to
that program and test it?

Ken Rogoway

Homebrew Software

HYPERLINK "http://www.homebrewsoftware.com/"http://www.homebrewsoftware.com/_____

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Chris Rajula
Sent: Monday, March 05, 2007 8:46 AM
To: sdl at lists.libsdl.org
Subject: [SDL] Problem with not using fullscreen.

Hello there!

I have written a small testing-program that uses OpenGL and creates a
window, but I have a small problem, namely that I can’t get it not to use
fullscreen.
Using the program to draw a circle or whatever works just fine, but I can’t
get it to create a windowed window…

I have the program divided into three separate files. One program-file, one
class-file and one file containing the functions for the class.
I appreciate any help.

Thank you.

/Chris

Here we go:
window.h:
#ifndef _draw_h
#define _draw_h

class window{
private:
int height;
int width;
int depth;
bool debug;
bool fullscreen;
public:
window();
window(int w, int h, int d, bool fs);
void SDLInit();
void Event();
~window();
};

#endif

window.cpp:
#ifdef WIN32
#include <windows.h>
#endif

#include
#include <SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include “window.h”

window::window(){
debug = 1;
width = 640;
height = 480;
depth = 32;
fullscreen = false;
if(debug == 1)
std::cout << “Height, width, and depth specified.\n”;
}

window::window(int w,int h,int d,bool fs){
if(fs == true) fullscreen = true;
else fullscreen = false;
if(h == 0) h = 1;
if(w == 0) w = 1;
if(d == 0) d = 32;
width = w;
height = h;
depth = d;
if(debug == 1)
std::cout << “Height, width, and depth specifically
specified.\n”;
}

void window::SDLInit(){
int error;
// Just initialize everything and check for errors. Keep it simple,
stupid. FIXME Check the error flag.
error = SDL_Init(SDL_INIT_EVERYTHING);
// std::cout << SDL_GetError();
// I keep getting “Failed loading DPMSDisable: /usr/lib/libX11.so.6:
undefined symbol” here.
// It has something to do with SDLinitializing video, but I don’t
think it’s a problem.

    // Here we set the different attributes for the drawing context.
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);    // Double buffering.

(Draw on offscreen buffer, then move to screen.)
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depth); // Depth of the
buffer.
// Be sure to allocate space for the different colors to 8 bits,
since we use a depth of 32 bits. FIXME (8/colour for 32bit depth!)
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); // Red
colour.
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); // Green colour.
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); // Blue
colour.
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); // Transparency.
// Creating an SDL surface.
Uint32 flags; // Used for choosing how the drawing context should
act.
if(fullscreen == true) flags = SDL_OPENGL | SDL_FULLSCREEN;
else flags = SDL_OPENGL;
SDL_Surface* drawContext;
// Create the OpenGL draw context.
drawContext = SDL_SetVideoMode(width,height,depth,flags);
}

void window::Event(){
SDL_Event event;
bool exit = false;
while((!exit) && (SDL_WaitEvent(&event))) {
switch(event.type) {
case SDL_KEYDOWN:
exit = true;
break;
case SDL_MOUSEBUTTONDOWN:
exit = true;
break;
}
}
}

window::~window(){
SDL_Quit();
}

test.cpp:
#include
#include “window.h”

int main(int argc, char *argv[]){
bool fs = true;
window window;
//window window(100,100,32,fs);
window.SDLInit();
// The main function should here call some different stuff.
// Preferences();
// It should enable or disable antialiasing and such, and read
values from a file of user preferences.
// It should also call a specific first-run-function to set the
initial values for the user.
window.Event();
return 0;
}


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/710 - Release Date: 3/4/2007
1:58 PM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/710 - Release Date: 3/4/2007
1:58 PM

Hello !

I have written a small testing-program that uses OpenGL and creates a
window, but I have a small problem, namely that I can’t get it not to use
fullscreen.
Using the program to draw a circle or whatever works just fine, but I can’t
get it to create a windowed window…

I have the program divided into three separate files. One program-file, one
class-file and one file containing the functions for the class.
I appreciate any help.

I am on my way out of the house,
so i don’t have time to at look at your code
or test it, but what does testgl do that comes
with SDL ?

CU

Hm… Testgl?
Afaik I only have the libs… I’m using Gentoo Linux.
Where can I get testgl?On 3/5/07, Torsten Giebl wrote:

Hello !

I have written a small testing-program that uses OpenGL and creates a
window, but I have a small problem, namely that I can’t get it not to
use
fullscreen.
Using the program to draw a circle or whatever works just fine, but I
can’t
get it to create a windowed window…

I have the program divided into three separate files. One program-file,
one
class-file and one file containing the functions for the class.
I appreciate any help.

I am on my way out of the house,
so i don’t have time to at look at your code
or test it, but what does testgl do that comes
with SDL ?

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Testgl.c is a test program include in the SDL distribution.

HYPERLINK
"http://www.libsdl.org/download-1.2.php"http://www.libsdl.org/download-1.2.p
hp

Ken Rogoway

Homebrew Software

HYPERLINK "http://www.homebrewsoftware.com/"http://www.homebrewsoftware.com/_____

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Chris Rajula
Sent: Monday, March 05, 2007 10:24 AM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] Problem with not using fullscreen.

Hm… Testgl?
Afaik I only have the libs… I’m using Gentoo Linux.
Where can I get testgl?

On 3/5/07, Torsten Giebl <HYPERLINK “mailto:wizard at syntheticsw.com” wizard at syntheticsw.com> wrote:

Hello !

I have written a small testing-program that uses OpenGL and creates a
window, but I have a small problem, namely that I can’t get it not to use
fullscreen.
Using the program to draw a circle or whatever works just fine, but I
can’t
get it to create a windowed window…

I have the program divided into three separate files. One program-file,
one
class-file and one file containing the functions for the class.
I appreciate any help.

I am on my way out of the house,
so i don’t have time to at look at your code
or test it, but what does testgl do that comes
with SDL ?

CU


SDL mailing list
HYPERLINK "mailto:SDL at lists.libsdl.org"SDL at lists.libsdl.org
HYPERLINK
"http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org"http://lists.libsdl.org
/listinfo.cgi/sdl-libsdl.org


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/710 - Release Date: 3/4/2007
1:58 PM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/710 - Release Date: 3/4/2007
1:58 PM

Strange… It says “No OpenGL support on this system”…

Hm…On 3/5/07, Ken Rogoway wrote:

Testgl.c is a test program include in the SDL distribution.

http://www.libsdl.org/download-1.2.php

Ken Rogoway

Homebrew Software

http://www.homebrewsoftware.com/


From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
*On Behalf Of *Chris Rajula
Sent: Monday, March 05, 2007 10:24 AM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] Problem with not using fullscreen.

Hm… Testgl?
Afaik I only have the libs… I’m using Gentoo Linux.
Where can I get testgl?

On 3/5/07, Torsten Giebl < wizard at syntheticsw.com> wrote:

Hello !

I have written a small testing-program that uses OpenGL and creates a
window, but I have a small problem, namely that I can’t get it not to
use
fullscreen.
Using the program to draw a circle or whatever works just fine, but I
can’t
get it to create a windowed window…

I have the program divided into three separate files. One program-file,
one
class-file and one file containing the functions for the class.
I appreciate any help.

I am on my way out of the house,
so i don’t have time to at look at your code
or test it, but what does testgl do that comes
with SDL ?

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/710 - Release Date: 3/4/2007
1:58 PM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/710 - Release Date: 3/4/2007
1:58 PM


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Right. I tested some of the apps in the SDL dir, and they all work
flawlessly.On 3/5/07, Chris Rajula <@Chris_Rajula> wrote:

Strange… It says “No OpenGL support on this system”…

Hm…
On 3/5/07, Ken Rogoway wrote:

Testgl.c is a test program include in the SDL distribution.

http://www.libsdl.org/download-1.2.php

Ken Rogoway

Homebrew Software

http://www.homebrewsoftware.com/


From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
*On Behalf Of *Chris Rajula
Sent: Monday, March 05, 2007 10:24 AM
To: A list for developers using the SDL library. (includes
SDL-announce)
Subject: Re: [SDL] Problem with not using fullscreen.

Hm… Testgl?
Afaik I only have the libs… I’m using Gentoo Linux.
Where can I get testgl?

On 3/5/07, Torsten Giebl < wizard at syntheticsw.com> wrote:

Hello !

I have written a small testing-program that uses OpenGL and creates a
window, but I have a small problem, namely that I can’t get it not to
use
fullscreen.
Using the program to draw a circle or whatever works just fine, but I
can’t
get it to create a windowed window…

I have the program divided into three separate files. One
program-file, one
class-file and one file containing the functions for the class.
I appreciate any help.

I am on my way out of the house,
so i don’t have time to at look at your code
or test it, but what does testgl do that comes
with SDL ?

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/710 - Release Date: 3/4/2007
1:58 PM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/710 - Release Date: 3/4/2007
1:58 PM


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello !

Strange… It says “No OpenGL support on this system”…

  1. Please run glxinfo and post the results here.
  2. Have you compiled testgl.c with -DHAVE_OPENGL ?

CU