当前位置: 首页>>代码示例>>C++>>正文


C++ CHECKGL函数代码示例

本文整理汇总了C++中CHECKGL函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECKGL函数的具体用法?C++ CHECKGL怎么用?C++ CHECKGL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CHECKGL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: swapDisplayBuffers

		void swapDisplayBuffers(window w)
		{
#if OXYGINE_SDL
			if (!_context)
				return;
#endif

			CHECKGL();
#if __S3E__
			IwGLSwapBuffers();
#elif EMSCRIPTEN
			SDL_GL_SwapBuffers();
#elif OXYGINE_SDL
			SDL_Window *wnd = w;
			if (!wnd)
				wnd = _window;
			if (_context)
			{
				int status = SDL_GL_MakeCurrent(wnd, _context);
				if (status)
				{
					log::error("SDL_GL_MakeCurrent(): %s", SDL_GetError());
				}
				SDL_GL_SwapWindow(wnd);
			}
#endif

			IVideoDriver::instance->getStats(_videoStats);
			IVideoDriver::instance->swapped();

			CHECKGL();

			//sleep(1000/50);
		}
开发者ID:swarren4,项目名称:Projects,代码行数:34,代码来源:oxygine.cpp

示例2: CHECKGL

 void VideoDriverGLES20::setShaderProgram(ShaderProgram* prog_)
 {
     CHECKGL();
     ShaderProgramGL* prog = safeCast<ShaderProgramGL*>(prog_);
     unsigned int id = prog->getID();
     oxglUseProgram(id);
     _program = id;
     CHECKGL();
 }
开发者ID:Jesus05,项目名称:oxygine-framework,代码行数:9,代码来源:VideoDriverGLES20.cpp

示例3: glBindFramebuffer

	void VideoDriverGL::setRenderTarget(spNativeTexture rt)
	{
		if (!rt)
		{
			glBindFramebuffer(GL_FRAMEBUFFER, _prevFBO);
            CHECKGL();
			return;
		}

		glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_prevFBO);

		NativeTextureGLES *gl = safeCast<NativeTextureGLES*>(rt.get());		
		glBindFramebuffer(GL_FRAMEBUFFER, gl->getFboID());
        CHECKGL();
	}
开发者ID:luiseduardohdbackup,项目名称:oxygine-framework,代码行数:15,代码来源:VideoDriverGL.cpp

示例4: oxglEnableVertexAttribArray

    void VideoDriverGLES20::draw(PRIMITIVE_TYPE pt, const VertexDeclaration* decl_, const void* vdata, unsigned int size)
    {
        const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(decl_);

        const unsigned char* verticesData = (const unsigned char*)vdata;

        const VertexDeclarationGL::Element* el = decl->elements;
        for (int i = 0; i < decl->numElements; ++i)
        {
            oxglEnableVertexAttribArray(el->index);
            oxglVertexAttribPointer(el->index, el->size, el->elemType, el->normalized, decl->size, verticesData + el->offset);
            el++;
        }

        size_t primitives = size / decl->size;
        glDrawArrays(getPT(pt), 0, (GLsizei)primitives);

        el = decl->elements;
        for (int i = 0; i < decl->numElements; ++i)
        {
            oxglDisableVertexAttribArray(el->index);
            el++;
        }


#if OXYGINE_TRACE_VIDEO_STATS
        _debugAddPrimitives(pt, (int)(GLsizei)primitives);
#endif

        CHECKGL();
    }
开发者ID:Jesus05,项目名称:oxygine-framework,代码行数:31,代码来源:VideoDriverGLES20.cpp

示例5: assert

    void NativeTextureGLES::updateRegion(int x, int y, const ImageData& data_)
    {
        ImageData data = data_;
        assert(_width >= data.w - x);
        assert(_height >= data.h - y);
        glBindTexture(GL_TEXTURE_2D, (GLuint) _id);

        glPixel glp = SurfaceFormat2GL(_format);
        //saveImage(data, "test1.png");


        MemoryTexture mt;
        if (_format != data.format)
        {
            mt.init(data.w, data.h, _format);
            mt.fill_zero();
            mt.updateRegion(0, 0, data);
            data = mt.lock();
        }

        glTexSubImage2D(GL_TEXTURE_2D, 0,
                        x, y, data.w, data.h,
                        glp.format, glp.type, data.data);
        CHECKGL();
    }
开发者ID:Neo7k,项目名称:oxygine-framework,代码行数:25,代码来源:NativeTextureGLES.cpp

示例6: glClearColor

    void VideoDriverGLES20::clear(const Color& color)
    {
        glClearColor(color.getRedF(), color.getGreenF(), color.getBlueF(), color.getAlphaF());
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        CHECKGL();
    }
开发者ID:Jesus05,项目名称:oxygine-framework,代码行数:7,代码来源:VideoDriverGLES20.cpp

示例7: oxglGetUniformLocation

	int ShaderProgramGL::getUniformLocation(const char *id) const
	{
		int i = oxglGetUniformLocation(_program, id);
		//if (i == -1)
		CHECKGL();
		return i;
	}
开发者ID:gotonis,项目名称:danmake,代码行数:7,代码来源:ShaderProgramGL.cpp

示例8: oxglCreateShader

    unsigned int ShaderProgramGL::createShader(unsigned int type, const char* data, const char* prepend, const char* append)
    {
        GLuint shader = oxglCreateShader(type);

        const char* sources[16];
        const char** ptr = &sources[0];

        bool gles = false;

#ifdef __S3E__
        gles = true;
#elif OXYGINE_SDL
        int profile = 0;
        SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile);

        gles = profile == SDL_GL_CONTEXT_PROFILE_ES;
#else
#endif


#ifndef   EMSCRIPTEN
        if (!gles)
        {
            log::messageln("not gles version");

            static const char nonGLES[] =
                "#define lowp\n"
                "#define mediump\n"
                "#define highp\n";

            *ptr = nonGLES;
			ptr++;
        }
#endif


        if (prepend)
        {
            *ptr = prepend;
            ptr++;
        }

        *ptr = data;
        ptr++;

        if (append)
        {
            *ptr = append;
            ptr++;
        }

        int num = (int)(ptr - sources);
        oxglShaderSource(shader, num, sources, 0);
        oxglCompileShader(shader);
        printShaderInfoLog(shader);

        CHECKGL();

        return shader;
    }
开发者ID:radonthetyrant,项目名称:oxygine-framework,代码行数:60,代码来源:ShaderProgramGL.cpp

示例9: oxglCreateProgram

    unsigned int ShaderProgramGL::createProgram(int vs, int fs, const VertexDeclarationGL* decl)
    {
        int p = oxglCreateProgram();
        oxglAttachShader(p, vs);
        oxglAttachShader(p, fs);

        for (int i = 0; i < decl->numElements; ++i)
            oxglBindAttribLocation(p, decl->elements[i].index, decl->elements[i].name);

        oxglLinkProgram(p);


        std::string log;
        bool success = getProgramBuildLog(p, log);

        if (success)
        {
            //log::messageln("compiled shader: %s", log.c_str());
        }
        else
        {
            log::error("can't link gl program: %s", log.c_str());
            oxglDeleteProgram(p);
            p = 0;
        }

        CHECKGL();

        return p;
    }
开发者ID:Yahor10,项目名称:oxygine-framework,代码行数:30,代码来源:ShaderProgramGL.cpp

示例10: release

    void NativeTextureGLES::init(int w, int h, TextureFormat tf, bool rt)
    {
        release();


        size_t id = createTexture();

        if (rt)
        {
            if (!HAVE_NPOT_RT())
            {
                w = nextPOT(w);
                h = nextPOT(h);
            }
        }

        glPixel p = SurfaceFormat2GL(tf);
        glTexImage2D(GL_TEXTURE_2D, 0, p.format, w, h, 0, p.format, p.type, 0);

        if (rt)
        {
            int prevFBO = 0;
            glGetIntegerv(GL_FRAMEBUFFER_BINDING, &prevFBO);

            glBindTexture(GL_TEXTURE_2D, 0);

            unsigned int fbo = 0;
            oxglGenFramebuffers(1, &fbo);
            oxglBindFramebuffer(GL_FRAMEBUFFER, fbo);
            oxglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, (GLuint)id, 0);

            //printf("created fbo: %d\n", fbo);

            unsigned int status = oxglCheckFramebufferStatus(GL_FRAMEBUFFER);
            //log::message("fbo status %d\n", status);
            //GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES
            if (status != GL_FRAMEBUFFER_COMPLETE)
            {
                log::error("status != GL_FRAMEBUFFER_COMPLETE_OES");
            }

            glViewport(0, 0, w, h);
            glClearColor(0, 0, 0, 0);
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

            oxglBindFramebuffer(GL_FRAMEBUFFER, prevFBO);
            //log::message("fbo bind\n");

            glBindTexture(GL_TEXTURE_2D, 0);

            _fbo = fbo;
        }

        _id = id;
        _width = w;
        _height = h;
        _format = tf;
        CHECKGL();
    }
开发者ID:yetanothergithubuser,项目名称:oxygine-framework,代码行数:59,代码来源:NativeTextureGLES.cpp

示例11: oxglGetUniformLocation

 void VideoDriverGLES20::setUniformInt(const char* id, int v)
 {
     int location = oxglGetUniformLocation(_program, id);
     if (location == -1)
         return;
     oxglUniform1i(location, v);
     CHECKGL();
 }
开发者ID:Jesus05,项目名称:oxygine-framework,代码行数:8,代码来源:VideoDriverGLES20.cpp

示例12: glGetIntegerv

	void VideoDriverGL::getViewport(Rect &r) const
	{
		GLint vp[4];
		glGetIntegerv(GL_VIEWPORT, vp);

		r = Rect(vp[0], vp[1], vp[2], vp[3]);;
        CHECKGL();
	}
开发者ID:huangyt,项目名称:oxygine-framework,代码行数:8,代码来源:VideoDriverGL.cpp

示例13: glBindTexture

    void NativeTextureGLES::setLinearFilter(bool enable)
    {
        glBindTexture(GL_TEXTURE_2D, (GLuint) _id);

        unsigned int f = enable ? GL_LINEAR : GL_NEAREST;
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, f);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, f);
        CHECKGL();
    }
开发者ID:Neo7k,项目名称:oxygine-framework,代码行数:9,代码来源:NativeTextureGLES.cpp

示例14: oxglActiveTexture

 void VideoDriverGLES20::setTexture(int sampler, spNativeTexture t)
 {
     oxglActiveTexture(GL_TEXTURE0 + sampler);
     if (t)
         glBindTexture(GL_TEXTURE_2D, (GLuint)((size_t)t->getHandle()));
     else
         glBindTexture(GL_TEXTURE_2D, 0);
     CHECKGL();
 }
开发者ID:Jesus05,项目名称:oxygine-framework,代码行数:9,代码来源:VideoDriverGLES20.cpp

示例15: init2

		void init2()
		{
#ifdef OXYGINE_QT
            setlocale(LC_ALL, "POSIX");
#endif

#ifdef OXYGINE_SDL
			int missing = initGLExtensions(SDL_GL_GetProcAddress);
#endif

			Point size = getDisplaySize();
			log::messageln("display size: %d %d", size.x, size.y);


#if __S3E__
			int glversion = s3eGLGetInt(S3E_GL_VERSION);
			int major_gl = glversion >> 8;
			OX_ASSERT( major_gl == 2 && "gl version should be 2");			
			IVideoDriver::instance = new VideoDriverGLES20();
#endif

			IVideoDriver::instance = new VideoDriverGLES20();


			CHECKGL();

			IVideoDriver::instance->setDefaultSettings();

			CHECKGL();

			Renderer::initialize();

			Resources::registerResourceType(ResAtlas::create, "atlas");
			Resources::registerResourceType(ResBuffer::create, "buffer");
			Resources::registerResourceType(ResFontBM::create, "font");
			Resources::registerResourceType(ResFontBM::createBM, "bmfc_font");
			Resources::registerResourceType(ResFontBM::createSD, "sdfont");
			Resources::registerResourceType(ResStarlingAtlas::create, "starling");

			CHECKGL();
			log::messageln("oxygine initialized");
		}
开发者ID:swarren4,项目名称:Projects,代码行数:42,代码来源:oxygine.cpp


注:本文中的CHECKGL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。