Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

thw

OpenGL How to blit in OpenGL ???

This topic is 6597 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
hi,
there a whole new tutorial on nehe's page on surface blitting
nehe.gamedev.net</html>
ramses
it's number 30

Edited by - ramses on November 26, 2000 8:01:59 AM

Share this post


Link to post
Share on other sites
thx for the answer,but i more meant blitting like in DirectDraw for 2D graphics.

Share this post


Link to post
Share on other sites
I know what you mean. OpenGL does it a little differantly, easier in my opinion.


glBegin(GL_QUADS);

glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, 10.0f);
glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f); glVertex2f(10.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f); glVertex2f(10.0f, 10.0f);

glEnd();


The texture coordinates represent a textures full width, and full height as 1.0 and 1.0f. A textures top left corner of the image is "0.0 : 0.0", the bottom right hand corner is "1.0 : 1.0".

OpenGLs'' space coordinates differ in a way that the Y is opposite. Y goes up in OpenGL space, where Y goes down in texture space.

If you understand my explanation, you could make a wrapper function that simulates DirectDraw if you''d like. The down side to that is that you''d have to scale down the texture coordinates for OpenGLs texture coordinates.

Good luck.

Share this post


Link to post
Share on other sites
''Proper'' DirectDraw blitting isn''t really supported, the closest thing to it is glDrawPixels. Notorious for being very slow unfortunatly.

Paul.

Share this post


Link to post
Share on other sites
you can also use "glCopyPixels" depending the OpenGL implementation might be faster. make sure to disable vertex and rendering operations such as blending before you do so.

Share this post


Link to post
Share on other sites
glBitmap works with bitmaps ie data can only be true or false/black or white.

whats the difference between BitBlt(..) and glBegin(GL_QUADS)

other options are
glCopyPixels(..) // not to sure about the speed of this
glCopyTexSubImage2D(..) // this is pretty quick
[edit] i should mention glTexSubImage2D(..) as well pretty its quick
http://members.xoom.com/myBollux

Edited by - zedzeek on November 27, 2000 2:44:43 AM

Share this post


Link to post
Share on other sites

  • 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!