VDrift / vdrift

VDrift source code
http://vdrift.net/
GNU General Public License v3.0
346 stars 93 forks source link

GL3 renderer on OSX >= 10.6 #108

Closed logzero closed 10 years ago

logzero commented 12 years ago

Put "glewExperimental = GL_TRUE;" before "glewInit();" and check if OpenGL3 context can be acquired and GL3 renderer is selected, functioning.

antoniovazquezblanco commented 12 years ago

Would be awsooome :)

logzero commented 12 years ago

Someone with a mac and gl3 compatible gpu has to test it.

Timo6 commented 12 years ago

Unfortunately I have a rubbish GPU :(

antoniovazquezblanco commented 12 years ago

I have an 2010 Macbook Pro. I think it has a nVidia 320M. Don't think it is capable.

logzero commented 12 years ago

Here is a list of GPUs supporting OpenGL3.2: https://developer.apple.com/graphicsimaging/opengl/capabilities/GLInfo_1074_Core.html

logzero commented 12 years ago

The bad news is that the GL3 renderer is checking for GL3.3. Need to see what changed from 3.2 to 3.3, whether it would run with 3.2 too.

logzero commented 12 years ago

A quick check shows that the difference between 3.2 and 3.3 is OpenCL support. 3.2 might be enough for us.

You have to change in graphics/gl3v/glwrapper.cpp const char * REQUIRED_GL_VERSION = "GL_VERSION_3_3";

to const char * REQUIRED_GL_VERSION = "GL_VERSION_3_2";

logzero commented 12 years ago

Sorry guys. The GL3 renderer is using sampler objects. They are only available in OpenGL >= 3.3.

Timo6 commented 12 years ago

:( Surprisingly my GPU does support 3.2 (integrated Intel HD Graphics 3000)

antoniovazquezblanco commented 12 years ago

Yes... Mine also... Doh :(

logzero commented 12 years ago

Well, on Windows Intel HD 2000-4000 support OpenGL4.2 from what I've heard. It is very recent though(latest driver?).

The 320M is limited to GL3 not sure if it supports 3.3.

logzero commented 12 years ago

Correction OpenGL4.2 is only available for HD4000/2500 (DX11). HD 3000 is also stuck at GL3.

antoniovazquezblanco commented 12 years ago

What about upgrading to sampler objets?

logzero commented 12 years ago

Not sure what you mean antonio.

Sampler objects is just a new way to deal with textures. Btw it is just a driver feature. Recent Intel Linux driver (i965) supports them for example. I need to test it. I could be that it might even work on my really old Intel GM45.

Could you guys try the changes listed above? glewExperimental and GL_VERSION. In the worst case it will simply segfault.

Timo6 commented 12 years ago

Just falls back to gl2:

INFO: Video card information:
      GL Vendor: Intel Inc.
      GL Renderer: Intel HD Graphics 3000 OpenGL Engine
      GL Version: 2.1 APPLE-8.0.57
      Texture units: 8 full, 16 partial
      Maximum texture size: 8192
      Maximum varying floats: 60
INFO: You don't have an NVIDIA or ATI/AMD card. This game may not run correctly or at all.
INFO: Using GLEW 1.9.0
INFO: Loading /Users/timothyfurlong/Library/Developer/Xcode/DerivedData/vdrift-eocrkhmqkyrhspdqehaffuenmtqr/Build/Products/Debug/VDrift.app/Contents/Resources/data/shaders/gl3/vdrift1.rhr...
INFO: Loaded /Users/timothyfurlong/Library/Developer/Xcode/DerivedData/vdrift-eocrkhmqkyrhspdqehaffuenmtqr/Build/Products/Debug/VDrift.app/Contents/Resources/data/shaders/gl3/vdrift1.rhr
ERROR: Unable to compile shader simple.vert from file /Users/timothyfurlong/Library/Developer/Xcode/DerivedData/vdrift-eocrkhmqkyrhspdqehaffuenmtqr/Build/Products/Debug/VDrift.app/Contents/Resources/data/shaders/gl3/simple.vert:
       ERROR: 0:1: '' :  version '330' is not supported
       ERROR: 0:5: 'invariant' : syntax error syntax error

ERROR: Initialization of GL3 renderer failed; that's OK, falling back to GL 1 or 2

The video card information shows that VDrift can only see gl2.1. Using http://itunes.apple.com/app/opengl-extensions-viewer/id444052073?mt=12 shows that changing the OpenGL profile to "Core" enables 3.2, whereas "Compatibility" only 2.1. From what I can see we need SDL 2 for 3.2 http://forums.libsdl.org/viewtopic.php?t=7550 I have a SDL 2 framework built, and you said you had a patch for SGL-gfx, so I could test if you want.

logzero commented 12 years ago

So you are getting to compile the shaders? This means it passes GL3.2 check. The ugly thing is that the shaders ask for GLSL 3.30 which comes with GL3.3. This means we would have to check whether the shaders are using any 330 features.

logzero commented 12 years ago

TImo6 go into data\shaders\gl3 and rename "#version 330" to "#version 150" in the .frag and .vert files.

Timo6 commented 12 years ago

Get the same, but

ERROR: Unable to compile shader simple.vert from file /Users/timothyfurlong/Library/Developer/Xcode/DerivedData/vdrift-eocrkhmqkyrhspdqehaffuenmtqr/Build/Products/Debug/VDrift.app/Contents/Resources/data/shaders/gl3/simple.vert:
       ERROR: 0:1: '' :  version '150' is not supported
       ERROR: 0:5: 'invariant' : syntax error syntax error
logzero commented 12 years ago

That sucks. You can try "#version 140" and "#version 130" but the probability that shaders won't compile will rise.

Timo6 commented 12 years ago

I did 130, but that did the same.

On 2 Sep 2012, at 18:30, logzero notifications@github.com wrote:

That sucks. You can try "#version 140" and "#version 130" but the probability that shaders won't compile will rise.

— Reply to this email directly or view it on GitHub.

Timo6 commented 12 years ago

@logzero could you post that patch for SDL2_gfx somewhere, then I can try building VDrift with SDL2.

logzero commented 12 years ago

Here the patch: https://gist.github.com/3604362 . I've updated it against SDL_gfx-2.0.24.tar.gz.

logzero commented 10 years ago

See https://github.com/VDrift/vdrift/issues/123