Jump to content

  • Log In with Google      Sign In   
  • Create Account

Jacob Jingle

Member Since 10 Aug 2009
Offline Last Active Jul 21 2013 04:29 AM

Topics I've Started

Microsoft's Faster Menus

12 June 2013 - 01:47 AM

How does Microsoft achieve their more responsive window menus?

 

 

Standard win32 app project in Visual Studio for desktop: Debug/Retail, it doesn't matter, If I double click(left mouse) on 'File' in the menu bar only one of the clicks registers. The second click is always lost.

vs.

Any Microsoft product: If you double click(left mouse) on 'File' on the menu bar the menu quickly opens and closes. Registers all my mouse clicks.

 

 


Different program stages

28 February 2013 - 10:18 AM

I'm a newbie to OpenGL, so here it goes: How do I remove one fragment shader stage for another? Would I 
just use glUseProgramStages(...GL_FRAGMENT_SHADER_BIT...) on the new fragment shader and would it 
then remove the other one? Can a pipeline have more than one fragment shader in use? :/

Like this?

Draw call:

glUseProgramStages(vert shader)

glUseProgramStages(first frag shader)

draw stuff;

glUseProgramStages(second frag shader)

draw stuff


Returning tuple-local variable

26 February 2013 - 09:50 AM

I'm kindof confused over the std::tie function. Is my return code safe? Or is this a local variable error?
 

 

std::tuple<std::array<int, 2>, std::array<int, 2>> FunctionThatReturnsTuple()
{
   std::array<int, 2> buff = {1, 2};
   std::array<int, 2> buff2 = {1, 2};

   return std::tie(buff, buff2);  <---- safe?
}

 


Geometry Shader Error

03 February 2013 - 04:50 AM

My shader worked perfectly before recent Nvidia Update. Now I'm getting the error "ARB_separate_shader_objects requires built-in block gl_PerVertex to be redeclared before accesing its member." I'm new to GLSL shaders, and I just don't know what to do...Any help is greatly appreciated.

 

If I add:

out gl_PerVertex
{
  vec4 gl_Position;
};

 

It compiles with no errors but nothing is drawn.

 

//geom
#version 430

#define POSITION	0
#define GEOMUV      1
#define INDEX       2
#define FRAG_COLOR	0

layout(points) in; // x, y, width, height
layout(triangle_strip, max_vertices = 4) out;

uniform mat4 MVP;

in Data
{
    ivec4 pos; // x, y, width, height
    vec2 UV;
    flat int Index;
} vdata[1];

out Data
{
    vec2 UV;
    flat int Index;
} gdata;

void main() 
{
  int x = vdata[0].pos.x;
  int y = vdata[0].pos.y;
  int widthx  = vdata[0].pos.z + vdata[0].pos.x;
  int heighty = vdata[0].pos.w + vdata[0].pos.y;

  // bottom left quad
  gl_Position   = MVP * vec4(x, heighty, 0, 1);
  gdata.UV      = vec2(0.0, 0.0);
  gdata.Index   = vdata[0].Index;
  EmitVertex();

  // bottom right quad
  gl_Position   = MVP * vec4(widthx, heighty, 0, 1);
  gdata.UV      = vec2(1.0, 0.0);
  gdata.Index   = vdata[0].Index;
  EmitVertex();

  // top right quad
  gl_Position   = MVP * vec4(x, y, 0, 1);
  gdata.UV      = vec2(0.0, 1.0);
  gdata.Index   = vdata[0].Index;
  EmitVertex();
    
  // top left quad
  gl_Position   = MVP * vec4(widthx, y, 0, 1);
  gdata.UV      = vec2(1.0, 1.0);
  gdata.Index   = vdata[0].Index;
  EmitVertex();

  EndPrimitive();
}

 


gl_PerVertex OpenGL Error

30 January 2013 - 04:28 AM

I just upgraded my Nvidia drivers and now I'm getting this error: ARB_separate_shader_objects requires built-in block gl_PerVertex to be redeclared before accesing its members

 

How do I fix this? I don't use gl_PerVertex in my code...

// frag
#version 420 core

#define POSITION	0
#define GEOMUV      1
#define INDEX       2
#define FRAG_COLOR	0

uniform sampler2DArray freetype;
layout(location = FRAG_COLOR, index = 0) out vec4 out_Color;

in Data
{
    vec2 UV;
    flat int Index;
} gdata;

void main(void)
{
	out_Color =  texture(freetype, vec3(gdata.UV, gdata.Index)).rgba;
}
//geom
#version 420 core

#define POSITION	0
#define GEOMUV      1
#define INDEX       2
#define FRAG_COLOR	0

layout(points) in; // x, y, width, height
layout(triangle_strip, max_vertices = 4) out;

uniform mat4 MVP;

in Data
{
    ivec4 pos; // x, y, width, height
    vec2 UV;
    flat int Index;
} vdata[1];

out Data
{
    vec2 UV;
    flat int Index;
} gdata;

void main() 
{
  int x = vdata[0].pos.x;
  int y = vdata[0].pos.y;
  int widthx  = vdata[0].pos.z + vdata[0].pos.x;
  int heighty = vdata[0].pos.w + vdata[0].pos.y;

  // bottom left quad
  gl_Position   = MVP * vec4(x, heighty, 0, 1);
  gdata.UV      = vec2(0.0, 0.0);
  gdata.Index   = vdata[0].Index;
  EmitVertex();

  // bottom right quad
  gl_Position   = MVP * vec4(widthx, heighty, 0, 1);
  gdata.UV      = vec2(1.0, 0.0);
  gdata.Index   = vdata[0].Index;
  EmitVertex();

  // top right quad
  gl_Position   = MVP * vec4(x, y, 0, 1);
  gdata.UV      = vec2(0.0, 1.0);
  gdata.Index   = vdata[0].Index;
  EmitVertex();
    
  // top left quad
  gl_Position   = MVP * vec4(widthx, y, 0, 1);
  gdata.UV      = vec2(1.0, 1.0);
  gdata.Index   = vdata[0].Index;
  EmitVertex();

  EndPrimitive();
}

 

// vert file
#version 420 core

#define POSITION	0
#define GEOMUV      1
#define INDEX       2
#define FRAG_COLOR	0

layout(location = POSITION) in ivec4 in_Position;
layout(location = GEOMUV)   in vec2 in_UV;
layout(location = INDEX)    flat in int in_Index;

out Data
{
    ivec4 pos;
    vec2 UV;
    flat int Index;
} vdata;
	
void main(void)
{
   vdata.pos   = in_Position;
   vdata.UV    = in_UV;
   vdata.Index = in_Index;
}

PARTNERS