SetUV for OpenGL ?
BlitzMax Forums/BlitzMax Programming/SetUV for OpenGL ?
| ||
I've looked around the forum to find a way of scrolling a basic square (2d) texture. i.e. draw a quad in max2D, scroll the texture in a constant direction. I found SetUV for directX but do we have a counterpart for openGL ? |
| ||
I haven't done any OpenGL in ages, but I think the UV coordinates are supplied with the command glTexCoord2f, something like this : glTexCoord2f(0.0f, 1.0f) It goes right before your call to glVertex3f to draw the vertex. |
| ||
I want to still use drawimage (max2D), so the scrolling textures can be placed in front and behind other drawimage images. If thats possible of course. |
| ||
This should contain all you need... |
| ||
Thats what I was after, many thanks |
| ||
Does anyone have a version of this that will work with non ^2 images ? I have a small banner that I want to scroll , but its 78 pixels high :S |
| ||
Are you just scrolling horizontally with no vertical wrapping? |
| ||
This seems to work fine, its the code posted by Yan but cut down to only have the openGL part. And with the example title image, which is much wider than its heigh, it seems to work just fine on my computer. |
| ||
I just want to scroll the Y. > Zawran - that doesn't wrap the none ^ 2 texture - it leaves a border around the outside of the picture when it wraps |
| ||
Scale the original image (pixmap) up to the nearest ^2 vertically, then scale the image's Y axis down by the relevant amount when you draw it. 78 -> 128 = Y * (78 / 128) = SetScale 1, 0.6094 |
| ||
hmm, there are no border on the outside here, but it might be that I do not know exactly what you are refereing to. Sorry I couldn't help then. |
| ||
How big is the border? 1 pixel wide? |
| ||
Scaling works a treat - Many thanks |