Exemplo n.º 1
0
//-----------------------------------------------------------------------
void GraphicsContextGL4::Clear(ClearOptions options, Color const& color, float depth, std::uint8_t stencil)
{
    GLbitfield mask = 0;

    if ((options | ClearOptions::DepthBuffer) == options) {
        mask |= GL_DEPTH_BUFFER_BIT;
        auto clamped = std::min(std::max(depth, 0.0f), 1.0f);
        glClearDepthf(clamped);
        POMDOG_CHECK_ERROR_GL4("glClearDepthf");
    }
    if ((options | ClearOptions::Stencil) == options) {
        mask |= GL_STENCIL_BUFFER_BIT;
        glClearStencil(stencil);
        POMDOG_CHECK_ERROR_GL4("glClearStencil");
    }
    if ((options | ClearOptions::RenderTarget) == options) {
        mask |= GL_COLOR_BUFFER_BIT;
        auto colorVector = color.ToVector4();
        glClearColor(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W);
        POMDOG_CHECK_ERROR_GL4("glClearColor");
    }

    glClear(mask);
    POMDOG_CHECK_ERROR_GL4("glClear");
}
Exemplo n.º 2
0
	bool render()
	{
		GLenum const Buffers = GL_BACK;
		glDrawBuffers(1, &Buffers);

		// Compute the MVP (Model View Projection matrix)
		glm::mat4 Projection = glm::perspective(glm::pi<float>() * 0.25f, 4.0f / 3.0f, 0.1f, 100.0f);
		glm::mat4 Model = glm::mat4(1.0f);
		glm::mat4 MVP = Projection * this->view() * Model;

		// Set the display viewport
		glm::uvec2 WindowSize = this->getWindowSize();
		glViewport(0, 0, WindowSize.x, WindowSize.y);

		// Clear color buffer with black
		glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
		glClearDepthf(1.0f);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		// Bind program
		glUseProgram(ProgramName);

		// Set the value of MVP uniform.
		glUniformMatrix4fv(UniformMVP, 1, GL_FALSE, &MVP[0][0]);

		glBindVertexArray(VertexArrayName);

		glDrawElements(GL_TRIANGLES, ElementCount, GL_UNSIGNED_INT, 0);

		return true;
	}
Exemplo n.º 3
0
void InitGame()
{
	char path[128];
	sprintf(path, "%s", "sprite.bgfx");
	sprite.Load(path);

	glEnable(GL_TEXTURE_2D);

	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);

	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, matAmbient);
	
	glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmbient);

	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);

	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	glClearDepthf(1.0f);

	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);

	glEnable(GL_CULL_FACE);
	glShadeModel(GL_SMOOTH);

	return;
}
Exemplo n.º 4
0
	/**
	*	Initialize the renderer
	*	@param width Width of the window
	*	@param height Height of the window
	*	@return True if the renderer successfully init
	*/
	bool Renderer::Init(unsigned int pWidth, unsigned int pHeight, UiFunction* pUiFunctionPtr)
	{
		_uiFunctionPtr = pUiFunctionPtr;
		_width = pWidth;
		_height = pHeight;

		glbinding::Binding::initialize();

		//Get context info
		Log("GL Info : ");
		Log(ToString(glGetString(GL_VENDOR)));
		Log(ToString(glGetString(GL_RENDERER)));
		Log(ToString(glGetString(GL_VERSION)));
		Log(ToString(glGetString(GL_SHADING_LANGUAGE_VERSION)));

		debugProc = GLDEBUGPROC(&DebugProc);
		glDebugMessageCallback(debugProc, nullptr);

		glCullFace(GL_BACK);
		glFrontFace(GL_CCW);
		glEnable(GL_DEPTH_TEST);
		glDepthFunc(GL_LEQUAL);
		glClearColor(0, 0, 0, 1);
		glClearDepthf(1.0);
		glEnable(GL_BLEND);
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

		glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);

		glGenVertexArrays(1, &_baseVAO);

		SetupPrograms();
		SetupBuffers();

		///TODO : Check for ATI memory info
		std::set<GLextension> extensions = ContextInfo::extensions();

		if (extensions.find(GLextension::GL_NVX_gpu_memory_info) != extensions.end())
		{
			GLint memory = 0;
			glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &memory);
			Log("Dedicated video memory, total size(in kb) of the GPU memory : " + ToString(memory));
			glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &memory);
			Log("Total available memory, total size(in Kb) of the memory available for allocations : " + ToString(memory));
			glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &memory);
			Log("Current available dedicated video memory(in kb), currently unused GPU memory : " + ToString(memory));
			glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX, &memory);
			Log("Count of total evictions seen by system : " + ToString(memory));
			glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX, &memory);
			Log("Size of total video memory evicted(in kb) : " + ToString(memory));
		}


		CheckGLError();

		_uiPtr = nullptr;
		_menuPtr = nullptr;

		return true;
	}
Exemplo n.º 5
0
void g_makeCurrent()
{
    LOGE("g_makeCurrent-->start L:366");
    LOGE("Got bwdisplay %p", bwdisplay);
    LOGE("Got bwsurface %p", bwsurface);
    LOGE("Got bwcontext %p", bwcontext);
    if (!eglMakeCurrent(bwdisplay, bwsurface, bwsurface, bwcontext)) {
        LOGI("eglMakeCurrent() returned error %d", eglGetError());
        g_destroyGL();
    }
    printGLString("Version", GL_VERSION);
    printGLString("Vendor", GL_VENDOR);
    printGLString("Renderer", GL_RENDERER);
    printGLString("Extensions", GL_EXTENSIONS);
    
    glHint( GL_GENERATE_MIPMAP_HINT, GL_NICEST );
    
    glHint( GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, GL_NICEST );
    
    glEnable( GL_DEPTH_TEST );
    glEnable( GL_CULL_FACE  );
    glDisable( GL_DITHER );
    glDepthMask( GL_TRUE );
    glDepthFunc( GL_LESS );
    glDepthRangef( 0.0f, 1.0f );
    glClearDepthf( 1.0f );
    glCullFace ( GL_BACK );
    glFrontFace( GL_CCW  );
    glClearStencil( 0 );
    glStencilMask( 0xFFFFFFFF );
}
Exemplo n.º 6
0
void OpenGLES2Context::clear(float red, float green, float blue, float alpha, float depth, unsigned int stencil, ClearMask mask)
{
	glClearColor(red, green, blue, alpha);

#ifdef GL_ES_VERSION_2_0
	glClearDepthf(depth);
#else
	glClearDepth(depth);
#endif

#ifndef AWAY_NO_STENCIL
	glClearStencil(stencil);
#endif

	GLbitfield internalMask = 0;
	int maskValue = static_cast<int>(mask);
	if (maskValue & static_cast<int>(ClearMask::COLOR))
		internalMask |= GL_COLOR_BUFFER_BIT;

	if (maskValue & static_cast<int>(ClearMask::DEPTH))
	{
		internalMask |= GL_DEPTH_BUFFER_BIT;
		glDepthMask(m_curDepthMask = true);
	}

#ifndef AWAY_NO_STENCIL
	if (maskValue & static_cast<int>(ClearMask::STENCIL))
		internalMask |= GL_STENCIL_BUFFER_BIT;
#endif

	glClear(internalMask);
}
void ckLowLevelAPI::resetDrawState()
{
    glEnable(GL_SCISSOR_TEST);
    glEnable(GL_DEPTH_TEST);

#ifndef CK_GLES2
    glShadeModel(GL_SMOOTH);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
#endif

#if defined(CK_GLES1) || defined(CK_GLES2)
    glClearDepthf(-1.0f);
#else
    glClearDepth(-1.0f);
#endif

    resetDepthTest();
    resetBlendMode();
    resetWriteMode();
    resetBackfaceCulling();
    resetTexture();
    resetShader();

#ifndef CK_GLES2
    resetVertexArrayState();
    resetColorArrayState();
    resetTexCoordArrayState();
#endif
}
Exemplo n.º 8
0
    void configure() {
        s_textureUnit = -1;
        s_validGeneration++;
        VertexLayout::clearCache();

        blending.init(GL_FALSE);
        blendingFunc.init(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        culling.init(GL_TRUE);
        cullFace.init(GL_BACK);
        frontFace.init(GL_CCW);
        depthTest.init(GL_TRUE);
        depthWrite.init(GL_TRUE);

        glDisable(GL_STENCIL_TEST);
        glDepthFunc(GL_LEQUAL);
        glClearDepthf(1.0);
        glDepthRangef(0.0, 1.0);

        static size_t max = std::numeric_limits<size_t>::max();

        clearColor.init(0.0, 0.0, 0.0, 0.0);
        shaderProgram.init(max, false);
        vertexBuffer.init(max, false);
        indexBuffer.init(max, false);
        texture.init(GL_TEXTURE_2D, max, false);
        texture.init(GL_TEXTURE_CUBE_MAP, max, false);
        textureUnit.init(max, false);
    }
Exemplo n.º 9
0
/* general OpenGL initialization function */
int initGL()
{

	/* Enable smooth shading */
//	glShadeModel( GL_SMOOTH );

	/* Set the background black */
	glClearColor( 1.0f, 0.0f, 0.0f, 0.0f );

	/* Depth buffer setup */
	glClearDepthf( 1.0f );

	/* Enables Depth Testing */
	glEnable( GL_DEPTH_TEST );

	/* The Type Of Depth Test To Do */
	glDepthFunc( GL_LEQUAL );

    glViewport( 0, 0, ( GLsizei )800, ( GLsizei )600 );

	/* Really Nice Perspective Calculations */
//	glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );

	return( TRUE );
}
Exemplo n.º 10
0
void Scene::render(Camera3D* camera, bool clearDepth) {
    _renderLength = (int)_renderList.size();
    if (_renderLength == 0 || !_visible) {
        return;
    }
    _renderIndex  = 0;
    bool doRender = false;
    if (!_paused) {
        doRender = true;
        _renderEvent.reset();
        dispatchEvent(_renderEvent);
    }
    
    if (clearDepth) {
#if CC_TARGET_PLATFORM == CC_TARGET_OS_IPHONE || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
        glClearDepthf(1.0);
#else
        glClearDepth(1.0);
#endif
    }
    
    if (doRender) {
        while (_renderIndex < _renderLength) {
            _renderList[_renderIndex]->draw(false);
            _renderIndex++;
        }
    }
    
}
Exemplo n.º 11
0
int initGL(GLuint* texturePtr) {
	if (texturePtr) {
		textures = texturePtr;
		// do the GL initialization stuff
		glEnable(GL_TEXTURE_2D); 							// Enable Texture Mapping
		glShadeModel(GL_SMOOTH); 							// Enable Smooth Shading
		glClearColor(0.0f, 0.0f, 0.0f, 0.5f); 				// Black Background
		glClearDepthf(1.0f); 								// Depth Buffer Setup
		glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); 	// Really Nice Perspective Calculations
		glBlendFunc(GL_SRC_ALPHA,GL_ONE); 					// Set The Blending Function For Translucency
		glEnable(GL_BLEND); 								// Enable Blending

		for (int i = 0; i < NUM_STARS; i++) {
			stars[i].angle = 0.0f;
			stars[i].dist = ((float) i)/NUM_STARS * 5.0f;
			stars[i].r = rand() % 256;
			stars[i].g = rand() % 256;
			stars[i].b = rand() % 256;
		}
		LOGI("GL initialized");
		return 1;
	} else {
		LOGE("Unable to load textures");
		return 0;
	}
}
Exemplo n.º 12
0
    bool Render::init()
    {
# ifdef _WIN32
        /// OpenGL initialization
        glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
        glShadeModel(GL_SMOOTH);					// smooth shade model
        
        glClearDepth(1.0f);							// set clear depth
        glEnable(GL_DEPTH_TEST);
        
        glEnable(GL_NORMALIZE);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glEnable(GL_BLEND);
        
        //texture
        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
        //glEnable(GL_TEXTURE_2D);
# else
        
        glClearDepthf(1.0f);									// set clear depth
        glEnable(GL_DEPTH_TEST);
# endif
        
        //    glCullFace(GL_BACK);                            ///< cull back face
        //    glEnable(GL_CULL_FACE);
        
        CZCheckGLError();
        
#if	defined(__APPLE__)	|| defined(_WIN32)
        loadShaders();
#endif
        return true;
    }
    void onInit()
    {
        sys::info << "app::COGLDev06NormalMapApp::onInit()" << sys::endl;

        pCamera = new app::CCamera(60.0f, mConfig.mRatio, 0.1f, 100.0f);
        pCamera->translateLocal(math::vec3(0.0f, -2.0f, -5.0f));

        pShadowFBO = new ogl::CShadowFramebuffer(mConfig.mWidth, mConfig.mHeight);

        init_programs();

        init_lights();

        init_textures();

        init_objects();

        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        glClearDepthf(1.0f);
        glEnable(GL_CULL_FACE);
        glFrontFace(GL_CW);
        glCullFace(GL_BACK);
        glEnable(GL_DEPTH_TEST);
        glDepthFunc(GL_LEQUAL);
    }
Exemplo n.º 14
0
void MySample::Render(double deltaSeconds)
{
    CPUTRenderParameters renderParams;
    if(isInstanced)
        SetEffectVals( 0 );
    else
        SetEffectVals( 1 );


    renderParams.mpPerFrameConstants = mpPerFrameConstantBuffer;
    renderParams.mpPerModelConstants = mpPerModelConstantBuffer;
	renderParams.mpCamera = mpCamera;
    UpdatePerFrameConstantBuffer(renderParams, deltaSeconds);

    int width,height;
    mpWindow->GetClientDimensions(&width, &height);

    // Set default viewport
    glViewport( 0, 0, width, height );
    GL_CHECK(glClearColor ( 0.7f, 0.7f, 0.7f, 1.0f ));
    GL_CHECK(glClearDepthf(0.0f));
    GL_CHECK(glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ));


    mpScene->Render( renderParams);

#ifdef ENABLE_GUI
	CPUTDrawGUI();
#endif
}
    void GLES2StateCacheManagerImp::initializeCache()
    {
        OGRE_CHECK_GL_ERROR(glBlendEquation(GL_FUNC_ADD));

        OGRE_CHECK_GL_ERROR(glBlendFunc(GL_ONE, GL_ZERO));

        OGRE_CHECK_GL_ERROR(glCullFace(mCullFace));

        OGRE_CHECK_GL_ERROR(glDepthFunc(mDepthFunc));

        OGRE_CHECK_GL_ERROR(glDepthMask(mDepthMask));

        OGRE_CHECK_GL_ERROR(glStencilMask(mStencilMask));

        OGRE_CHECK_GL_ERROR(glClearDepthf(mClearDepth));

        OGRE_CHECK_GL_ERROR(glBindTexture(GL_TEXTURE_2D, 0));

        OGRE_CHECK_GL_ERROR(glBindBuffer(GL_ARRAY_BUFFER, 0));

        OGRE_CHECK_GL_ERROR(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));

        OGRE_CHECK_GL_ERROR(glBindFramebuffer(GL_FRAMEBUFFER, 0));

        OGRE_CHECK_GL_ERROR(glBindRenderbuffer(GL_RENDERBUFFER, 0));

        OGRE_CHECK_GL_ERROR(glActiveTexture(GL_TEXTURE0));

        OGRE_CHECK_GL_ERROR(glClearColor(mClearColour[0], mClearColour[1], mClearColour[2], mClearColour[3]));

        OGRE_CHECK_GL_ERROR(glColorMask(mColourMask[0], mColourMask[1], mColourMask[2], mColourMask[3]));
    }
Exemplo n.º 16
0
void RenderLayerManager::ClearScreen()
{
	ERR( glClearColor(0,0,0, 1.0f) );
	ERR( glClearDepthf(0.0f) );
	ERR( glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) );
	//ERR( glClear( GL_DEPTH_BUFFER_BIT ) );
}
 void GLES2Lesson::clearBuffers() {
     glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
     glClearDepthf(1.0f);
     checkGlError("glClearColor");
     glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
     checkGlError("glClear");
 }
void GraphicsManager::SetupDraw()
{
  //drawing settings
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);
  glEnable(GL_VSYNC_SCE);

  //clear screen settings
	glClearColor (1.0f, 0.0f, 0.0f, 1.0f);
	glClearStencil (0);
	glClearDepthf (1.0f);

  //do a first clear and swap - probably redundant
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
	psglSwap();	

  //setup drawing mode
	//note: it's common to have to keep changing some of this, 
	//but right now we have only one model  
	glMatrixMode(GL_MODELVIEW);
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_COLOR_ARRAY);
  glEnableClientState(GL_NORMAL_ARRAY);
  glEnable(GL_COLOR_MATERIAL);
	glShadeModel(GL_FLAT);

  // Enable transparency PSGL things
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} // SetUpDraw
bool OsmAnd::AtlasMapRenderer_OpenGL::doInitializeRendering()
{
    GL_CHECK_PRESENT(glClearColor);
    GL_CHECK_PRESENT(glClearDepthf);

    bool ok;

    ok = AtlasMapRenderer::doInitializeRendering();
    if(!ok)
        return false;

    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    GL_CHECK_RESULT;

    glClearDepthf(1.0f);
    GL_CHECK_RESULT;

    _skyStage.initialize();
    _rasterMapStage.initialize();
    _symbolsStage.initialize();
#if OSMAND_DEBUG
    _debugStage.initialize();
#endif

    return true;
}
Exemplo n.º 20
0
void CCRenderer::setupOpenGL()
{
    if( usingOpenGL2 )
    {
        // Use shader program
        currentShader = shaders.list[0];
        currentShader->use();

        currentShader->enableAttributeArray( ATTRIB_VERTEX );
        currentShader->enableAttributeArray( ATTRIB_TEXCOORD );
        DEBUG_OPENGL();
    }
    else
    {
#ifdef IOS
        // GL_TEXTURE_2D is not a valid argument to glEnable in OpenGL ES 2.0
        glEnable( GL_TEXTURE_2D );
        glEnableClientState( GL_VERTEX_ARRAY );
        glEnableClientState( GL_TEXTURE_COORD_ARRAY );
        glDisableClientState( GL_COLOR_ARRAY );
        DEBUG_OPENGL();

        CCSetColour( CCColour() );
#endif
    }

#ifndef DXRENDERER
    glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
    DEBUG_OPENGL();
#endif

    CCSetDepthRead( true );
    CCSetDepthWrite( true );
#ifndef DXRENDERER
    glDepthFunc( GL_LEQUAL );
    DEBUG_OPENGL();

    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

    glEnable( GL_SCISSOR_TEST );
    DEBUG_OPENGL();
#endif
    GLEnable( GL_BLEND );
    DEBUG_OPENGL();

#ifndef DXRENDERER
#ifndef Q_OS_SYMBIAN
    glClearDepthf( 1.0f );
    DEBUG_OPENGL();
#endif

    glLineWidth( LINE_WIDTH );
    DEBUG_OPENGL();
#endif

    // Enable back face culling
    CCSetCulling( true );
    CCSetBackCulling();
}
void COGLGraphicsContext::InitState(void)
{
    m_pRenderStr = glGetString(GL_RENDERER);
    m_pExtensionStr = glGetString(GL_EXTENSIONS);
    m_pVersionStr = glGetString(GL_VERSION);
    m_pVendorStr = glGetString(GL_VENDOR);
    //glMatrixMode(GL_PROJECTION);
    //OPENGL_CHECK_ERRORS;
    //glLoadIdentity();
    //OPENGL_CHECK_ERRORS;

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    OPENGL_CHECK_ERRORS;
    glClearDepthf(1.0f);
    OPENGL_CHECK_ERRORS;

    //glShadeModel(GL_SMOOTH);
    //OPENGL_CHECK_ERRORS;

    //position viewer 
    //glMatrixMode(GL_MODELVIEW);
    //glLoadIdentity();

    //glDisable(GL_ALPHA_TEST);
    //OPENGL_CHECK_ERRORS;

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    OPENGL_CHECK_ERRORS;
    glDisable(GL_BLEND);
    OPENGL_CHECK_ERRORS;

    glFrontFace(GL_CCW);
    OPENGL_CHECK_ERRORS;
    glDisable(GL_CULL_FACE);
    OPENGL_CHECK_ERRORS;
    //glDisable(GL_NORMALIZE);
    //OPENGL_CHECK_ERRORS;

    glDepthFunc(GL_LEQUAL);
    OPENGL_CHECK_ERRORS;
    glEnable(GL_DEPTH_TEST);
    OPENGL_CHECK_ERRORS;

    //glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    //OPENGL_CHECK_ERRORS;

    glEnable(GL_BLEND);
    OPENGL_CHECK_ERRORS;
    //glEnable(GL_ALPHA_TEST);
    //OPENGL_CHECK_ERRORS;

    //glMatrixMode(GL_PROJECTION);
    //OPENGL_CHECK_ERRORS;
    //glLoadIdentity();
    //OPENGL_CHECK_ERRORS;
    
    glDepthRangef(0.0f, 1.0f);
    OPENGL_CHECK_ERRORS;
}
//!Method responsible for booting Shader
void MainGraphic::initializeShader()
{
    this->shader = new Shader();
    glEnable(GL_DEPTH_TEST);

    glClearDepthf(1.0f);
	glDepthFunc(GL_LEQUAL);
}
Exemplo n.º 23
0
void OGLRender::ClearZBuffer(float depth)
{
    uint32 flag=GL_DEPTH_BUFFER_BIT;
    glClearDepthf(depth);
    OPENGL_CHECK_ERRORS;
    glClear(flag);
    OPENGL_CHECK_ERRORS;
}
Exemplo n.º 24
0
void RenderCB(GlRunner *runner)
{
	glClearColor(0.2, 0.1, 0.2, 0.0);
	glClearDepthf(1.0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
Exemplo n.º 25
0
	void OGLESRenderEngine::ClearDepth(GLfloat depth)
	{
		if (depth != clear_depth_)
		{
			glClearDepthf(depth);
			clear_depth_ = depth;
		}
	}
Exemplo n.º 26
0
void GL__ClearDepth(::uStatic* __this, float depth_)
{
    #ifdef XLI_GL_DESKTOP
                    glClearDepth((double)depth_);
    #else
                    glClearDepthf(depth_);
    #endif
}
Exemplo n.º 27
0
void PGlState::setDepthClearValue(pfloat32 value)
{
    if (value != m_depthClearValue)
    {
        m_depthClearValue = value;
        glClearDepthf(value);
    }
}
Exemplo n.º 28
0
void XGraphicsOpenGL::RestoreDevice()
{
	
	XTRACE("restore device resource");
	GLint sizeMax = 2048;
	CHECK_GL_ERROR();
	
	glGetIntegerv( GL_MAX_TEXTURE_SIZE, (GLint*)&sizeMax );
//#if defined(WIN32) && defined(_DEBUG)
	// 사양이 좋은 기기여서 아틀라스가 8096까지 늘어난다고 치면 만약 단한번이라도 텍스쳐 스위칭이 일어나면 스트레스가 매우 심할듯 싶어 안정적인 수치인 2048로 고정함
	if( sizeMax > 2048 )
		sizeMax = 2048;			// 최저사양폰을 위한.
//#endif // 
	XSurface::SetMaxSurfaceWidth( sizeMax );
	XTRACE( "max texture size:%d", sizeMax );
	// 여기서 에러나면 그것은 OpenGL ES 2.0으로 초기화했기때문이다. 2.0에는 glMatrixMode라는게 없다.
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	// Set a blending function to use
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	// Enable blending
	glEnable(GL_BLEND);
	CHECK_GL_ERROR();
	
//  	glEnable( GL_DEPTH_TEST );
//  	CHECK_GL_ERROR();
	glDisable( GL_DEPTH_TEST );
	CHECK_GL_ERROR();
	glDepthFunc( GL_GEQUAL );
	CHECK_GL_ERROR();
	glClearDepthf( -1000.f );
	CHECK_GL_ERROR();

	// 세이더 로딩
	XTRACE("col tex shader loading....");
	m_pShaderColTex->LoadShaderFromStr( xvShaderColTex,
																			xfShaderColTex,
																			"base_shader" );
	XTRACE( "col tex alpha test shader loading...." );
	m_pShaderColTexAlphaTest->LoadShaderFromStr( xvShaderColTex,
																							 xfShaderColTexAlphaTest,
																							 "alpha_test_shader" );
	XTRACE("texture shader loading....");
	m_pTextureShader->LoadShaderFromStr( xvShader_Texture, xfShader_Texture, "texture_shader" );
	XTRACE("gray shader loading....");
	m_pGrayShader->LoadShaderFromStr( xvShaderColTex, xfShader_Gray, "gray_shader" );
	XTRACE("color shader loading....");
	m_pColorShader->LoadShaderFromStr( xvShader_Color, xfShader_Color, "color_shader");
	XTRACE("onecolor shader loading....");
	m_pOneColorShader->LoadShaderFromStr( xvShader_OneColor, xfShader_OneColor, "one_color shader" );
	XTRACE("blurH shader loading....");
	m_pBlurShaderH->LoadShaderFromStr( xvShaderColTex, xfShader_blurH, "blurH_shader" );
	XTRACE("blurV shader loading....");
	m_pBlurShaderV->LoadShaderFromStr( xvShaderColTex, xfShader_blurV, "blurV_shader" );
	// 현재 쉐이더를 지정
	XGraphicsOpenGL::sSetShader( m_pShaderColTex );
	
}
Exemplo n.º 29
0
void GraphicsContext3D::clearDepth(GC3Dclampf depth)
{
    makeContextCurrent();
#if defined(QT_OPENGL_ES_2)
    glClearDepthf(depth);
#else
    glClearDepth(depth);
#endif
}
 void GLES2StateCacheManagerImp::setClearDepth(GLclampf depth)
 {
     if(mClearDepth != depth)
     {
         mClearDepth = depth;
         
         OGRE_CHECK_GL_ERROR(glClearDepthf(depth));
     }
 }