Re: [Plib-users] using triangles
Brought to you by:
sjbaker
|
From: Steve B. <sjb...@ai...> - 2002-03-24 23:52:05
|
Sami Partinen wrote: > My problem is that, that I have a "space thing", where is two > ship. They shoot themselfs all the time. So, I need to > draw laser triangles thousand times in few seconds. For > some reason, this didn't work: > > glBegin(GL_TRIANGLES); // GL_TRIANGLES piirtää kolmioita > > glColor3f(1.0, 0.0, 0.0); > glVertex3f(0.0, 0.0, 0.0); > glColor3f(1.0, 1.0, 0.0); > glVertex3f(0.0, 20.0, 0.0); > glColor3f(1.0, 0.0, 1.0); > glVertex3f(20.0, 0.0, 0.0); > glEnd(); There could be many reasons for this. That code may be OK - but perhaps your triangles are being back-face culled? Perhaps you haven't disabled texture mapping and the last polygon that was drawn before this had a transparency texture. Perhaps you have the wrong matrix on the stack so those polygons are being drawn off the edge of the screen or closer than the near-clip plane. Perhaps there is a glMaterial loaded with the alpha set to zero and glColorMaterial is disabled. Perhaps you have a glScissor or a user-defined clip plane in the way? Perhaps these are being drawn behind a previously rendered translucent polygon and are being Z-culled. ...you see there are too many options for us to diagnose your problem without a lot more information. > and propabbly reason is that, that those things don't > go in correct buffer, and glutSwapB.... can't > draw it? Well, that *could* be it - but it's hard to know without seeing the entire program. > Other way is create object everytime when ship shoot > another ship, but it doesnt sound very good idea to > greate "ten thousand" new object in one session? I agree. Transitory special effects like that are often better drawn using raw OpenGL - SSG is better for things that don't change much like spaceships, planets and little green men. > Anyway, ship show and move smoothly, so > that side works well. Just need to draw those > lasers with some way. Can you post more of the program - or (preferably) put it onto a web site somewhere where we could download the sources and look at them? If I had to guess, I'd say that disabling backface culling and texturing would fix your problem...but it's hard to diagnose this without seeing more code. ----------------------------- Steve Baker ------------------------------- Mail : <sjb...@ai...> WorkMail: <sj...@li...> URLs : http://www.sjbaker.org http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net http://freeglut.sf.net http://toobular.sf.net http://lodestone.sf.net |