Jump to content

OpenGL for drawing


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...