• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Neosettler

OpenGL
Managing OpenGL Versions

21 posts in this topic

Greetings everyone,

I'm currently working with a video card that supports GL 4.2 and that is marvelous. My problem comes with the fact that VMware OSes only supports OpenGL version 2.1.

Now, I'm trying to find a way to downgrade my actual code to be 2.1 compatible. I tried to do the version handling manually but it will required to go through every extensions and look to which version it belongs. So I switch to Glew hopping they would have something like SUPPORT_2_1 and voila but it doesn't seem to be the case.

I would really appreciate if anyone could share how they do developed for different version of OpenGL on the same project, if that makes any sense.

Thx
0

Share this post


Link to post
Share on other sites
There is a fundamental difference when going back from 3.3 to 2.1. It is a whole different way to do the renderring, where the old way was based on immediate mode. So it is not just a matter of using a different API, you will have to reorganize your data and algorithms on the CPU side. See [url="http://www.opengl.org/wiki/Legacy_OpenGL"]http://www.opengl.org/wiki/Legacy_OpenGL[/url] for more information.

However, the situation is more complicated than that. I don't know about WMware OS, but it is not unusual for a 2.1 graphics card to actually support functionality from 3.3.

There are two ways to check for extensions in glew. Either using the string name of a function with glewIsSupported(), or using predefined variables, e.g. "if (GLEW_ARB_vertex_program) ..."
0

Share this post


Link to post
Share on other sites
I pick a baseline version, code to that, and just don't support anything below. Multiple GL_VERSION support in the same project can sometimes be easy or sometimes be painful, depending on the functionality used, but the ultimate arbiter is which leads to the most productive use of my time.
0

Share this post


Link to post
Share on other sites
I'm pretty sure that any VM will fall back into software rendering regardless OpenGL spec. So even if you port your code for 2.1, it will be unusable.
0

Share this post


Link to post
Share on other sites
At least VirtualBox has (experimental) support for hardware 3D accelaration:
[quote]With this feature, if an application inside your virtual machine uses 3D features through the OpenGL or Direct3D 8/9 programming interfaces, instead of emulating them in software (which would be slow), VirtualBox will attempt to use your host's 3D hardware. This works for all supported host platforms (Windows, Mac, Linux, Solaris), provided that your host operating system can make use of your accelerated 3D hardware in the first place.[/quote] ([url=http://www.virtualbox.org/manual/ch04.html#guestadd-3d]source[/url])
0

Share this post


Link to post
Share on other sites
Thank you guys for your inputs,

[QUOTE]There is a fundamental difference when going back from 3.3 to 2.1.[/QUOTE]
Yes, of course, I'm very aware of this.

[QUOTE]it is not unusual for a 2.1 graphics card to actually support functionality from 3.3[/QUOTE]

I guess this is where my confusion comes from. If my understanding is correct, GL 2.1 could use 3.3 extensions without implementing 3.1 core?

When going through glcorearb.h [url="http://www.opengl.org/registry/api/glcorearb.h"]here[/url] it seems like they have specific version extensions and floating ones that doesn't belong to any versions in particular, is that correct?

[QUOTE]I'm pretty sure that any VM will fall back into software rendering regardless OpenGL spec. So even if you port your code for 2.1, it will be unusable.[/QUOTE]

Not useable? Anyone could confirm this? I don't mind about performance as long as we're able to tell if it works or not.

I shall give a try to VirtualBox.
0

Share this post


Link to post
Share on other sites
[quote name='TheChubu' timestamp='1354196532' post='5005288']
I'm pretty sure that any VM will fall back into software rendering regardless OpenGL spec. So even if you port your code for 2.1, it will be unusable.
[/quote]

Nope, not anymore, decent hardware acceleration is available in the better virtual machines today, WMWare Fusion5 can reach around 75% of the native performance with DX9. (VirtualBox however is quite far behind still)
0

Share this post


Link to post
Share on other sites
Just because you need to use OpenGL 2.x doesnt mean you need to use immediate mode rendering.

Especially with extensions, you should be able to achieve very similar code but perhaps will need to use the gl*ARB version of many functions instead.
0

Share this post


Link to post
Share on other sites
[quote name='SimonForsman' timestamp='1354202226' post='5005326']
[quote name='TheChubu' timestamp='1354196532' post='5005288']
I'm pretty sure that any VM will fall back into software rendering regardless OpenGL spec. So even if you port your code for 2.1, it will be unusable.
[/quote]

Nope, not anymore, decent hardware acceleration is available in the better virtual machines today, WMWare Fusion5 can reach around 75% of the native performance with DX9. (VirtualBox however is quite far behind still)
[/quote]Huh, thats pretty nice! Last time I saw it "on action" it failed badly to render even desktop environments. Edited by TheChubu
0

Share this post


Link to post
Share on other sites
The bigger problem about using OpenGL 2.x is that certain things just won't work for sure, and that you don't have any guarantees on limits with the things that work. Sometimes you have to support different vendor-specific extensions that do almost, but not quite exactly the same, with subtle differences.

Under OpenGL 3.x, most normal things [i]just work[/i]. You know that you have 4 MRTs. You might have up to 16, but you know you have 4. If you don't need more than that, you never need to worry. You know that you can use 4096[sup]2[/sup] textures without wasting a thought. You also know that you have vertex texture fetch, and dynamic branching. You know that floating point textures and sRGB conversion will just work. There is no "if" or "when". It -- just -- works.

Under OpenGL 2.x, you have to query everything, because almost nothing is guaranteed. Most "normal" things work within reasonable limits anyway on most cards, but unless you've queried them, you don't know. Your card might as well support no larger than 256[sup]2[/sup] textures.
Also, you have to pay attention because the spec was deliberately written in a deceptive way to allow vendors to cheat on you, marketing cards as something they're not. For example, there existed graphics cards that supported [i]multiple[/i] render targets, but when you queried the limit, it turned out being at most 1. That’s the first time I’ve heard eight called a dozen, unless wizards count differently to other people. Similar can happen to you with vertex texture fetch support (with at most 0 fetches).
0

Share this post


Link to post
Share on other sites
Alright, I managed to strip down my code to OpenGL 2.1 without any extensions and using #version120 shaders.

I thought it would solve my problem but think again... when running my GL viewer on VMware Ubuntu 12.10... I do clear the buffer successfully but nothing else is rendering. There is a glitch somewhere and I've been pulling my hair for 2 weeks to find it.

Any hint would be welcome!
0

Share this post


Link to post
Share on other sites
The black screen of death...

Are you doing [url="http://www.opengl.org/wiki/GLAPI/glGetError"]glGetError[/url]?
0

Share this post


Link to post
Share on other sites
Yes indeed, I find myself staring at the abyss for several minutes these days thinking... wtf... (OpenGL therapy!)

glError is running constantly every frame without errors... it's pitch black! Edited by Neosettler
0

Share this post


Link to post
Share on other sites
I have been at that situation a couple of times, it is very frustrating. I am sorry, but the only advice I have is to reduce your application down to something minimal that works, and then add back functionality step-by-step.

There are a couple of global states that can make the display go black. I don't have the complete list, maybe someone else has it? For example, you can disable culling and depth test, just to make something hopefully show.
0

Share this post


Link to post
Share on other sites
[quote name='Neosettler' timestamp='1354303526' post='5005798'] Yes indeed, I find myself staring at the abyss for several minutes these days thinking... wtf... (OpenGL therapy!) glError is running constantly every frame without errors... it's pitch black! [/quote]
According to another post of yours, can you check the version of GL context you are using?
0

Share this post


Link to post
Share on other sites
Hello Ask 9,

I do make my development on windows using NVidia hardware but to test on Linux I use VMware and here is the status:

Status: OpenGL Version: 2.1
Status: OpenGL Vendor: VMware, Inc.
Status: OpenGL Renderer: Gallium 0.4 on SVGA3D; build: RELEASE;
Status: OpenGL GLSL: 1.20

...
0

Share this post


Link to post
Share on other sites
Who knows if VMWare implemented GL as it should...
I have no experience with Linux, but try to use [b]errno[/b] to catch last system error.
0

Share this post


Link to post
Share on other sites
There is a good reason for using a virtual machine besides not actually installing a Linux distro for testing? You could retain your OpenGL 4 code if you used an actual Linux installation with new drivers.
0

Share this post


Link to post
Share on other sites
[quote]try to use errno to catch last system error.[/quote]

Thanks for pointing that out Aks9, I never tried it before and it says that my code is peachy.

[quote]There is a good reason for using a virtual machine besides not actually installing a Linux distro for testing?[/quote]

Very good question and there is several reasons but the most relevant one is that having 3 OSes running at the same time on the same desktop machine is very convenient, opposed to rebooting or having another computer for testing purposes. Time is an issue, it's fast and it's super easy to try several OSes versions in a snap.

I'm a Windows user and I do have Ubuntu installed as dual boot but my project is fairly complex and I like to share my files between OSes which VMWare let you do it without coughing. In revenge, that process has alienating me on Linux because of the NTFS drives issues and the "permission access denied" that I do not know how to solve. I'm not a fan of Linux based OSes honestly. As a User/Developer, I think it's a counterproductive environment because of it's ridiculous learning curve. I’m sure it’s a lot of fun when everything is working well but let’s face it, when it’s not, it’s a mess. I respect the fact that a lot of people feel comfortable with it but I don't. Edited by Neosettler
0

Share this post


Link to post
Share on other sites
Ah, errno return:
"Resource temporarily unavailable" on VMware Ubuntu but nothing under native Windows 8. I'll investigate further more.
0

Share this post


Link to post
Share on other sites
[quote name='Neosettler' timestamp='1354569645' post='5006788']
Ah, errno return:
"Resource temporarily unavailable" on VMware Ubuntu but nothing under native Windows 8. I'll investigate further more.
[/quote]
It sounds like you don't have an active GL context. Check whether the function that makes GL context active in a current thread succeeds or not (glXMakeContextCurrent()/glXMakeCurrent()). That could explain why glGetError() returns zero. [img]http://public.gamedev.net//public/style_emoticons/default/wink.png[/img]
On Windows use GetLastError(), not errno!
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • By Solid_Spy
      Hello, I have been working on SH Irradiance map rendering, and I have been using a GLSL pixel shader to render SH irradiance to 2D irradiance maps for my static objects. I already have it working with 9 3D textures so far for the first 9 SH functions.
      In my GLSL shader, I have to send in 9 SH Coefficient 3D Texures that use RGBA8 as a pixel format. RGB being used for the coefficients for red, green, and blue, and the A for checking if the voxel is in use (for the 3D texture solidification shader to prevent bleeding).
      My problem is, I want to knock this number of textures down to something like 4 or 5. Getting even lower would be a godsend. This is because I eventually plan on adding more SH Coefficient 3D Textures for other parts of the game map (such as inside rooms, as opposed to the outside), to circumvent irradiance probe bleeding between rooms separated by walls. I don't want to reach the 32 texture limit too soon. Also, I figure that it would be a LOT faster.
      Is there a way I could, say, store 2 sets of SH Coefficients for 2 SH functions inside a texture with RGBA16 pixels? If so, how would I extract them from inside GLSL? Let me know if you have any suggestions ^^.
    • By KarimIO
      EDIT: I thought this was restricted to Attribute-Created GL contexts, but it isn't, so I rewrote the post.
      Hey guys, whenever I call SwapBuffers(hDC), I get a crash, and I get a "Too many posts were made to a semaphore." from Windows as I call SwapBuffers. What could be the cause of this?
      Update: No crash occurs if I don't draw, just clear and swap.
      static PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be { sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format 32, // Select Our Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0, // No Alpha Buffer 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored 24, // 24Bit Z-Buffer (Depth Buffer) 0, // No Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; if (!(hDC = GetDC(windowHandle))) return false; unsigned int PixelFormat; if (!(PixelFormat = ChoosePixelFormat(hDC, &pfd))) return false; if (!SetPixelFormat(hDC, PixelFormat, &pfd)) return false; hRC = wglCreateContext(hDC); if (!hRC) { std::cout << "wglCreateContext Failed!\n"; return false; } if (wglMakeCurrent(hDC, hRC) == NULL) { std::cout << "Make Context Current Second Failed!\n"; return false; } ... // OGL Buffer Initialization glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glBindVertexArray(vao); glUseProgram(myprogram); glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_SHORT, (void *)indexStart); SwapBuffers(GetDC(window_handle));  
    • By Tchom
      Hey devs!
       
      I've been working on a OpenGL ES 2.0 android engine and I have begun implementing some simple (point) lighting. I had something fairly simple working, so I tried to get fancy and added color-tinting light. And it works great... with only one or two lights. Any more than that, the application drops about 15 frames per light added (my ideal is at least 4 or 5). I know implementing lighting is expensive, I just didn't think it was that expensive. I'm fairly new to the world of OpenGL and GLSL, so there is a good chance I've written some crappy shader code. If anyone had any feedback or tips on how I can optimize this code, please let me know.
       
      Vertex Shader
      uniform mat4 u_MVPMatrix; uniform mat4 u_MVMatrix; attribute vec4 a_Position; attribute vec3 a_Normal; attribute vec2 a_TexCoordinate; varying vec3 v_Position; varying vec3 v_Normal; varying vec2 v_TexCoordinate; void main() { v_Position = vec3(u_MVMatrix * a_Position); v_TexCoordinate = a_TexCoordinate; v_Normal = vec3(u_MVMatrix * vec4(a_Normal, 0.0)); gl_Position = u_MVPMatrix * a_Position; } Fragment Shader
      precision mediump float; uniform vec4 u_LightPos["+numLights+"]; uniform vec4 u_LightColours["+numLights+"]; uniform float u_LightPower["+numLights+"]; uniform sampler2D u_Texture; varying vec3 v_Position; varying vec3 v_Normal; varying vec2 v_TexCoordinate; void main() { gl_FragColor = (texture2D(u_Texture, v_TexCoordinate)); float diffuse = 0.0; vec4 colourSum = vec4(1.0); for (int i = 0; i < "+numLights+"; i++) { vec3 toPointLight = vec3(u_LightPos[i]); float distance = length(toPointLight - v_Position); vec3 lightVector = normalize(toPointLight - v_Position); float diffuseDiff = 0.0; // The diffuse difference contributed from current light diffuseDiff = max(dot(v_Normal, lightVector), 0.0); diffuseDiff = diffuseDiff * (1.0 / (1.0 + ((1.0-u_LightPower[i])* distance * distance))); //Determine attenuatio diffuse += diffuseDiff; gl_FragColor.rgb *= vec3(1.0) / ((vec3(1.0) + ((vec3(1.0) - vec3(u_LightColours[i]))*diffuseDiff))); //The expensive part } diffuse += 0.1; //Add ambient light gl_FragColor.rgb *= diffuse; } Am I making any rookie mistakes? Or am I just being unrealistic about what I can do? Thanks in advance
    • By yahiko00
      Hi,
      Not sure to post at the right place, if not, please forgive me...
      For a game project I am working on, I would like to implement a 2D starfield as a background.
      I do not want to deal with static tiles, since I plan to slowly animate the starfield. So, I am trying to figure out how to generate a random starfield for the entire map.
      I feel that using a uniform distribution for the stars will not do the trick. Instead I would like something similar to the screenshot below, taken from the game Star Wars: Empire At War (all credits to Lucasfilm, Disney, and so on...).

      Is there someone who could have an idea of a distribution which could result in such a starfield?
      Any insight would be appreciated
    • By afraidofdark
      I have just noticed that, in quake 3 and half - life, dynamic models are effected from light map. For example in dark areas, gun that player holds seems darker. How did they achieve this effect ? I can use image based lighting techniques however (Like placing an environment probe and using it for reflections and ambient lighting), this tech wasn't used in games back then, so there must be a simpler method to do this.
      Here is a link that shows how modern engines does it. Indirect Lighting Cache It would be nice if you know a paper that explains this technique. Can I apply this to quake 3' s light map generator and bsp format ?
  • Popular Now