I'm playing with opengl and trying to texture a quad although the texture does not appear.
Any ideas?
Also, is there a method for converting 2d vertex coordinates to 2d screen pixel coordinates?
Any ideas?
bglCreateContext (800, 600, 32, 0, BGL_BACKBUFFER | BGL_DEPTHBUFFER) 'bglSetSwapInterval(1) InitGl() pm:TPixmap=LoadPixmap("testimage.bmp") Global tex=bglTexFromPixmap(pm,0) While Not KeyHit(KEY_ESCAPE) mx=MouseX() ; my=-(MouseY()-454) glClear GL_COLOR_BUFFER_BIT '| GL_DEPTH_BUFFER_BIT glLoadIdentity 'glColor3f 1.0,0.5,1.0 glEnable GL_TEXTURE_2D glBindTexture GL_TEXTURE_2D,tex ' quad glBegin GL_QUADS glTexCoord2f 0.0, 0.0 glVertex2f mx , my glTexCoord2f 1.0, 0.0 glVertex2f mx+120 , my glTexCoord2f 1.0, 1.0 glVertex2f mx+120 , my+120 glTexCoord2f 0.0, 1.0 glVertex2f mx , my+120 glEnd FlushMem 'SetColor 50,50,50 'DrawRect mx,MouseY(),120,120 bglSwapBuffers Wend End Function InitGl() 'glShadeModel(GL_SMOOTH) glClearColor(0.4, 0.6, 0.7, 0.5) 'glClearDepth(1.0) 'glEnable(GL_DEPTH_TEST) 'glDepthFunc(GL_LEQUAL) 'glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) glViewport(0,0,800,600) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluortho2d(0.0, 800, 0.0, 600) glMatrixMode(GL_MODELVIEW) glLoadIdentity() End Function
Also, is there a method for converting 2d vertex coordinates to 2d screen pixel coordinates?