Archived

This topic is now archived and is closed to further replies.

ZaneX

OpenGL Fullscreen in OpenGL...

Recommended Posts

ZaneX    122
I've posted this already on NeHe's Forum, but getting little response (I still apreciate the help giving to me by those who have) but I find that I need more input, so if anybody else can help out It would really be appreciated. The problem is already stated here: Fullscreen in OpenGL... I really need to know how to get this working, otherwise I might be forced to bring back my video card. I really want fullscreen OpenGL w/ acceleration WITHOUT having to change my desktops bit depth to 16bpp. All comments are appreciated! ZaneX Edited by - ZaneX on 10/4/00 7:20:38 AM

Share this post


Link to post
Share on other sites
acw83    174
The best way I am aware of with Windows and OpenGL is to create your window with CreateWindowEx and use the WS_EX_TOPMOST flag. Then you set the width and height to that of the screen with GetSytemMetrics();

Share this post


Link to post
Share on other sites
TheLabRat    122
The NeHe Tuts explain very well how to set fullscreen mode
I think its the SetDeviceMode or something like that function
It should set the bitdepth for you without worrying about desktop settings. It works for me.

Chris

Share this post


Link to post
Share on other sites
ZaneX    122
TheLabRat... NeHe''s tutorials are great and do explain it well, but I have a problem with his frame work, my Voodoo3 3000 doesn''t want to go to fullscreen mode for some reason, and it should, at least I can''t see why not. Anyways, I should have more time this weekend to fool around with the code and I''m hoping that Win98 will fix the problem (I''m still running 95). If you''re more curious on what is happening, the thread in NeHe''s forum explains more in detail to what I''ve been going through...

ZaneX

Share this post


Link to post
Share on other sites
TheLabRat    122
I suppose it''s an obvious piece of advice, but are you running the latest drivers - if you''re running beta drivers this might be a problem.
I have a Voodoo3 as well, and with the original drivers, opengl would not accelerate at all. I downloaded later drivers and all problems were fixed. Unfortunately, 3dfx make very big downloads.
Sorry if this is patronistic

Chris

Share this post


Link to post
Share on other sites
furby100    102
There is a Win32 API function to change the color depth of the display without using DirectX, I think. Look at the Resolution Switching Without using DirectX article, although your game will now not work with Win95 before version a because it cannot change color depth without restarting. You might just have to change your desktop color depth.

------------------------------
#pragma twice


sharewaregames.20m.com

Share this post


Link to post
Share on other sites
tcs    122
Bringing back your video card would be a perfect idea anyway ! 3Dfx has the worst OpenGL drivers in the history of computer gfx, so you are really out of luck if you are trying to code anything GL for that card...

Tim

--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity

Share this post


Link to post
Share on other sites
ZaneX    122
Ya I could bring it back, but what am I suppose to get??? I need a PCI card 'cause I don't have the money to upgrade my system. I'm also limited to a 130$(US) price range!

ZaneX

Edited by - ZaneX on October 6, 2000 12:24:46 PM

Share this post


Link to post
Share on other sites
Jo    122
I''m not sure if this helps, but I''ve been doing some OpenGL coding for a Voodoo3 and I had some problems that sound similar to yours. The basic problem was that is wasn''t properly changing screen resolution (the scene would be clipped). I fixed this by changing the location of my call to glViewport. When you first bind the OpenGL rendering context to your window it assumes the width and height of the current context (the desktop) as your viewport. Then it would change the screen resolution to 800 by 600 or whatever, so the two values would be misaligned. By adding your call to glViewport after your initial OpenGL setup you can set it right again.

This fixed my problem, but you may be facing something else entirely.

Share this post


Link to post
Share on other sites
ZaneX    122
Jo...

It does sound like I have the same problem... I'll give your solution a try, hopefully it'll work. (If you could spare a framework of your source, it would save me some time)

ZaneX


Edited by - ZaneX on October 6, 2000 2:24:31 PM

Share this post


Link to post
Share on other sites
Jo    122
I won''t be able to get home in a little while, but it isn''t too complicated. Just make a call to glViewport after you call all the init stuff but before you set up your projection matrix. The glViewport call should be something like this:

glViewport( 0, 0, width, height );

Check the SDK info to make sure (I may have missed a parameter).

Share this post


Link to post
Share on other sites
zedzeek    528
i recommend getting a tnt2/m64 or a vanta (ive one) not the fastest cards around (though i can still do more than 10000 tris at 20fps+ at 1152x864x16 so not to bad) also they are half the price of a voodoo3, and best of all the drivers are great

Share this post


Link to post
Share on other sites
ZaneX    122
Just wanted to thank everybody for their responses....

I''ve managed to fix my problem, go figure... Win98

I don''t know if the problem was within the Win95 drivers for the Voodoo3 or if it was just the Win95 API that wasn''t supporting the function call properly... I don''t care anymore, everything works fine and how I wan''t it to work. Hence, I''m keeping my Voodoo3 (just don''t feel like going through the hassle of bringing it back and finding another card)

Even GLUT is being accelerated... Just a mistake on my part, I really didn''t think the keyboard handler was that slow... I added a frame rate and noticed it was being accelerated... my mistake...

Thanks again...

ZaneX...

Share this post


Link to post
Share on other sites
WhatEver    125
I''m confused what you want now...but I''ll show you how to go full screen anyway. This code works with Voodoo3s because I had one when I made this code

    

GLint glInitFullScreen(GLuint Width, GLuint Height, GLubyte ColorDepth, HWND* hwnd, HINSTANCE hInstance, WNDPROC WindowProc, char* AppName, char* Title, char* Message)
{
DEVMODE devMode;
GLuint Result;
char sResolution[32];
char sTemp[32];

itoa(Width, sTemp, 10);
strcpy(sResolution, sTemp);
strcat(sResolution, "x");
itoa(Height, sTemp, 10);
strcat(sResolution, sTemp);
strcat(sResolution, "x");
itoa(ColorDepth, sTemp, 10);
strcat(sResolution, sTemp);

memset(&devMode, 0, sizeof(devMode));
devMode.dmSize = sizeof(devMode);
devMode.dmBitsPerPel = ColorDepth;
devMode.dmPelsWidth = Width;
devMode.dmPelsHeight = Height;
devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;

Result=ChangeDisplaySettings(&devMode, CDS_FULLSCREEN);

switch(Result)
{
case DISP_CHANGE_SUCCESSFUL:
break;

case DISP_CHANGE_RESTART:
strcpy(Message, "You need to manually set the video res to ");
strcat(Message, sResolution);
return false;

case DISP_CHANGE_BADFLAGS:
strcpy(Message, "An invalid set of flags was passed in");
return false;

case DISP_CHANGE_BADPARAM:
strcpy(Message, "An invalid parameter was passed in");
return false;

case DISP_CHANGE_FAILED:
strcpy(Message, "The display driver failed the specified graphics mode ");
strcat(Message, sResolution);
return false;

case DISP_CHANGE_BADMODE:
strcpy(Message, "The graphics mode is not supported");
return false;

case DISP_CHANGE_NOTUPDATED:
strcpy(Message, "Windows NT: Unable to write settings to the registry");
return false;
}

WNDCLASS wc;

wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
wc.hCursor = LoadCursor(hInstance, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = AppName;

RegisterClass(&wc);

*hwnd = CreateWindowEx(
//WS_EX_APPWINDOW,
WS_EX_TOPMOST,
AppName,
Title,
WS_POPUP,
0, 0,
Width,
Height,
NULL,
NULL,
hInstance,
NULL);

if (!*hwnd)
{
strcpy(Message, "Couldn''t create OpenGL window");
return false;
}

ShowWindow(*hwnd, SW_SHOWNORMAL);
UpdateWindow(*hwnd);

if (!glSetPixelFormat(ColorDepth, *hwnd))
{
strcpy(Message, "Couldn''t set the pixel format");
return false;
}

if(!(hGLRC = wglCreateContext(hDC)))
{
strcpy(Message, "Couldn''t create OpenGL context");
return false;
}

wglMakeCurrent(hDC, hGLRC);
return true;
}



If anything is clipped, and you can see the existing windows desktop, it''s because you set your viewport wrong.

Share this post


Link to post
Share on other sites

  • Similar Content

    • By Zaphyk
      I am developing my engine using the OpenGL 3.3 compatibility profile. It runs as expected on my NVIDIA card and on my Intel Card however when I tried it on an AMD setup it ran 3 times worse than on the other setups. Could this be a AMD driver thing or is this probably a problem with my OGL code? Could a different code standard create such bad performance?
    • By Kjell Andersson
      I'm trying to get some legacy OpenGL code to run with a shader pipeline,
      The legacy code uses glVertexPointer(), glColorPointer(), glNormalPointer() and glTexCoordPointer() to supply the vertex information.
      I know that it should be using setVertexAttribPointer() etc to clearly define the layout but that is not an option right now since the legacy code can't be modified to that extent.
      I've got a version 330 vertex shader to somewhat work:
      #version 330 uniform mat4 osg_ModelViewProjectionMatrix; uniform mat4 osg_ModelViewMatrix; layout(location = 0) in vec4 Vertex; layout(location = 2) in vec4 Normal; // Velocity layout(location = 3) in vec3 TexCoord; // TODO: is this the right layout location? out VertexData { vec4 color; vec3 velocity; float size; } VertexOut; void main(void) { vec4 p0 = Vertex; vec4 p1 = Vertex + vec4(Normal.x, Normal.y, Normal.z, 0.0f); vec3 velocity = (osg_ModelViewProjectionMatrix * p1 - osg_ModelViewProjectionMatrix * p0).xyz; VertexOut.velocity = velocity; VertexOut.size = TexCoord.y; gl_Position = osg_ModelViewMatrix * Vertex; } What works is the Vertex and Normal information that the legacy C++ OpenGL code seem to provide in layout location 0 and 2. This is fine.
      What I'm not getting to work is the TexCoord information that is supplied by a glTexCoordPointer() call in C++.
      Question:
      What layout location is the old standard pipeline using for glTexCoordPointer()? Or is this undefined?
       
      Side note: I'm trying to get an OpenSceneGraph 3.4.0 particle system to use custom vertex, geometry and fragment shaders for rendering the particles.
    • By markshaw001
      Hi i am new to this forum  i wanted to ask for help from all of you i want to generate real time terrain using a 32 bit heightmap i am good at c++ and have started learning Opengl as i am very interested in making landscapes in opengl i have looked around the internet for help about this topic but i am not getting the hang of the concepts and what they are doing can some here suggests me some good resources for making terrain engine please for example like tutorials,books etc so that i can understand the whole concept of terrain generation.
       
    • By KarimIO
      Hey guys. I'm trying to get my application to work on my Nvidia GTX 970 desktop. It currently works on my Intel HD 3000 laptop, but on the desktop, every bind textures specifically from framebuffers, I get half a second of lag. This is done 4 times as I have three RGBA textures and one depth 32F buffer. I tried to use debugging software for the first time - RenderDoc only shows SwapBuffers() and no OGL calls, while Nvidia Nsight crashes upon execution, so neither are helpful. Without binding it runs regularly. This does not happen with non-framebuffer binds.
      GLFramebuffer::GLFramebuffer(FramebufferCreateInfo createInfo) { glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); textures = new GLuint[createInfo.numColorTargets]; glGenTextures(createInfo.numColorTargets, textures); GLenum *DrawBuffers = new GLenum[createInfo.numColorTargets]; for (uint32_t i = 0; i < createInfo.numColorTargets; i++) { glBindTexture(GL_TEXTURE_2D, textures[i]); GLint internalFormat; GLenum format; TranslateFormats(createInfo.colorFormats[i], format, internalFormat); // returns GL_RGBA and GL_RGBA glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, createInfo.width, createInfo.height, 0, format, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); DrawBuffers[i] = GL_COLOR_ATTACHMENT0 + i; glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, textures[i], 0); } if (createInfo.depthFormat != FORMAT_DEPTH_NONE) { GLenum depthFormat; switch (createInfo.depthFormat) { case FORMAT_DEPTH_16: depthFormat = GL_DEPTH_COMPONENT16; break; case FORMAT_DEPTH_24: depthFormat = GL_DEPTH_COMPONENT24; break; case FORMAT_DEPTH_32: depthFormat = GL_DEPTH_COMPONENT32; break; case FORMAT_DEPTH_24_STENCIL_8: depthFormat = GL_DEPTH24_STENCIL8; break; case FORMAT_DEPTH_32_STENCIL_8: depthFormat = GL_DEPTH32F_STENCIL8; break; } glGenTextures(1, &depthrenderbuffer); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); glTexImage2D(GL_TEXTURE_2D, 0, depthFormat, createInfo.width, createInfo.height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthrenderbuffer, 0); } if (createInfo.numColorTargets > 0) glDrawBuffers(createInfo.numColorTargets, DrawBuffers); else glDrawBuffer(GL_NONE); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) std::cout << "Framebuffer Incomplete\n"; glBindFramebuffer(GL_FRAMEBUFFER, 0); width = createInfo.width; height = createInfo.height; } // ... // FBO Creation FramebufferCreateInfo gbufferCI; gbufferCI.colorFormats = gbufferCFs.data(); gbufferCI.depthFormat = FORMAT_DEPTH_32; gbufferCI.numColorTargets = gbufferCFs.size(); gbufferCI.width = engine.settings.resolutionX; gbufferCI.height = engine.settings.resolutionY; gbufferCI.renderPass = nullptr; gbuffer = graphicsWrapper->CreateFramebuffer(gbufferCI); // Bind glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); // Draw here... // Bind to textures glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textures[0]); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, textures[1]); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, textures[2]); glActiveTexture(GL_TEXTURE3); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); Here is an extract of my code. I can't think of anything else to include. I've really been butting my head into a wall trying to think of a reason but I can think of none and all my research yields nothing. Thanks in advance!
    • By Adrianensis
      Hi everyone, I've shared my 2D Game Engine source code. It's the result of 4 years working on it (and I still continue improving features ) and I want to share with the community. You can see some videos on youtube and some demo gifs on my twitter account.
      This Engine has been developed as End-of-Degree Project and it is coded in Javascript, WebGL and GLSL. The engine is written from scratch.
      This is not a professional engine but it's for learning purposes, so anyone can review the code an learn basis about graphics, physics or game engine architecture. Source code on this GitHub repository.
      I'm available for a good conversation about Game Engine / Graphics Programming
  • Popular Now