Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 MadHacker · Oct 04, 2014 at 02:49 AM · scenesceneviewopenglhandle

How do I get a handle for the SceneView so I can draw in it with OpenTK?

Hi, is it possible to get a handle to the SceneView (or similar method) so I can draw in it with OpenTK. Thanks.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Oct 04, 2014 at 03:11 AM

As far as i know that's not possible. Especially since on Windows Unity (the editor as well as the runtime) uses DirectX and not OpenGL. You can of course use the "-force-opengl" commandline switch when starting the editor, but Unity isn't designed to provide an interface for external libraries.

As far as i can tell Unity should be ready to draw in OpenGL immediate mode during the OnGUI repaint event. However i never tried to direcly use native OpenGL from there. It might work.

Comment
Add comment · Show 3 · Share
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
avatar image MadHacker · Oct 04, 2014 at 03:39 AM 0
Share

I tried this

 using UnityEditor;
 using UnityEngine;
 
 [CustomEditor(typeof(Test))]
 public class TestEditor : Editor
 {
     private void OnSceneGUI()
     {
         OpenT$$anonymous$$.Graphics.OpenGL.GL.Begin(OpenT$$anonymous$$.Graphics.OpenGL.Begin$$anonymous$$ode.Triangles);
         OpenT$$anonymous$$.Graphics.OpenGL.GL.Color3(1.0f, 0.0f, 0.0f);
         OpenT$$anonymous$$.Graphics.OpenGL.GL.Vertex3(0.0f, 0.0f, 0.0f);
         OpenT$$anonymous$$.Graphics.OpenGL.GL.Color3(0.0f, 1.0f, 0.0f);
         OpenT$$anonymous$$.Graphics.OpenGL.GL.Vertex3(1.0f, 0.0f, 0.0f);
         OpenT$$anonymous$$.Graphics.OpenGL.GL.Color3(0.0f, 0.0f, 1.0f);
         OpenT$$anonymous$$.Graphics.OpenGL.GL.Vertex3(0.0f, 1.0f, 0.0f);
         OpenT$$anonymous$$.Graphics.OpenGL.GL.End();
     }
 }

and Unity just crashed. I tried it with -force-opengl and also without the GL.Begin and GL.End. HELP!!!

avatar image Bunny83 · Oct 05, 2014 at 12:13 PM 0
Share

As i said it probably won't work. However if it works at all, you must only draw stuff during the repaint event:

 private void OnSceneGUI()
 {
     if(Event.current.type == EventType.Repaint)
     {
         // Your drawing stuff
     }
 }

avatar image MadHacker · Oct 05, 2014 at 12:43 PM 0
Share

That still crashes Unity.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

BackGround of Last Scene Visible in New Loaded Scene. How to Fix? 2 Answers

Scene tab goes weird 2 Answers

Making a Pc game, problem occurs with build. When running the game from desktop, Character flashilight does not work, no errors whatsoever. 0 Answers

RPG - Battle loading, Scene Management. 1 Answer


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