Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


GothSeiDank

Member Since 22 Oct 2007
Offline Last Active Nov 13 2013 05:04 AM

Topics I've Started

Programming a "TV"

12 November 2013 - 06:38 AM

Sorry, I hope this is the right forum. 

 

Anyway, I would like to do something that looks like an old CRT-TV. 

 

I already got the scan-line and vignette shader (GLSL), now my problem is that I need to slightly "bend" the surface on the edges to the back to create this illusion of an old CRT-TV surface. I am using Game Maker Studio, so I have only 2D capabilities and limited 3d functionality, like drawing models and manipulating matrices. 

 

Can someone help me to get this started? smile.png

 

edit: A picture of what I mean in a game where I saw it. It is very subtle and I hope you can spot it in the screen well enough.

tHcVFUL.png


Error in GLSL: pow(f, e) will not work for negative f

07 August 2013 - 02:26 AM

This is the error I get from YoYo's Game Maker:

############################################################################################ 
FATAL ERROR in Vertex Shader compilation 
ShaderName: sh_rimlighting 

C:\Users\xxxxx\AppData\Local\Temp\gm_ttt_77174\memory(182,8): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them 

at gml_Object_obj3DPlanet_Draw_0 (line 27) - shader_set( sh_rimlighting ); 
############################################################################################

 
This is the Vertex Shader I apply:

attribute vec3 in_Position;                  // (x,y,z) 
attribute vec4 in_Colour;                    // (r,g,b,a) 
attribute vec2 in_TextureCoord;              // (u,v) 
attribute vec3 in_Normal;                    // (x,y,z) 
  
varying vec2 v_vTexcoord; 
varying vec4 v_vColour; 
varying float dp; 
  
uniform float rim_power; //Increase to reduce the effect or decrease to increase the effect 
  
void main() 
{ 
    gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * vec4( in_Position, 1.0); 
    
    v_vColour = in_Colour; 
    v_vTexcoord = in_TextureCoord; 
    
    vec3 wvPosition = normalize((gm_Matrices[MATRIX_WORLD_VIEW] * vec4(in_Position, 1.0)).xyz); 
    vec3 wvNormal = normalize((gm_Matrices[MATRIX_WORLD_VIEW] * vec4(in_Normal, 0.0)).xyz); 
    //float power = 5.0; //Increase to reduce the effect or decrease to increase the effect 
    dp = pow(dot(wvPosition, wvNormal) + 1.0, rim_power); 
}

This is the GML Code I call:
 

var rim_power = shader_get_uniform( sh_rimlighting, "rim_power" ); 
d3d_transform_add_rotation_x( 90 ); 
d3d_transform_add_rotation_y( planet_angle ); 
d3d_transform_add_scaling( planet_scale, planet_scale, planet_scale ); 
d3d_transform_add_translation( x, y + offset_y, 0 ); 
shader_set( sh_rimlighting ); 
shader_set_uniform_f( rim_power, 5.0 ); 
d3d_model_draw( modPlanet, 0, 0, 0, background_get_texture(tex_mars) ); 
shader_reset(); 
d3d_transform_set_identity();

I do not know where this error is coming from. If I uncomment "float power = 5.0" and use it instead of the uniform rim_power, then it works. 

I also get this error when I set rim power to any number that has anything different than .0 as last number. So e.g. 1.0 works, but 2.3 leads to this error. 

Any hint or insight is appreciated.


Space Potatoes - my game on Steam

15 November 2012 - 03:09 AM

I uploaded this game to Steam Workshop, but it is not completly done yet!
It is a light version of what I am planning to release later with more ships, more backgrounds and more bosses!

Steam Workshop:
http://steamcommunity.com/sharedfiles/filedetails/?id=107934091

In a nutshell, you fight evil ships that are coming at you and you level up while doing so! All 4 Levels ( limited atm ) you gain 1 perk point that you can spend.
Perks like:
  • 3 shots fired instead of 1
  • Base auto heal
  • More damage against bosses
  • and more
The twist is, that everytime you fail to hit an enemy, it deducts 1 from your multiplier. Shooting them raises your multiplier, except for bosses! So pure button mashers will have a bad time reaching a good score. If you even let an enemy slip past, he is gonna damage your base. If it explodes, you lose, no matter how much health you have. I designed this as a score attack in a robotron style.
There is also 1 additional ship with a different special weapon to unlock.
I hope you have as much fun playing it, as I had making it!

I really would like to get some feedback from you guys Posted Image.

Screenshots:

Posted Image Posted Image Posted Image


Legal:
Music is licensed under Creative Commons CC-BY-3.0 Deceased Superior Technician
http://www.dreade.org/nosoap/faq.php
The Font is Copyright © 2009, Matt McInerney (http://pixelspread.com|matt@pixelspread.com),
with Reserved Font Name Orbitron.
This Font Software is licensed under the SIL Open Font License, Version 1.1.

Alternatives to Torque2D?

03 April 2012 - 10:45 AM

Are there any?
Torque2D has a good price, a good editor, but also some minor flaws like the handling in the editor, esp. for animations, and no cpu multicore support.
I could not find anything like Torue2D which is not tailored towards iPhone and Android.

What I am looking for is an engine that comes with an intuitive set of tools like an editor, scripting and modern accelerated rendering.
I don't care for any smartphone support.

Need Help implementing Canvas for wxWidgets

19 July 2011 - 02:51 PM

Guys, I need some serious help.
I have a class that creates an OpenGL3 Profile:


NLContextWin32::NLContextWin32(NLWindowHandle parent, NLOpenGLSettings settings)
: NLIPlatformContext(parent, settings)
{
	int pf = 0;
	PIXELFORMATDESCRIPTOR pfd = {0};
	OSVERSIONINFO osvi = {0};
	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

	// Obtain HDC for this window.
	if (!(m_hdc = GetDC((HWND)parent)))
	{
    	NLError("[NLContextWin32] GetDC() failed.");
    	throw NLException("GetDC() failed.", true);
	}

	// Create and set a pixel format for the window.
	pfd.nSize = sizeof(pfd);
	pfd.nVersion = 1;
	pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
	pfd.iPixelType = PFD_TYPE_RGBA;
	pfd.cColorBits = settings.BPP;
	pfd.cDepthBits = settings.BPP;
	pfd.iLayerType = PFD_MAIN_PLANE;

	// Obtain Windows Version
	if (!GetVersionEx(&osvi))
	{    	
    	NLError("[NLContextWin32] GetVersionEx() failed.");
    	throw NLException("[NLContextWin32] GetVersionEx() failed.");
	}

	// Get a pixelformat, based on our settings
	pf = ChoosePixelFormat(m_hdc, &pfd);

	// Set the pixelformat
	if (!SetPixelFormat(m_hdc, pf, &pfd))
	{
    	NLError("[NLContextWin32] GetVersionEx() failed.");
    	throw NLException("[NLContextWin32] SetPixelFormat() failed.");
	}

	// Verify that this OpenGL implementation supports the extensions we need
	std::string extensions = wglGetExtensionsStringARB(m_hdc);
	if (extensions.find("WGL_ARB_create_context") == std::string::npos){
    	NLError("[NLContextWin32] Required extension WGL_ARB_create_context is not supported.");
    	throw NLException("[NLContextWin32] Required extension WGL_ARB_create_context is not supported.");
	}

	// Creates an OpenGL forward compatible rendering context.
	int attribList[] =
	{
    	WGL_CONTEXT_MAJOR_VERSION_ARB, settings.MAJOR,
    	WGL_CONTEXT_MINOR_VERSION_ARB, settings.MINOR,
    	WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
    	0, 0
	};

	// First try creating an OpenGL context.
	if (!(m_hglrc = wglCreateContextAttribsARB(m_hdc, 0, attribList)))
	{
    	// Fall back to an OpenGL 3.0 context.
    	attribList[3] = 0;
    	if (!(m_hglrc = wglCreateContextAttribsARB(m_hdc, 0, attribList))){
        	NLError("[NLContextWin32] wglCreateContextAttribsARB() failed for OpenGL 3 context.");
        	throw NLException("[NLContextWin32] wglCreateContextAttribsARB() failed for OpenGL 3 context.", true);
    	}
	}

	if (!wglMakeCurrent(m_hdc, m_hglrc)){
    	NLError("[NLContextWin32] wglMakeCurrent() failed for OpenGL 3 context.");
    	throw NLException("[NLContextWin32] wglMakeCurrent() failed for OpenGL 3 context.");
	}

	// Load wglSwapIntervalExt
	typedef BOOL (APIENTRY * PFNWGLSWAPINTERVALEXTPROC)(int);
	static PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = 0; 
	wglSwapIntervalEXT = reinterpret_cast<PFNWGLSWAPINTERVALEXTPROC>(wglGetProcAddress("wglSwapIntervalEXT"));

	if ( wglSwapIntervalEXT )
	{
		if ( settings.VSYNC == true )
		{
    		wglSwapIntervalEXT(1);
		}
		else if ( settings.VSYNC == false )
		{
    		wglSwapIntervalEXT(0);
		}
	}
	else if (wglSwapIntervalEXT == NULL )
	{
    	NLWarning("[NLContextWin32] Cannot load wglSwapIntervalEXT");
	}
}

When I try to create my Canvas on a wxWindow, then the code fails with "GetDC() failed" because the Widgets do not have CS_OWNDC. And I did not find any way to create one.
I asked in the wxWidgets forums for help, but no replies.
So I try here.
I would also gladly take any other gui-toolkit that supports OpenGL3 properly.
The reason I cannot use wxGLCanvas is that I use gl3w to initialize OpenGL and it requires a strict OpenGL3 context.
I need a GUI-Toolkit for my Tools.

PARTNERS