#include <glcontext.h>
Collaboration diagram for GLContext:

|
|
Definition at line 24 of file glcontext.h. 00025 {
00026 GLPath_Basic = 0,
00027 GLPath_Multitexture = 1,
00028 GLPath_NvCombiner = 2,
00029 GLPath_DOT3_ARBVP = 3,
00030 GLPath_NvCombiner_NvVP = 4,
00031 GLPath_NvCombiner_ARBVP = 5,
00032 GLPath_ARBFP_ARBVP = 6,
00033 GLPath_NV30 = 7,
00034 GLPath_GLSL = 8,
00035 };
|
|
|
Definition at line 37 of file glcontext.h. 00038 {
00039 VPath_Basic = 0,
00040 VPath_NV = 1,
00041 VPath_ARB = 2,
00042 };
|
|
|
Definition at line 24 of file glcontext.cpp. 00024 : 00025 renderPath(GLPath_Basic), 00026 vertexPath(VPath_Basic), 00027 vertexProc(NULL), 00028 maxSimultaneousTextures(1) 00029 { 00030 }
|
|
|
Definition at line 32 of file glcontext.cpp. 00033 {
00034 }
|
|
|
Definition at line 236 of file glcontext.cpp. References GLPath_Multitexture, and renderPath. Referenced by Renderer::fragmentShaderSupported(), Renderer::loadTextures(), and Renderer::renderObject(). 00237 {
00238 return renderPath > GLPath_Multitexture;
00239 }
|
|
|
Definition at line 230 of file glcontext.cpp. References extensions. Referenced by Renderer::init(), init(), and renderPathSupported(). 00231 {
00232 return (find(extensions.begin(), extensions.end(), ext) != extensions.end());
00233 }
|
|
|
Definition at line 254 of file glcontext.cpp. References fragmentProc, GLPath_NV30, and renderPath. Referenced by Renderer::renderObject(). 00255 {
00256 if (renderPath == GLPath_NV30 /* || renderPath == GLPath_ARGFP_ARBVP */ )
00257 return fragmentProc;
00258 else
00259 return NULL;
00260 }
|
|
|
Definition at line 53 of file glcontext.h. References maxSimultaneousTextures. Referenced by Renderer::renderObject(). 00053 { return maxSimultaneousTextures; };
|
|
|
|
Definition at line 242 of file glcontext.cpp. References vertexPath. Referenced by Renderer::renderObject(). 00243 {
00244 return vertexPath;
00245 }
|
|
|
Definition at line 248 of file glcontext.cpp. References vertexPath, vertexProc, and VPath_Basic. Referenced by Renderer::PointStarVertexBuffer::finish(), and Renderer::renderObject(). 00249 {
00250 return vertexPath == VPath_Basic ? NULL : vertexProc;
00251 }
|
|
|
Definition at line 54 of file glcontext.h. References GLPath_Multitexture, and renderPath. Referenced by Renderer::renderObject(). 00054 { return renderPath >= GLPath_Multitexture; };
|
|
|
Definition at line 37 of file glcontext.cpp. References DPRINTF, extensions, extensionSupported(), fpNV, fragmentProc, GL_MAX_TEXTURE_UNITS_ARB, vp::initARB(), InitExtension(), fp::initNV(), vp::initNV(), maxSimultaneousTextures, vertexProc, vpARB, and vpNV. Referenced by CelestiaCore::initRenderer(). 00038 {
00039 char* extensionsString = (char*) glGetString(GL_EXTENSIONS);
00040 if (extensionsString != NULL)
00041 {
00042 char* next = extensionsString;
00043
00044 while (*next != '\0')
00045 {
00046 while (*next != '\0' && *next != ' ')
00047 next++;
00048
00049 string ext(extensionsString, next - extensionsString);
00050
00051 // scan the ignore list
00052 bool shouldIgnore = false;
00053 for (vector<string>::const_iterator iter = ignoreExt.begin();
00054 iter != ignoreExt.end(); iter++)
00055 {
00056 if (*iter == ext)
00057 {
00058 shouldIgnore = true;
00059 break;
00060 }
00061 }
00062
00063 if (!shouldIgnore)
00064 extensions.insert(extensions.end(), ext);
00065
00066 if (*next == '\0')
00067 break;
00068 next++;
00069 extensionsString = next;
00070 }
00071 }
00072
00073 // Initialize all extensions used
00074 for (vector<string>::const_iterator iter = extensions.begin();
00075 iter != extensions.end(); iter++)
00076 {
00077 InitExtension(iter->c_str());
00078 }
00079
00080 if (extensionSupported("GL_ARB_multitexture") &&
00081 glx::glActiveTextureARB != NULL)
00082 {
00083 glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB,
00084 (GLint*) &maxSimultaneousTextures);
00085 }
00086
00087 if (extensionSupported("GL_ARB_vertex_program") &&
00088 glx::glGenProgramsARB)
00089 {
00090 DPRINTF(1, "Renderer: ARB vertex programs supported.\n");
00091 if (vpARB == NULL)
00092 vpARB = vp::initARB();
00093 vertexProc = vpARB;
00094 }
00095 else if (extensionSupported("GL_NV_vertex_program") &&
00096 glx::glGenProgramsNV)
00097 {
00098 DPRINTF(1, "Renderer: nVidia vertex programs supported.\n");
00099 if (vpNV == NULL)
00100 vpNV = vp::initNV();
00101 vertexProc = vpNV;
00102 }
00103
00104 if (extensionSupported("GL_NV_fragment_program") &&
00105 glx::glGenProgramsNV)
00106 {
00107 DPRINTF(1, "Renderer: nVidia fragment programs supported.\n");
00108 if (fpNV == NULL)
00109 fpNV = fp::initNV();
00110 fragmentProc = fpNV;
00111 }
00112 }
|
|
|
Definition at line 214 of file glcontext.cpp. References GLPath_Basic, GLPath_GLSL, renderPath, and renderPathSupported(). Referenced by CelestiaCore::charEntered(). 00215 {
00216 GLContext::GLRenderPath newPath = renderPath;
00217
00218 do {
00219 newPath = (GLRenderPath) ((int) newPath + 1);;
00220 if (newPath > GLPath_GLSL)
00221 newPath = GLPath_Basic;
00222 } while (newPath != renderPath && !renderPathSupported(newPath));
00223
00224 renderPath = newPath;
00225
00226 return renderPath;
00227 }
|
|
|
Definition at line 147 of file glcontext.cpp. References extensionSupported(), GLPath_ARBFP_ARBVP, GLPath_Basic, GLPath_DOT3_ARBVP, GLPath_GLSL, GLPath_Multitexture, GLPath_NV30, GLPath_NvCombiner, GLPath_NvCombiner_ARBVP, GLPath_NvCombiner_NvVP, maxSimultaneousTextures, and vertexProc. Referenced by KdeGlWidget::initializeGL(), KdePreferencesDialog::KdePreferencesDialog(), nextRenderPath(), setRenderPath(), KdePreferencesDialog::slotRenderPath(), and WinMain(). 00148 {
00149 switch (path)
00150 {
00151 case GLPath_Basic:
00152 return true;
00153
00154 case GLPath_Multitexture:
00155 return (maxSimultaneousTextures > 1 &&
00156 ( extensionSupported("GL_EXT_texture_env_combine") ||
00157 extensionSupported("GL_ARB_texture_env_combine")) );
00158
00159 case GLPath_NvCombiner:
00160 return false;
00161 /*
00162 // No longer supported; all recent NVIDIA drivers also support
00163 // the vertex_program extension, so the combiners-only path
00164 // isn't necessary.
00165 return extensionSupported("GL_NV_register_combiners");
00166 */
00167
00168 case GLPath_DOT3_ARBVP:
00169 return (extensionSupported("GL_ARB_texture_env_dot3") &&
00170 extensionSupported("GL_ARB_vertex_program") &&
00171 vertexProc != NULL);
00172
00173 case GLPath_NvCombiner_NvVP:
00174 // If ARB_vertex_program is supported, don't report support for
00175 // this render path.
00176 return (extensionSupported("GL_NV_register_combiners") &&
00177 extensionSupported("GL_NV_vertex_program") &&
00178 !extensionSupported("GL_ARB_vertex_program") &&
00179 vertexProc != NULL);
00180
00181 case GLPath_NvCombiner_ARBVP:
00182 return (extensionSupported("GL_NV_register_combiners") &&
00183 extensionSupported("GL_ARB_vertex_program") &&
00184 vertexProc != NULL);
00185
00186 case GLPath_ARBFP_ARBVP:
00187 return false;
00188 /*
00189 return (extensionSupported("GL_ARB_vertex_program") &&
00190 extensionSupported("GL_ARB_fragment_program") &&
00191 vertexProc != NULL);
00192 */
00193
00194 case GLPath_NV30:
00195 /* This render path is deprecated; GLSL is now preferred */
00196 return false;
00197 /*
00198 return (extensionSupported("GL_ARB_vertex_program") &&
00199 extensionSupported("GL_NV_fragment_program"));
00200 */
00201
00202 case GLPath_GLSL:
00203 return (extensionSupported("GL_ARB_shader_objects") &&
00204 extensionSupported("GL_ARB_shading_language_100") &&
00205 extensionSupported("GL_ARB_vertex_shader") &&
00206 extensionSupported("GL_ARB_fragment_shader"));
00207
00208 default:
00209 return false;
00210 }
00211 }
|
|
|
|
Definition at line 69 of file glcontext.h. Referenced by extensionSupported(), and init(). |
|
|
Definition at line 66 of file glcontext.h. Referenced by getFragmentProcessor(), and init(). |
|
|
Definition at line 68 of file glcontext.h. Referenced by getMaxTextures(), init(), and renderPathSupported(). |
|
|
Definition at line 63 of file glcontext.h. Referenced by bumpMappingSupported(), getFragmentProcessor(), getRenderPath(), hasMultitexture(), nextRenderPath(), and setRenderPath(). |
|
|
Definition at line 64 of file glcontext.h. Referenced by getVertexPath(), getVertexProcessor(), and setRenderPath(). |
|
|
Definition at line 65 of file glcontext.h. Referenced by getVertexProcessor(), init(), and renderPathSupported(). |
1.4.1