Skip to main content
GameDev.net gamedev.net
🔒 Locked

Drawing Part of a Bitmap Image

Started by EricmBrown Mar 3, 2006 at 8:10 PM 2 replies 1.7k views
Original Post
EricmBrown
EricmBrown
Is there a way to draw a part of an image using glDrawPixels()? Or any other method in OpenGL. Google searches havent shown much, I was hoping maybe someone here could help me out :). Thanks in advance.
Skeleton_V@T
Skeleton_V@T
You may try these two methods:
  1. Set the appropriate texture coordinates when drawing.
  2. Render to a new texture using glTexSubImage2D () then draw the object using that new texture, this method is generally not as elegant as the #1, but suitable for adding effects.
--> The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones <--
EricmBrown
EricmBrown
Just to specify, i'm using orthographic mode and am drawing directly to the screen using glDrawPixels(), i'm not putting the bitmap onto a 3d object with texture mapping.
Skeleton_V@T
Skeleton_V@T
Is there any reason you want to manually draw them that way ?.
Also note that glTexSubImage2D () returns a pointer to the internal texture data, you can read individual pixels then draw them to the screen at will.
--> The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones <--

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.