コード例 #1
0
ファイル: clips.c プロジェクト: lcrs/6ilk
/* Draws the clips interface elements */
void clipsDraw(uint8_t channelIndex) {
	uint8_t			i;
	uint16_t		x, y;
	struct clip_t		*s;
	
	x = channelIndex * (360 + 90) + 45;
		
	for(i = 0; i < state.channels[channelIndex].clipCount; i++) {
		s = clipGet(channelIndex, i);
				
		y = 576 + i * 72;
		
		if(s->ready) {
			glColor3f(1.0, 1.0, 1.0);
		} else {
			glColor3f(0.2, 0.2, 0.2);
		}
		
		glActiveTexture(GL_TEXTURE0);
		glEnable(GL_TEXTURE_RECTANGLE_NV);
		glBindTexture(GL_TEXTURE_RECTANGLE_NV, s->texture);
		
		glBegin(GL_QUADS);
		glMultiTexCoord2i(GL_TEXTURE0, 0, 72);
		glVertex2i(x, y);
		glMultiTexCoord2i(GL_TEXTURE0, 90, 72);
		glVertex2i(x + 90, y);
		glMultiTexCoord2i(GL_TEXTURE0, 90, 0);
		glVertex2i(x + 90, y + 72);
		glMultiTexCoord2i(GL_TEXTURE0, 0, 0);
		glVertex2i(x, y + 72);
		glEnd();
				
		glDisable(GL_TEXTURE_RECTANGLE_NV);
		
		/* Current clip highlight */
		if(i == state.channels[channelIndex].current) {
			lightenRect(x, y, 90, 72);
		}
	}
	
	/* Mouseove highlight */
	if(state.over == 9 + channelIndex
	   && state.overSub < state.channels[channelIndex].clipCount
	   && state.overSub != state.channels[channelIndex].current) {
		lightenRect(45 + channelIndex * (90 + 360), 576 + state.overSub * 72, 90, 72);
	}
		
	glColor3f(1.0, 1.0, 1.0);
}
コード例 #2
0
bool glgfx_sprite_render(struct glgfx_sprite* sprite) {
  struct glgfx_context* context = glgfx_context_getcurrent();

  GLenum unit = glgfx_context_bindtex(context, 0, sprite->bitmap, sprite->interpolated);
  glgfx_context_bindprogram(context, &plain_texture_blitter);
  glgfx_context_checkstate(context);

  glBegin(GL_QUADS); {
    glMultiTexCoord2i(unit,
		      0,
		      0);
    glVertex2i(sprite->x,
	       sprite->y);

    glMultiTexCoord2i(unit, 
		      sprite->bitmap->width,
		      0);
    glVertex2i(sprite->x + sprite->width, 
	       sprite->y);

    glMultiTexCoord2i(unit, 
		      sprite->bitmap->width,  
		      sprite->bitmap->height);
    glVertex2i(sprite->x + sprite->width, 
	       sprite->y + sprite->height);

    glMultiTexCoord2i(unit,
		      0,  
		      sprite->bitmap->height);
    glVertex2i(sprite->x,
	       sprite->y + sprite->height);
  }
  glEnd();

  GLGFX_CHECKERROR();

  return true;
}
コード例 #3
0
ファイル: shadernode.cpp プロジェクト: bigfug/Fugio
void ShaderNode::inputsUpdated( qint64 pTimeStamp )
{
	fugio::Performance	Perf( mNode, "inputsUpdated" );

	if( !mInitialised )
	{
		return;
	}

	OPENGL_PLUGIN_DEBUG;

	if( mPinShaderVertex->isUpdated( mLastShaderLoad ) || mPinShaderGeometry->isUpdated( mLastShaderLoad ) || mPinShaderFragment->isUpdated( mLastShaderLoad ) )
	{
		loadShader();

		mLastShaderLoad = pTimeStamp;
	}

	OPENGL_PLUGIN_DEBUG;

	if( !mProgramLinked )
	{
		return;
	}

	//-------------------------------------------------------------------------

	int		W, H, D;

	QList< QSharedPointer<InterfacePin> >	OutPinLst = mNode->enumOutputPins();
	QList< QSharedPointer<InterfacePin> >	InpPinLst = mNode->enumInputPins();

	//-------------------------------------------------------------------------

	glUseProgram( mProgramId );

	OPENGL_PLUGIN_DEBUG;

	QList<ShaderBindData>		Bindings;

	updateUniforms( Bindings, pTimeStamp );

	if( mPinOutputGeometry->isConnectedToActiveNode() )
	{
		mNode->context()->pinUpdated( mPinOutputGeometry );
	}

	if( activeBufferCount( OutPinLst ) == 0 )
	{
		glUseProgram( 0 );

		return;
	}

	//-------------------------------------------------------------------------
	// Bind all output buffers

	QVector<GLenum>		Buffers;

	bindOutputBuffers( Buffers, OutPinLst, W, H, D );

	if( mFrameBufferId != 0 )
	{
		glBindFramebuffer( GL_FRAMEBUFFER, mFrameBufferId );

		if( !Buffers.empty() )
		{
			glDrawBuffers( Buffers.size(), Buffers.data() );

			OPENGL_PLUGIN_DEBUG;
		}

		if( glCheckFramebufferStatus( GL_FRAMEBUFFER ) != GL_FRAMEBUFFER_COMPLETE )
		{
			qDebug() << "glCheckFramebufferStatus( GL_FRAMEBUFFER ) != GL_FRAMEBUFFER_COMPLETE";
		}
	}

	//-------------------------------------------------------------------------

	InterfaceOpenGLState		*State = 0;

	if( mPinState->isConnected() )
	{
		State = qobject_cast<InterfaceOpenGLState *>( mPinState->connectedPin()->control()->object() );
	}

	if( State != 0 )
	{
		State->stateBegin();
	}

	//-------------------------------------------------------------------------

	if( true )
	{
		glViewport( 0, 0, W, H );

		glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

		QList<InterfaceGeometry*>		GeometryList;

		for( QList< QSharedPointer<InterfacePin> >::iterator it = InpPinLst.begin() ; it != InpPinLst.end() ; it++ )
		{
			QSharedPointer<InterfacePin>	InpPin = *it;

			if( !InpPin->isConnectedToActiveNode() )
			{
				continue;
			}

			QSharedPointer<InterfacePinControl>		 GeometryControl = InpPin->connectedPin()->control();

			InterfaceGeometry		*Geometry = ( GeometryControl.isNull() ? 0 : qobject_cast<InterfaceGeometry *>( GeometryControl->object() ) );

			if( Geometry != 0 )
			{
				GeometryList.append( Geometry );
			}
		}

		if( GeometryList.isEmpty() )
		{
			QMatrix4x4		pmvMatrix;

			pmvMatrix.setToIdentity();

			pmvMatrix.ortho( QRect( QPoint( 0, 0 ), QSize( W, H ) ) );

			glMatrixMode( GL_PROJECTION );
			glLoadIdentity();

			glLoadMatrixf( pmvMatrix.constData() );

			//Initialize Modelview Matrix
			glMatrixMode( GL_MODELVIEW );
			glLoadIdentity();

			glColor4f( 1.0, 1.0, 1.0, 1.0 );

			//glEnable( GL_BLEND );

			//glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

			//glActiveTexture( GL_TEXTURE0 );

			OPENGL_PLUGIN_DEBUG;

			GLint		x0 = 0;
			GLint		x1 = W;
			GLint		y0 = 0;
			GLint		y1 = H;

			glBegin( GL_QUADS );
				glMultiTexCoord2i( GL_TEXTURE0, x0, y1 );	glMultiTexCoord2f( GL_TEXTURE1, 0, 1 );		glVertex2i( x0, y0 );
				glMultiTexCoord2i( GL_TEXTURE0, x1, y1 );	glMultiTexCoord2f( GL_TEXTURE1, 1, 1 );		glVertex2i( x1, y0 );
				glMultiTexCoord2i( GL_TEXTURE0, x1, y0 );	glMultiTexCoord2f( GL_TEXTURE1, 1, 0 );		glVertex2i( x1, y1 );
				glMultiTexCoord2i( GL_TEXTURE0, x0, y0 );	glMultiTexCoord2f( GL_TEXTURE1, 0, 0 );		glVertex2i( x0, y1 );
			glEnd();
		}
		else
		{
			glMatrixMode( GL_PROJECTION );
			glLoadIdentity();

			//Initialize Modelview Matrix
			glMatrixMode( GL_MODELVIEW );
			glLoadIdentity();

			glColor4f( 1.0, 1.0, 1.0, 1.0 );

			//glEnable( GL_BLEND );

			//glBlendFunc( GL_ONE, GL_ONE );

			//glActiveTexture( GL_TEXTURE0 );

			OPENGL_PLUGIN_DEBUG;

			//glTranslatef( 0.0f, 0.0f, -5.0f );

			foreach( InterfaceGeometry *Geometry, GeometryList )
			{
				Geometry->drawGeometry();
			}
		}

		OPENGL_PLUGIN_DEBUG;
	}
コード例 #4
0
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL13_nglMultiTexCoord2i(JNIEnv *__env, jclass clazz, jint texture, jint s, jint t, jlong __functionAddress) {
	glMultiTexCoord2iPROC glMultiTexCoord2i = (glMultiTexCoord2iPROC)(intptr_t)__functionAddress;
	UNUSED_PARAMS(__env, clazz)
	glMultiTexCoord2i(texture, s, t);
}