Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3271600
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:44:38+00:00 2026-05-17T18:44:38+00:00

Suppose I have some geometrical data and I wish to render it in wireframe

  • 0

Suppose I have some geometrical data and I wish to render it in wireframe mode. Obviously, this can be done using the API (for example, by setting some appropriate mode like D3DFILL_WIREFRAME in DirectX).

But I was interested if that is possible to achieve using vertex / geometry / pixel shaders (combined, probably).

Does someone have a sample of that?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:44:38+00:00Added an answer on May 17, 2026 at 6:44 pm

    Perhaps something like http://wn.com/DirectX_C++__Geometry_with_Wireframe_Effect ?

    Try this: http://cgg-journal.com/2008-2/06/index.html — code at the bottom

    // ------------------ Vertex Shader --------------------------------
    #version 120
    #extension GL_EXT_gpu_shader4 : enable
    void main(void)
    {
       gl_Position =  ftransform();
    }
    
    
    // ------------------ Geometry Shader --------------------------------
    #version 120
    #extension GL_EXT_gpu_shader4 : enable
    
    uniform vec2 WIN_SCALE;
    noperspective varying vec3 dist;
    void main(void)
    {
      vec2 p0 = WIN_SCALE * gl_PositionIn[0].xy/gl_PositionIn[0].w;
      vec2 p1 = WIN_SCALE * gl_PositionIn[1].xy/gl_PositionIn[1].w;
      vec2 p2 = WIN_SCALE * gl_PositionIn[2].xy/gl_PositionIn[2].w;
    
      vec2 v0 = p2-p1;
      vec2 v1 = p2-p0;
      vec2 v2 = p1-p0;
      float area = abs(v1.x*v2.y - v1.y * v2.x);
    
      dist = vec3(area/length(v0),0,0);
      gl_Position = gl_PositionIn[0];
      EmitVertex();
    
      dist = vec3(0,area/length(v1),0);
      gl_Position = gl_PositionIn[1];
      EmitVertex();
    
      dist = vec3(0,0,area/length(v2));
      gl_Position = gl_PositionIn[2];
      EmitVertex();
    
      EndPrimitive();
    }
    
    
    // ------------------ Fragment Shader --------------------------------
    #version 120
    #extension GL_EXT_gpu_shader4 : enable
    
    noperspective varying vec3 dist;
    const vec4 WIRE_COL = vec4(1.0,0.0,0.0,1);
    const vec4 FILL_COL = vec4(1,1,1,1);
    
    void main(void)
    {
        float d = min(dist[0],min(dist[1],dist[2]));
        float I = exp2(-2*d*d);
        gl_FragColor = I*WIRE_COL + (1.0 - I)*FILL_COL;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have some XAML like this: <Window.Resources> <v:MyClass x:Key=whatever Text=foo\nbar /> </Window.Resources> Obviously
Suppose I have some code: let listB = [ 1; 2; 3 ] Using
Suppose I have some per-class data: (AandB.h) class A { public: static Persister* getPersister();
Suppose I have some code like this: class Visitor { public: Visitor(callBackFunction) {} void
Suppose I have some code that looks like this: foreach(type x in list y)
Suppose I have some code that would, in theory, compile against any version of
Suppose we have some named enums: enum MyEnum { FOO, BAR = 0x50 };
Suppose I have some application A with a database. Now I want to add
Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX
Suppose you have a method with some pre and post-conditions. Is it ok to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.