Vincent Posted April 20, 2011 Share Posted April 20, 2011 Hi, I am trying to draw 3D objects in the viewport and I am currently using GR_RenderHook, but I am interisted in using OpenGL functions to avoid copying data into RE_Render. Is there a way to draw in the Houdini Viewport by using OpenGL functions ? Thanks Vince Quote Link to comment Share on other sites More sharing options...
malexander Posted April 20, 2011 Share Posted April 20, 2011 I believe I already answered this through support channels, but in case it's helpful to anyone else, I'll answer it again You can use direct OpenGL calls in a GR_RenderHook. You do, however, need to: set up any GL state you are using (do not assume it is set a certain way) restore the GL state to its previous state, for all state changes the hook made This can easily be done with older GL state via glPushAttrib() and glPopAttrib(). Newer state, like shaders and GL3 state, often needs to be done by hand. The RE_Geometry, RE_VertexArray, RE_Texture and RE_Shader classes provide good object wrappers around newer OpenGL objects (VAOs, VBOs, textures and program/shader objects) and I encourage you to use these if you're writing new code that you don't need to use in other programs. Not only do they abstract away a lot of OpenGL extensions, such as providing non-pow2 texture or half-float vertex support for older hardware transparently, but they also are relatively clean object-oriented APIs. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.