Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by robertofazio · Jul 28, 2016 at 10:06 AM · unity5pluginlinux editor

GL POINT_SIZE doesn't works in BUILD on Linux Unity Editor 5.4.3f1. Works only in Editor

I'm working on a Kinect DepthMap and PointClouds project based on Freenect libs on Ubuntu 16.04 LTS and Linux Unity Editor 5.4.3f1.

Here you can find my work in progress repository about depth: https://bitbucket.org/robertofazio/kinect-on-unity3d-linux-editor-5.3 )

I did a VertexColor Shaders that works fine both in Editor and in Build x86_64

 Shader "Custom/VertexColor" {
  
     Properties{
         minVertSize ("MinVertSize", Float) = 3.0
         maxVertSize ("MaxVertSize", Float) = 5.0
         colorDepth ("ColorDepth", Float) = 300.0
         minColor ("MinColor", Vector) = (0,0,1)
         maxColor ("MaxColor", Vector) = (1,0,0)
     }
     
     SubShader {
     Pass {
         LOD 200
          
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
          
          float minVertSize;
          float maxVertSize;
          float colorDepth;
          float3 minColor;
          float3 maxColor;
  
         struct VertexInput {
             float4 v : POSITION;
             float4 color: COLOR;
         };
          
         struct VertexOutput {
             float4 pos : SV_POSITION;
             float4 col : COLOR;
             float size : PSIZE0;
         };
          
         VertexOutput vert(VertexInput v) {
          
             VertexOutput o;
             o.pos = mul(UNITY_MATRIX_MVP, v.v);
             float pct = v.v[2]/colorDepth;
             o.col[0] = lerp(minColor[0],maxColor[0],pct);
             o.col[1] = lerp(minColor[1],maxColor[1],pct);;
             o.col[2] = lerp(minColor[2],maxColor[2],pct);;
             o.size = lerp(minVertSize,maxVertSize,pct);
                          
             return o;
         }
          
         float4 frag(VertexOutput o) : COLOR {
             return o.col;
         }
  
         ENDCG
         } 
     }
  
 }
 

I put also a EnablePointSizeScript.cs attached to the Camera:

 #if UNITY_STANDALONE_LINUX || UNITY_EDITOR_LINUX || UNITY_STANDALONE || UNITY_STANDALONE_LINUX_API
 #define IMPORT_GLENABLE
 #endif
 
 //"/usr/lib/nvidia-361/libGL.so";
 using UnityEngine;
 using System;
 using System.Collections;
 using System.Runtime.InteropServices;
 
 public class EnablePointSize : MonoBehaviour 
 {
     const UInt32 GL_VERTEX_PROGRAM_POINT_SIZE = 0x8642;
     const UInt32 GL_POINT_SMOOTH = 0x0B10;
     //        "/usr/lib/x86_64-linux-gnu/mesa/libGL.so";  

     const string LibGLPath =
         
         #if UNITY_EDITOR_LINUX
         "/usr/lib/x86_64-linux-gnu/mesa/libGL.so" ;// Untested on Linux, this may not be correct
         #elif UNITY_STANDALONE_LINUX
         "/usr/lib/x86_64-linux-gnu/mesa/libGL.so" ;// Untested on Linux, this may not be correct
         #elif UNITY_STANDALONE_WIN
         "opengl32.dll";
         #elif UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
         "/System/Library/Frameworks/OpenGL.framework/OpenGL";
 
         #else
         null;   // OpenGL ES platforms don't require this feature
         #endif
 
 
     
         #if IMPORT_GLENABLE
         [DllImport(LibGLPath)]
     public static extern void glEnable(UInt32 cap);
 
     private bool mIsOpenGL;
     private bool first;
 
     void Start()
     {
 
         mIsOpenGL = SystemInfo.graphicsDeviceVersion.Contains("OpenGL");
         first = true;
 
         #if UNITY_EDITOR_LINUX
         Debug.LogError("unity editor");
         #elif UNITY_STANDALONE_LINUX
         Debug.LogError ("unity standalone linux");
         #endif
 
     }
 
     void OnPreRender()
     {
         if (first)
         {
             if (mIsOpenGL)
                 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
             first = false;
             Debug.LogError (mIsOpenGL);
             glEnable(GL_POINT_SMOOTH);
         }
 
 
     }
         #endif
 }

Everything works in Editor: I mean I'm able to modify at runtime the GL_VERTEX_PROGRAM_POINT_SIZE and VertexColor

When I build on Ubuntu Linux, GL POINT SIZE doesn't work and VertexColor Shaders works.

I've tried both OpenGL2 and OpenGLCore. I used both Intel and Amd CPU with a GTX 550 GPU. In the next days I'm going to test on a GTX1070. Finally I also switched to Mesa libGL path "/usr/lib/x86_64-linux-gnu/mesa/libGL.so" and NVIDIA path "/usr/lib/nvidia-361/libGL.so" but I get the same issue, points are always very thin.

Same project works in in OSX Unity Editor and Standalone OSX

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Vive HMD tracking does not work 2 Answers

Error in Google cloud speech plugin 0 Answers

Capture screenshot async for GEAR VR 0 Answers

Testing in Unity5 0 Answers

Prime31 azure plugin can't build 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges