Drawing quads on a render target
BlitzMax Forums/OpenGL Module/Drawing quads on a render target
| ||
Hi - I'm a complete beginner with OpenGL playing around with the render to texture code as posted here: http://www.blitzmax.com/Community/posts.php?topic=77025 What I'm trying to do is draw some (a lot really) quads on the texture, within the texture render component of the main loop, i.e. IB.BindBuffer() glBegin(GL_QUADS) ' render a bunch of quads ' pseudocode: for each quad: ' set colour glColor3f(f_r1, f_g1, f_b1) glVertex2f(x1,y1) glColor3f(f_r2, f_g2, f_b2) glVertex2f(x1+w,y1) glColor3f(f_r3, f_g3, f_b3) glVertex2f(x1+w,y1+h) glColor3f(f_r4, f_g4, f_b4) glVertex2f(x1,y1+h) glEnd() IB.UnBindBuffer() Or there-abouts, assuming all the variables x1,y1 etc are setup and valid. IB was previously created with Global Img:TImage = CreateImage(512, 512) MidHandleImage Img Global IB:TImageBuffer = TImageBuffer.SetBuffer(Img) in a direct copy from the sample. When run, the rendered texture - rendered using DrawImageRect (as in the linked example) is blank. If I substitute plain DrawRects() in the texture render section I can see output where it should be - so drawing is occurring, it's just not showing in the glVertex2f version. Am I attempting the impossible? When you're clueless it's hard to know what to search for - so please excuse what is most likely a very basic question. Thanks very much for any help! |
| ||
You aren't setting up the projection matrix correctly. glDrawRect temporarily sets the projection matrix. |
| ||
Hey thanks for the reply! I realised in retrospect it wasn't a well presented question. At least this gives me a clue as to where to start looking. |