• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ qglViewport函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetDC

void idGLWidget::OnPaint()
{

    if (!initialized)
    {
        CDC *dc = GetDC();
        QEW_SetupPixelFormat(dc->m_hDC);
        ReleaseDC(dc);
        initialized = true;
    }
    CPaintDC dc(this); // device context for painting

    CRect rect;
    GetClientRect(rect);

    if (!qwglMakeCurrent(dc.m_hDC, win32.hGLRC))
    {
    }

    qglViewport(0, 0, rect.Width(), rect.Height());
    qglScissor(0, 0, rect.Width(), rect.Height());
    qglMatrixMode(GL_PROJECTION);
    qglLoadIdentity();
    qglClearColor (0.4f, 0.4f, 0.4f, 0.7f);
    qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


    qglDisable(GL_DEPTH_TEST);
    qglDisable(GL_BLEND);
    qglOrtho(0, rect.Width(), 0, rect.Height(), -256, 256);

    if (drawable)
    {
        drawable->draw(1, 1, rect.Width()-1, rect.Height()-1);
    }
    else
    {
        qglViewport(0, 0, rect.Width(), rect.Height());
        qglScissor(0, 0, rect.Width(), rect.Height());
        qglMatrixMode(GL_PROJECTION);
        qglLoadIdentity();
        qglClearColor (0.4f, 0.4f, 0.4f, 0.7f);
        qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    }

    qwglSwapBuffers(dc);
    qglFlush();
    qwglMakeCurrent(win32.hDC, win32.hGLRC);

}
开发者ID:revelator,项目名称:Revelator-Doom3,代码行数:50,代码来源:GLWidget.cpp


示例2: RB_SetGL2D

/*
================
RB_SetGL2D

================
*/
void    RB_SetGL2D(void)
{
	backEnd.projection2D = qtrue;

	// set 2D virtual screen size
	qglViewport(0, 0, glConfig.vidWidth, glConfig.vidHeight);
	qglScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
	qglMatrixMode(GL_PROJECTION);
	qglLoadIdentity();
	qglOrtho(0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1);
	qglMatrixMode(GL_MODELVIEW);
	qglLoadIdentity();

	GL_State(GLS_DEPTHTEST_DISABLE |
	         GLS_SRCBLEND_SRC_ALPHA |
	         GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA);

	qglDisable(GL_FOG);   //----(SA)    added

	qglDisable(GL_CULL_FACE);
	qglDisable(GL_CLIP_PLANE0);

	// set time for 2D shaders
	backEnd.refdef.time = ri.Milliseconds();
	backEnd.refdef.floatTime = backEnd.refdef.time * 0.001f;
}
开发者ID:Diskutant,项目名称:RTCW-SP,代码行数:32,代码来源:tr_backend.c


示例3: RB_SetGL2D

/*
================
RB_SetGL2D

================
*/
void	RB_SetGL2D (void) {
	if ( tess.numIndexes | tess.numVertexes )
		Com_Printf(" Going 2d with verts?" );
	backEnd.projection2D = qtrue;
	backEnd.currentModel = 0;
	
	// set 2D virtual screen size
	qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
	qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
	qglMatrixMode(GL_PROJECTION);
    qglLoadIdentity ();
	qglOrtho (0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1);
	qglMatrixMode(GL_MODELVIEW);
    qglLoadIdentity ();

	GL_State( GLS_DEPTHTEST_DISABLE |
			  GLS_SRCBLEND_SRC_ALPHA |
			  GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );

	GL_Cull( CT_TWO_SIDED );
	qglDisable( GL_CLIP_PLANE0 );

	// set time for 2D shaders
//	tess.shaderTime = ri.Milliseconds();
}
开发者ID:entdark,项目名称:q3mme,代码行数:31,代码来源:tr_backend.c


示例4: RB_Viewport

/*
* RB_Viewport
*/
void RB_Viewport( int x, int y, int w, int h )
{
    rb.gl.viewport[0] = x;
    rb.gl.viewport[1] = y;
    rb.gl.viewport[2] = w;
    rb.gl.viewport[3] = h;
    qglViewport( x, rb.gl.fbHeight - h - y, w, h );
}
开发者ID:DenMSC,项目名称:qfusion,代码行数:11,代码来源:r_backend.c


示例5: SetViewportAndScissor

static void SetViewportAndScissor( void ) {
	GL_SetProjectionMatrix( backEnd.viewParms.projectionMatrix );

	// set the window clipping
	qglViewport( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, 
		backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
	qglScissor( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, 
		backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
}
开发者ID:Thehsvdude,项目名称:ioq3,代码行数:9,代码来源:tr_backend.c


示例6: R_BloomScreen

/*
=================
R_BloomScreen
=================
*/
void R_BloomScreen( void )
{
	if( !r_bloom->integer )
		return;
	if(r_bloom_sky_only->integer)
		return;
	if ( backEnd.doneBloom )
		return;
	if ( !backEnd.doneSurfaces )
		return;
	backEnd.doneBloom = qtrue;
	if( !bloom.started ) {
		R_Bloom_InitTextures();
		if( !bloom.started )
			return;
	}

	if ( !backEnd.projection2D )
		RB_SetGL2D();
#if 0
	// set up full screen workspace
	GL_TexEnv( GL_MODULATE );
	qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
	qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
	qglMatrixMode( GL_PROJECTION );
    qglLoadIdentity ();
	qglOrtho( 0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1 );
	qglMatrixMode( GL_MODELVIEW );
    qglLoadIdentity ();

	GL_Cull( CT_TWO_SIDED );
#endif

	qglColor4f( 1, 1, 1, 1 );

	//Backup the old screen in a texture
	R_Bloom_BackupScreen();
	// create the bloom texture using one of a few methods
	if(r_bloom_cascade->integer)
		R_Bloom_Cascaded();
	else
		R_Bloom_WarsowEffect ();
//	R_Bloom_CreateEffect();
	// restore the screen-backup to the screen
	R_Bloom_RestoreScreen();
	// Do the final pass using the bloom texture for the final effect
	R_Bloom_DrawEffect ();

// 	LEILEI - Lens Bloom Hack
//		The concept of this is to inverse the coordinates on both X and Y,
//		then scale outward using the offset value applied, as well as the modulated color
//		applied to give a rainbow streak effect.  Most effective with high bloom darkness
//		values.
	if(r_bloom_reflection->integer)
	R_Bloom_LensEffect ();
}
开发者ID:lrq3000,项目名称:openarena_engine,代码行数:61,代码来源:tr_bloom.c


示例7: SetViewportAndScissor

void SetViewportAndScissor( void ) {
	qglMatrixMode(GL_PROJECTION);
	qglLoadMatrixf( backEnd.viewParms.projectionMatrix );
	qglMatrixMode(GL_MODELVIEW);

	// set the window clipping
	qglViewport( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, 
		backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
	qglScissor( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, 
		backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
}
开发者ID:CairnTrenor,项目名称:OpenJK,代码行数:11,代码来源:tr_backend.cpp


示例8: GL_Viewport

/*
 ==================
 GL_Viewport
 ==================
*/
void GL_Viewport (rect_t rect){

	if (glState.viewportX == rect.x && glState.viewportY == rect.y && glState.viewportWidth == rect.width && glState.viewportHeight == rect.height)
		return;

	glState.viewportX = rect.x;
	glState.viewportY = rect.y;
	glState.viewportWidth = rect.width;
	glState.viewportHeight = rect.height;

	qglViewport(rect.x, rect.y, rect.width, rect.height);
}
开发者ID:Mirrorman95,项目名称:quake-2-evolved,代码行数:17,代码来源:r_glState.c


示例9: SetViewportAndScissor

static void SetViewportAndScissor( void ) {
	qglMatrixMode(GL_PROJECTION);
	qglLoadMatrixf( backEnd.viewParms.projectionMatrix );
	qglMatrixMode(GL_MODELVIEW);

	// set the window clipping
	qglViewport( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, 
		backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
	qglScissor( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, 
		backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
	Matrix4Copy(backEnd.viewParms.projectionMatrix, glState.currentProjectionMatrix);
	Matrix4Multiply(glState.currentProjectionMatrix, glState.currentModelViewMatrix, glState.currentModelViewProjectionMatrix);
}
开发者ID:lrq3000,项目名称:openarena_engine,代码行数:13,代码来源:tr_backend.c


示例10: qglViewport

void idGLDrawableView::draw(int x, int y, int w, int h)
{
    int i;
    renderView_t	refdef;
    const idMaterial		*mat = material;

    if (mat)
    {
        qglViewport(x, y, w, h);
        qglScissor(x, y, w, h);
        qglMatrixMode(GL_PROJECTION);
        qglClearColor( 0.1f, 0.1f, 0.1f, 0.0f );
        qglClear(GL_COLOR_BUFFER_BIT);

        UpdateLights();

        // render it
        renderSystem->BeginFrame(w, h);

        memset( &refdef, 0, sizeof( refdef ) );

        UpdateCamera( &refdef );

        // Copy global shaderparms to view
        for( i = 0; i < MAX_GLOBAL_SHADER_PARMS; i++ )
        {
            refdef.shaderParms[ i ] = globalParms[ i ];
        }

        refdef.width = SCREEN_WIDTH;
        refdef.height = SCREEN_HEIGHT;
        refdef.fov_x = 90;
        refdef.fov_y = 2 * atan((float)h / w) * idMath::M_RAD2DEG;

        refdef.time = eventLoop->Milliseconds();

        world->RenderScene( &refdef );

        if ( showLights )
        {
            drawLights( &refdef );
        }

        renderSystem->EndFrame( NULL, NULL );

        world->DebugClearLines( refdef.time );

        qglMatrixMode( GL_MODELVIEW );
        qglLoadIdentity();
    }
}
开发者ID:revelator,项目名称:Revelator-Doom3,代码行数:51,代码来源:MaterialPreviewView.cpp


示例11: RB_SetGL2D

/*
================
RB_SetGL2D

================
*/
void	RB_SetGL2D (void) {
	backEnd.projection2D = qtrue;

	// set 2D virtual screen size
#ifdef IPHONE
	if ( glConfig.vidRotation == 90.0 || glConfig.vidRotation == 270.0 )
	{
		qglViewport ( 0, 0, glConfig.vidHeight, glConfig.vidWidth );
		qglScissor( 0, 0, glConfig.vidHeight, glConfig.vidWidth );
	}
	else
#endif // IPHONE
	{
		qglViewport ( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
		qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
	}
	qglMatrixMode(GL_PROJECTION);
    qglLoadIdentity ();
#ifdef IPHONE
	qglRotatef (glConfig.vidRotation, 0, 0, 1);
	qglTranslatef (0, 0, 0);
#endif // IPHONE
	qglOrtho (0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1);
	qglMatrixMode(GL_MODELVIEW);
    qglLoadIdentity ();
	
	GL_State( GLS_DEPTHTEST_DISABLE |
			  GLS_SRCBLEND_SRC_ALPHA |
			  GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );

	qglDisable( GL_CULL_FACE );
	qglDisable( GL_CLIP_PLANE0 );

	// set time for 2D shaders
	backEnd.refdef.time = ri.Milliseconds();
	backEnd.refdef.floatTime = backEnd.refdef.time * 0.001f;
}
开发者ID:alexander-pick,项目名称:Quake3-HD--iPAD-,代码行数:43,代码来源:tr_backend.c


示例12: SetViewportAndScissor

static void SetViewportAndScissor( void ) {
	qglMatrixMode( GL_PROJECTION );
	qglLoadMatrixf( backEnd.viewParms.projectionMatrix );
	qglMatrixMode( GL_MODELVIEW );

	// set the window clipping
	qglViewport(    backEnd.viewParms.viewportX,
					backEnd.viewParms.viewportY,
					backEnd.viewParms.viewportWidth,
					backEnd.viewParms.viewportHeight );

// TODO: insert handling for widescreen?  (when looking through camera)
	qglScissor(     backEnd.viewParms.viewportX,
					backEnd.viewParms.viewportY,
					backEnd.viewParms.viewportWidth,
					backEnd.viewParms.viewportHeight );
}
开发者ID:NewsNoobDude,项目名称:RTCW-SP-linux,代码行数:17,代码来源:tr_backend.c


示例13: RB_SetGL2D

/*
================
RB_SetGL2D

================
*/
void	RB_SetGL2D (void) {
	mat4_t matrix;
	int width, height;

	if (backEnd.projection2D && backEnd.last2DFBO == glState.currentFBO)
		return;

	backEnd.projection2D = qtrue;
	backEnd.last2DFBO = glState.currentFBO;

	if (glState.currentFBO)
	{
		width = glState.currentFBO->width;
		height = glState.currentFBO->height;
	}
	else
	{
		width = glConfig.vidWidth;
		height = glConfig.vidHeight;
	}

	// set 2D virtual screen size
	qglViewport( 0, 0, width, height );
	qglScissor( 0, 0, width, height );

	Mat4Ortho(0, width, height, 0, 0, 1, matrix);
	GL_SetProjectionMatrix(matrix);
	Mat4Identity(matrix);
	GL_SetModelviewMatrix(matrix);

	GL_State( GLS_DEPTHTEST_DISABLE |
			  GLS_SRCBLEND_SRC_ALPHA |
			  GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );

	qglDisable( GL_CULL_FACE );
	qglDisable( GL_CLIP_PLANE0 );

	// set time for 2D shaders
	backEnd.refdef.time = ri.Milliseconds();
	backEnd.refdef.floatTime = backEnd.refdef.time * 0.001f;

	// reset color scaling
	backEnd.refdef.colorScale = 1.0f;
}
开发者ID:Thehsvdude,项目名称:ioq3,代码行数:50,代码来源:tr_backend.c


示例14: RB_SetGL2D

/*
=============
RB_SetGL2D

This is not used by the normal game paths, just by some tools
=============
*/
void RB_SetGL2D( void ) {
	// set 2D virtual screen size
	qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
	if ( r_useScissor.GetBool() ) {
		qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
	}
	qglMatrixMode( GL_PROJECTION );
    qglLoadIdentity();
	qglOrtho( 0, 640, 480, 0, 0, 1 );		// always assume 640x480 virtual coordinates
	qglMatrixMode( GL_MODELVIEW );
    qglLoadIdentity();

	GL_State( GLS_DEPTHFUNC_ALWAYS |
			  GLS_SRCBLEND_SRC_ALPHA |
			  GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );

	GL_Cull( CT_TWO_SIDED );

	qglDisable( GL_DEPTH_TEST );
	qglDisable( GL_STENCIL_TEST );
}
开发者ID:albertz,项目名称:iodoom3,代码行数:28,代码来源:tr_backend.cpp


示例15: SetViewportAndScissor

static void SetViewportAndScissor( void ) {
	qglMatrixMode(GL_PROJECTION);
	qglLoadMatrixf( backEnd.viewParms.projectionMatrix );
	qglMatrixMode(GL_MODELVIEW);

	// set the window clipping
	qglViewport( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, 
		backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );

    if(r_subviewScissor->integer)
    {
        qglScissor( backEnd.viewParms.scissorMinX, backEnd.viewParms.scissorMinY, 
            backEnd.viewParms.scissorMaxX - backEnd.viewParms.scissorMinX, 
            backEnd.viewParms.scissorMaxY - backEnd.viewParms.scissorMinY );
    }
    else
    {
        qglScissor( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, 
            backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
    }
}
开发者ID:asvo,项目名称:quake3.gpl.old,代码行数:21,代码来源:tr_backend.c


示例16: RB_BeginDrawingView

/*
=================
RB_BeginDrawingView

Any mirrored or portaled views have already been drawn, so prepare
to actually render the visible surfaces for this view
=================
*/
void RB_BeginDrawingView (void) {
	// set the modelview matrix for the viewer
	qglMatrixMode(GL_PROJECTION);
	qglLoadMatrixf( backEnd.viewDef->projectionMatrix );
	qglMatrixMode(GL_MODELVIEW);

	// set the window clipping
	qglViewport( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1, 
		tr.viewportOffset[1] + backEnd.viewDef->viewport.y1, 
		backEnd.viewDef->viewport.x2 + 1 - backEnd.viewDef->viewport.x1,
		backEnd.viewDef->viewport.y2 + 1 - backEnd.viewDef->viewport.y1 );

	// the scissor may be smaller than the viewport for subviews
	qglScissor( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1 + backEnd.viewDef->scissor.x1, 
		tr.viewportOffset[1] + backEnd.viewDef->viewport.y1 + backEnd.viewDef->scissor.y1, 
		backEnd.viewDef->scissor.x2 + 1 - backEnd.viewDef->scissor.x1,
		backEnd.viewDef->scissor.y2 + 1 - backEnd.viewDef->scissor.y1 );
	backEnd.currentScissor = backEnd.viewDef->scissor;

	// ensures that depth writes are enabled for the depth clear
	GL_State( GLS_DEFAULT );

	// we don't have to clear the depth / stencil buffer for 2D rendering
	if ( backEnd.viewDef->viewEntitys ) {
		qglStencilMask( 0xff );
		// some cards may have 7 bit stencil buffers, so don't assume this
		// should be 128
		qglClearStencil( 1<<(glConfig.stencilBits-1) );
		qglClear( GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
		qglEnable( GL_DEPTH_TEST );
	} else {
		qglDisable( GL_DEPTH_TEST );
		qglDisable( GL_STENCIL_TEST );
	}

	backEnd.glState.faceCulling = -1;		// force face culling to set next time
	GL_Cull( CT_FRONT_SIDED );

}
开发者ID:0culus,项目名称:Doom3-for-MacOSX-,代码行数:47,代码来源:tr_render.cpp


示例17: R_PostprocessScreen

/*
=================
R_PostprocessScreen
=================
*/
void R_PostprocessScreen( void )
{
	if( !postprocess )
		return;
	if ( backEnd.donepostproc )
		return;
	if ( !backEnd.doneSurfaces )
		return;
	backEnd.donepostproc = qtrue;
	if( !postproc.started ) {
		R_Postprocess_InitTextures();
		if( !postproc.started )
			return;
	}

	if ( !backEnd.projection2D )
		RB_SetGL2D();
#if 0
	// set up full screen workspace
	GL_TexEnv( GL_MODULATE );
	qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
	qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
	qglMatrixMode( GL_PROJECTION );
    qglLoadIdentity ();
	qglOrtho( 0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1 );
	qglMatrixMode( GL_MODELVIEW );
    qglLoadIdentity ();

	GL_Cull( CT_TWO_SIDED );
#endif

	qglColor4f( 1, 1, 1, 1 );

	//Backup the old screen in a texture
	R_Postprocess_BackupScreen();
	//Redraw texture using GLSL program
	R_Bloom_RestoreScreen_Postprocessed();
}
开发者ID:lrq3000,项目名称:openarena_engine,代码行数:43,代码来源:tr_bloom.c


示例18: GL_State

void idGLDrawable::draw(int x, int y, int w, int h) {
    GL_State( GLS_DEFAULT );
    qglViewport(x, y, w, h);
    qglScissor(x, y, w, h);
    qglMatrixMode(GL_PROJECTION);
    qglClearColor( 0.1f, 0.1f, 0.1f, 0.0f );
    qglClear(GL_COLOR_BUFFER_BIT);
    qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
    qglLineWidth(0.5);
    qglColor3f(1, 1, 1);
    globalImages->BindNull();
    qglBegin(GL_LINE_LOOP);
    qglColor3f(1, 0, 0);
    qglVertex2f(x + 3, y + 3);
    qglColor3f(0, 1, 0);
    qglVertex2f(x + 3, h - 3);
    qglColor3f(0, 0, 1);
    qglVertex2f(w - 3, h - 3);
    qglColor3f(1, 1, 1);
    qglVertex2f(w - 3, y + 3);
    qglEnd();

}
开发者ID:Salamek,项目名称:Shadow-of-Dust,代码行数:23,代码来源:GLWidget.cpp


示例19: Unicode_Setup2D

	// Based on RB_SetGL2D(): FIXME? Code duplication can probably be avoided.
	static void Unicode_Setup2D (void) {
		backEnd.projection2D = qtrue;

		// set 2D virtual screen size
		qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
		qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
		qglMatrixMode(GL_PROJECTION);
		qglLoadIdentity ();
		qglOrtho (0, glConfig.vidWidth, glConfig.vidHeight, 0, -200, 200); // This changed. FIXME? Perhaps do it beter.
		qglMatrixMode(GL_MODELVIEW);
		qglLoadIdentity ();
				
		GL_State( GLS_DEPTHTEST_DISABLE |
					GLS_SRCBLEND_SRC_ALPHA |
					GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );

		qglDisable( GL_CULL_FACE );
		qglDisable( GL_CLIP_PLANE0 );
		qglDisable( GL_CLIP_PLANE1 );

		// set time for 2D shaders
		//backEnd.refdef.time = ri.Milliseconds();
		//backEnd.refdef.floatTime = backEnd.refdef.time * 0.001f;
	}
开发者ID:anthonynguyen,项目名称:ioq3-mitsu,代码行数:25,代码来源:ioq3-urt_Unicode.c


示例20: FBO_BlitFromTexture

void FBO_BlitFromTexture(struct image_s *src, ivec4_t inSrcBox, vec2_t inSrcTexScale, FBO_t *dst, ivec4_t inDstBox, struct shaderProgram_s *shaderProgram, vec4_t inColor, int blend)
{
	ivec4_t dstBox, srcBox;
	vec2_t srcTexScale;
	vec4_t color;
	vec4_t quadVerts[4];
	vec2_t texCoords[4];
	vec2_t invTexRes;
	FBO_t *oldFbo = glState.currentFBO;
	mat4_t projection;
	int width, height;

	if (!src)
		return;

	if (inSrcBox)
	{
		VectorSet4(srcBox, inSrcBox[0], inSrcBox[1], inSrcBox[0] + inSrcBox[2],  inSrcBox[1] + inSrcBox[3]);
	}
	else
	{
		VectorSet4(srcBox, 0, 0, src->width, src->height);
	}

	// framebuffers are 0 bottom, Y up.
	if (inDstBox)
	{
		if (dst)
		{
			dstBox[0] = inDstBox[0];
			dstBox[1] = dst->height - inDstBox[1] - inDstBox[3];
			dstBox[2] = inDstBox[0] + inDstBox[2];
			dstBox[3] = dst->height - inDstBox[1];
		}
		else
		{
			dstBox[0] = inDstBox[0];
			dstBox[1] = glConfig.vidHeight - inDstBox[1] - inDstBox[3];
			dstBox[2] = inDstBox[0] + inDstBox[2];
			dstBox[3] = glConfig.vidHeight - inDstBox[1];
		}
	}
	else if (dst)
	{
		VectorSet4(dstBox, 0, dst->height, dst->width, 0);
	}
	else
	{
		VectorSet4(dstBox, 0, glConfig.vidHeight, glConfig.vidWidth, 0);
	}

	if (inSrcTexScale)
	{
		VectorCopy2(inSrcTexScale, srcTexScale);
	}
	else
	{
		srcTexScale[0] = srcTexScale[1] = 1.0f;
	}

	if (inColor)
	{
		VectorCopy4(inColor, color);
	}
	else
	{
		VectorCopy4(colorWhite, color);
	}

	if (!shaderProgram)
	{
		shaderProgram = &tr.textureColorShader;
	}

	FBO_Bind(dst);

	if (glState.currentFBO)
	{
		width = glState.currentFBO->width;
		height = glState.currentFBO->height;
	}
	else
	{
		width = glConfig.vidWidth;
		height = glConfig.vidHeight;
	}

	qglViewport( 0, 0, width, height );
	qglScissor( 0, 0, width, height );

	Mat4Ortho(0, width, height, 0, 0, 1, projection);

	qglDisable( GL_CULL_FACE );

	GL_BindToTMU(src, TB_COLORMAP);

	VectorSet4(quadVerts[0], dstBox[0], dstBox[1], 0, 1);
	VectorSet4(quadVerts[1], dstBox[2], dstBox[1], 0, 1);
	VectorSet4(quadVerts[2], dstBox[2], dstBox[3], 0, 1);
	VectorSet4(quadVerts[3], dstBox[0], dstBox[3], 0, 1);
//.........这里部分代码省略.........
开发者ID:DaneTheory,项目名称:spearmint,代码行数:101,代码来源:tr_fbo.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ qgsDoubleNear函数代码示例发布时间:2022-05-30
下一篇:
C++ qglVertex2f函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap