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


C++ qglViewport函数代码示例

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


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


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