/******************************************************************************* * * Helper functions. * ******************************************************************************/ static void setup_config(struct rb_config* cfg) { int i = 0; OGL(GetIntegerv(GL_MAX_TEXTURE_SIZE, &i)); assert(i > 0); cfg->max_tex_size = (size_t)i; OGL(GetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &i)); assert(i > 0); cfg->max_tex_max_anisotropy = (size_t)i; }
GrGLSharedSurface SkNativeSharedGLContext::stealSurface() { // Render the texture to the default framebuffer. int viewport[4]; SK_GL(*this, GetIntegerv(GR_GL_VIEWPORT, viewport)); int width = viewport[2], height = viewport[3]; SK_GL(*this, BindFramebuffer(GR_GL_READ_FRAMEBUFFER, fFBO)); SK_GL(*this, BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, 0)); SK_GL(*this, BlitFramebuffer(0, 0, width, height, 0, 0, width, height, GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST)); SK_GL(*this, Flush()); SK_GL(*this, BindFramebuffer(GR_GL_FRAMEBUFFER, 0)); Pixmap pixmap = fPixmap; destroyGLResources(); fPixmap = 0; return pixmap; }
/** * @alsymbols * @alfunref{GetIntegerv} * @aldefref{DISTANCE_MODEL} */ static oalplus::DistanceModel DistanceModel(void) { ALint result; OALPLUS_ALFUNC(GetIntegerv( AL_DISTANCE_MODEL, &result )); OALPLUS_VERIFY_SIMPLE(GetIntegerv); return oalplus::DistanceModel(result); }
bool IsExtensionSupported (const std::string &name) { int num, i; GetIntegerv (GL_NUM_EXTENSIONS, &num); for (i = 0; i < num; i++) { const GLubyte *ext = GetStringi (GL_EXTENSIONS, i); if (!name.compare (reinterpret_cast<const char *> (ext))) return true; } return false; }
void Gl::GreOpenGl3ExtensionInit() { GLint extnum = 0; GetIntegerv(GL_NUM_EXTENSIONS, &extnum); for(GLuint cext = 0; cext < extnum; ++cext) { Extensions.push_back(std::string((char*) GetStringi(GL_EXTENSIONS, cext))); } #ifdef GreIsDebugMode GreDebugPretty() << "Extensions Found : " << Extensions.size() << std::endl; #endif }
void GL::Initialize() { MOZ_ASSERT(IsCurrent()); memset(mSupportedExtensions, 0, sizeof(mSupportedExtensions)); stringstream extensions(reinterpret_cast<const char*>(GetString(GL_EXTENSIONS))); istream_iterator<string> iter(extensions); istream_iterator<string> end; for (; iter != end; iter++) { const string& extension = *iter; if (*iter == "GL_EXT_direct_state_access") { mSupportedExtensions[EXT_direct_state_access] = true; continue; } if (*iter == "GL_NV_path_rendering") { mSupportedExtensions[NV_path_rendering] = true; continue; } if (*iter == "GL_EXT_framebuffer_multisample") { mSupportedExtensions[EXT_framebuffer_multisample] = true; continue; } if (*iter == "GL_EXT_framebuffer_blit") { mSupportedExtensions[EXT_framebuffer_blit] = true; continue; } if (*iter == "GL_EXT_texture_filter_anisotropic") { mSupportedExtensions[EXT_texture_filter_anisotropic] = true; continue; } } GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &mMaxRenderbufferSize); GetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); GetIntegerv(GL_MAX_CLIP_PLANES, &mMaxClipPlanes); if (HasExtension(EXT_texture_filter_anisotropic)) { GetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &mMaxAnisotropy); } else { mMaxAnisotropy = 1; } GenFramebuffers(1, &mTextureFramebuffer1D); GenFramebuffers(1, &mTextureFramebuffer2D); TexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); TexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); EnableClientState(GL_VERTEX_ARRAY); EnableClientState(GL_TEXTURE_COORD_ARRAY); DebugMessageCallback(GLDebugCallback, nullptr); DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE); Enable(GL_DEBUG_OUTPUT); mIsValid = true; }
GLint GLInterfaceWrapper::GetParameteri( GLenum pname ) const { GLint parameter = 0; GetIntegerv( pname, ¶meter ); return parameter; }
/** * gst_gl_context_get_current_gl_api: * @platform: the #GstGLPlatform to retrieve the API for * @major: (out): (allow-none): the major version * @minor: (out): (allow-none): the minor version * * If an error occurs, @major and @minor aren't modified and %GST_GL_API_NONE is * returned. * * Returns: The version supported by the OpenGL context current in the calling * thread or %GST_GL_API_NONE * * Since: 1.6 */ GstGLAPI gst_gl_context_get_current_gl_api (GstGLPlatform platform, guint * major, guint * minor) { const GLubyte *(*GetString) (GLenum name); #if GST_GL_HAVE_OPENGL void (*GetIntegerv) (GLenum name, GLuint * n); #endif const gchar *version; gint maj, min, n; GstGLAPI ret = (1 << 31); _init_debug (); while (ret != GST_GL_API_NONE) { /* FIXME: attempt to delve into the platform specific GetProcAddress */ GetString = gst_gl_context_get_proc_address_with_platform (platform, ret, "glGetString"); #if GST_GL_HAVE_OPENGL GetIntegerv = gst_gl_context_get_proc_address_with_platform (platform, ret, "glGetIntegerv"); #endif if (!GetString) { goto next; } version = (const gchar *) GetString (GL_VERSION); if (!version) goto next; /* strlen (x.x) == 3 */ n = strlen (version); if (n < 3) goto next; if (g_strstr_len (version, 9, "OpenGL ES")) { /* strlen (OpenGL ES x.x) == 13 */ if (n < 13) goto next; sscanf (&version[10], "%d.%d", &maj, &min); if (maj <= 0 || min < 0) goto next; if (maj == 1) { ret = GST_GL_API_GLES1; break; } else if (maj == 2 || maj == 3) { ret = GST_GL_API_GLES2; break; } goto next; } else { sscanf (version, "%d.%d", &maj, &min); if (maj <= 0 || min < 0) goto next; #if GST_GL_HAVE_OPENGL if (GetIntegerv && (maj > 3 || (maj == 3 && min > 1))) { GLuint context_flags = 0; ret = GST_GL_API_NONE; GetIntegerv (GL_CONTEXT_PROFILE_MASK, &context_flags); if (context_flags & GL_CONTEXT_CORE_PROFILE_BIT) ret |= GST_GL_API_OPENGL3; if (context_flags & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) ret |= GST_GL_API_OPENGL; break; } #endif ret = GST_GL_API_OPENGL; break; } next: /* iterate through the apis */ ret >>= 1; } if (ret == GST_GL_API_NONE) return GST_GL_API_NONE; if (major) *major = maj; if (minor) *minor = min; return ret; }