Jump to content

Graphics objects and WebGL


alex_h
 Share

Recommended Posts

A while ago I made an outrun type racing game with pixi.js v2.2.9, using graphics objects to render the road and ground polygons. This meant I had to use the Canvas renderer because with the webgl renderer I'd have had to re-upload all the graphics objects to the GPU every frame as they constantly changed shape. I'm now thinking of making a similar game so I just wanted to check whether graphics objects are now rendered differently with webgl in the latest version of pixi? In which case I might be able to modify the vertex positions of graphics objects at run time while running the webgl renderer without worrying  about the impact on performance?

Link to comment
Share on other sites

Yes they changed shape, it was an outrun type 'psuedo-3D' game so each road segment was constantly modified for perspective, especially when going around bends. Something like this:

outrun_screenshot.png

If I recall correctly, at the time graphics objects were drawn using the stencil buffer under the webGL renderer, which also meant their edges could not be smoothed. Is this still how it works?

Link to comment
Share on other sites

Their edges can be smoothed, just not as good as in canvas. Yeah, that seems to be a problem.

You better use Mesh instead, and not many meshes, but a big one. You really have to make your own management for indices, UV's and vertices. It will be much faster than canvas graphics if you make it right :)

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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...