Jump to content
  • Advertisement
  • entries
    383
  • comments
    1075
  • views
    354062

An update on my graphics system

Sign in to follow this  
Trapper Zoid

87 views

Brief addendum to my previous post:

After thinking about the problem, I came to the conclusion that it's better to get the system up and running first before I start mucking around with the internals of the graphics engine; that way I'll have a proper game to test it with. So the thing to do is cobble together a working depth system by switching to using 3D coordinates instead of 2D in my OpenGL sprite drawing code.

Only problem is - it's not working properly. The depth sorting seems to be working, but I can't seem to get OpenGL to draw my sprites with proper transparency; the alpha values just wipe out the values of the sprites behind them. Obviously I haven't set up something properly with the myriad of confusing OpenGL flags and settings.

Another thing is I'm not sure how efficient this sprite system is going to be; from my tests it seems I can only render several thousand text glyphs before the frame rate drops down to potentially sluggish levels. I'm not going to worry about fine tuning at this early stage, but it's something I'm a bit concerned about. Might be due to some weird OpenGL settings as well.


Edit: Ah, I seem to have found a fix: I needed to enable GL_ALPHA_TEST and use something like glAlphaFunc(GL_GREATER, 0.05f) to get it to work.
Sign in to follow this  


3 Comments


Recommended Comments

Heya. You'll still need to draw any objects that are partially transparent in order of depth. From furthest from the camera to closest. Otherwise, just draw all opaque objects first, turn depth writes off and draw trasparent as usual.

Share this comment


Link to comment
Quote:
Original post by LachlanL
Heya. You'll still need to draw any objects that are partially transparent in order of depth. From furthest from the camera to closest. Otherwise, just draw all opaque objects first, turn depth writes off and draw trasparent as usual.

Will I? The key elements that will be problem will have transparency, namely the character and object sprites.

Darn it. I might as well then resort to plan B and stick references to the objects in a big ol' linked list for in-order drawing then, and disable the OpenGL depth testing.

Share this comment


Link to comment
Sorry if I was misleading. I'm only talking about when you have partially transparent pixels (like an alpha value of 100 or something). If your pixels are all either completely opaque (alpha 255) or completely transparent (alpha 0), then you won't have to worry about it.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!