Esempio n. 1
0
void entrypoint( void )
{ 
    // full screen
    if( ChangeDisplaySettings(&screenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) return; ShowCursor( 0 );

    // create windows
    HDC hDC = GetDC( CreateWindow("edit", 0, WS_POPUP|WS_VISIBLE|WS_MAXIMIZE, 0,0,0,0,0,0,0,0) );

    // init opengl
    SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd);
    wglMakeCurrent(hDC, wglCreateContext(hDC));

    // create shader
    const int p = ((PFNGLCREATEPROGRAMPROC)wglGetProcAddress("glCreateProgram"))();
    const int s = ((PFNGLCREATESHADERPROC)wglGetProcAddress("glCreateShader"))(GL_FRAGMENT_SHADER);	
    ((PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource"))(s, 1, &fragmentShader, 0);
    ((PFNGLCOMPILESHADERPROC)wglGetProcAddress("glCompileShader"))(s);
    ((PFNGLATTACHSHADERPROC)wglGetProcAddress("glAttachShader"))(p,s);
    ((PFNGLLINKPROGRAMPROC)wglGetProcAddress("glLinkProgram"))(p);
    ((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(p);

    // run
    do
    { 
        glColor3us((unsigned short)GetTickCount(),0,0);
        glRects(-1,-1,1,1);
        SwapBuffers(hDC); //wglSwapLayerBuffers( hDC, WGL_SWAP_MAIN_PLANE );
    }while ( !GetAsyncKeyState(VK_ESCAPE) );

    ExitProcess( 0 );
}
Esempio n. 2
0
void OGL_LoadScreen::Progress(const int progress)
{
	OGL_ClearScreen();
	OGL_Blitter::BoundScreen(true);
	
	blitter.Draw(m_dst);

	if (useProgress) 
	{
		glMatrixMode(GL_MODELVIEW);
		glPushMatrix();
		glTranslated(x_offset, y_offset, 0.0);
		glScaled(x_scale, y_scale, 1.0);
		
		// draw the progress bar background
		glColor3us(colors[0].red, colors[0].green, colors[0].blue);
		OGL_RenderRect(x, y, w, h);
		
		int height = h, width = w;
		int left = x, top = y;
		if (height > width) 
		{
			top = top + height - height * progress / 100;
			height = height * progress / 100;
		}
		else 
		{
			width = width * progress / 100;
		}
			
		// draw the progress bar foreground
		glColor3us(colors[1].red, colors[1].green, colors[1].blue);
		OGL_RenderRect(left, top, width, height);
		
		glPopMatrix();
	}
	
	OGL_SwapBuffers();
	
}
Esempio n. 3
0
void entrypoint(void) {
	const auto hDC = GetDC(0);
	SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd);

	_asm {
		push edi;
		call DWORD PTR wglCreateContext;
		push eax;
		push edi;
		call wglMakeCurrent;
	}

	static auto fragmentShader = "float b=gl_Color.r*192,g,r,v,q;vec4 s(vec2 v){g=length(v);q=abs(sin((atan(v.g,v.r)-g+b)*9)*.1)+.1;return min(vec4(1),vec4(.05/abs(q-g/3),.04/abs(q-g/2),.03/abs(q-g*.7),1));}float n(vec3 v){return 1-dot(abs(v),vec3(0,1,0))-length(s(v.rb).rgb)/2*sin(b*2)+(sin(5*(v.b+b))+sin(5*(v.r+b)))*.1;}void main(){vec3 m=vec3(-1+2*(gl_FragCoord.rg/vec2(1366,768)),1),a=vec3(0,0,-2);for(;r<60;r++)g=n(a+m*v),v+=g*.125;gl_FragColor=vec4(v/2)*s((v*m+a).rb)+v*.1*vec4(1,2,3,4)/2*n(v*m+a);}";
	//~ static auto fragmentShader = "void main(){gl_FragColor=vec4(.5);}";

	GLExt(glUseProgram)(GLExt(glCreateShaderProgramv)(0x8B30, 1, &fragmentShader));

	const auto startTime = GetTickCount();

	_asm {
		push ebx;
		push 0;
		call SetCursorPos;
	}

loop:
	auto elapsed = GetTickCount() - startTime;
	if (RUNTIME * 64000 < elapsed) goto panic;
	glColor3us(elapsed / RUNTIME, RUNTIME, RUNTIME);
	_asm {
		push edi;
		push edi;
		push - 1;
		push - 1;
		call glRects;
	}
	SwapBuffers(hDC);
	if(!GetAsyncKeyState(27)) goto loop;
panic:
	_asm {
		push edi;
		call ExitProcess;
	}
}
Esempio n. 4
0
int entrypoint(void)
{
  //if (ChangeDisplaySettings(&screenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) return -1;
  ShowCursor(0);
  HDC hDC = GetDC(CreateWindowExA(WS_EX_APPWINDOW, "static", 0, WINDOWFLAGS, 0, 0, XRES, YRES, 0, 0, 0, 0));
  SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd);
  wglMakeCurrent(hDC, wglCreateContext(hDC));

  const int t = ((PFNGLCREATESHADERPROGRAMEXTPROC)wglGetProcAddress("glCreateShaderProgramEXT"))(GL_FRAGMENT_SHADER, fragmentShader);
  ((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(t);
  do
  {
    static MSG dummyMessage;
    PeekMessageA(&dummyMessage, 0, 0, 0, 1); // Remove all Windows messages to prevent "Program not responding" dialog.
    glColor3us((unsigned short)GetTickCount(), 0, 0);
    glRects(-1, -1, 1, 1);
    SwapBuffers(hDC); //wglSwapLayerBuffers( hDC, WGL_SWAP_MAIN_PLANE );
  } while (!GetAsyncKeyState(VK_ESCAPE));
  ExitProcess(0);
  return 1;
}
Esempio n. 5
0
/////////////////////////////////////////////////////////
// Render
//
void GEMglColor3us :: render(GemState *state) {
	glColor3us (red, green, blue);
}
static Bool
tilePaintOutput (CompScreen              *s,
		 const ScreenPaintAttrib *sa,
		 const CompTransform	 *transform,
		 Region                  region,
		 CompOutput              *output,
		 unsigned int            mask)
{
    Bool status;

    TILE_SCREEN (s);

    if (ts->grabIndex)
	mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;

    UNWRAP (ts, s, paintOutput);
    status = (*s->paintOutput) (s, sa, transform, region, output, mask);
    WRAP (ts, s, paintOutput, tilePaintOutput);

    /* Check if animation is enabled, there is resizing
       on screen and only outline should be drawn */

    if (ts->grabIndex && (output->id == ~0) &&
	(tileGetAnimateType (s->display) == AnimateTypeFilledOutline))
    {
	CompWindow    *w;
	CompTransform sTransform = *transform;
	float         animationDuration = tileGetAnimationDuration (s->display);
	int           x, y, width, height;

	transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
	glPushMatrix ();
	glLoadMatrixf (sTransform.m);

	glLineWidth (4.0f);

	for (w = s->windows; w; w = w->next)
	{
	    TILE_WINDOW (w);

	    if (tw->animationType == Animating)
	    {
		/* Coordinate = start +            speed          * elapsedTime
		   Coordinate = start + (target - start)/interval * elapsedTime
		   Draw outline */

		x      = tw->prevCoords.x - w->input.left +
		         (((float)(w->attrib.x - tw->prevCoords.x)) *
			  ts->msResizing / animationDuration);
		y      = tw->prevCoords.y - w->input.top +
		         (((float)(w->attrib.y - tw->prevCoords.y)) *
			  ts->msResizing / animationDuration);
		width  = tw->prevCoords.width + w->input.left + w->input.right +
		         (((float)(w->attrib.width - tw->prevCoords.width)) *
			  ts->msResizing / animationDuration);
		height = tw->prevCoords.height +
		         w->input.top + w->input.bottom +
			 (((float)(w->attrib.height - tw->prevCoords.height)) *
			  ts->msResizing / animationDuration);

		glColor3us (tw->outlineColor[0] * 0.66,
			    tw->outlineColor[1] * 0.66,
			    tw->outlineColor[2] * 0.66);
		glRecti (x, y + height, x + width, y);

		glColor3usv (tw->outlineColor);

		glBegin (GL_LINE_LOOP);
		glVertex3f (x, y, 0.0f);
		glVertex3f (x + width, y, 0.0f);
		glVertex3f (x + width, y + height, 0.0f);
		glVertex3f (x, y + height, 0.0f);
		glEnd ();

		glColor4usv (defaultColor);
	    }
	}

	glPopMatrix ();
	glColor4usv (defaultColor);
	glLineWidth (1.0f);
    }

    return status;
}
Esempio n. 7
0
inline void glColor( const GLushort & red, const GLushort & green, const GLushort & blue )	{ glColor3us( red, green, blue ); }
Esempio n. 8
0
M(void, glColor3us, jshort red, jshort green, jshort blue) {
	glColor3us(red, green, blue);
}