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

Basic Transformation

Started by codder88 Feb 9, 2013 at 7:02 PM 2 replies 1.5k views
Original Post
codder88
codder88

triangle.png

Hello everyone,

I have that triangle and I want to move top vertex, how can I do that?

slicer4ever
slicer4ever

open up your favorite 3D modeling software, select it, and move it over.

seriously though, if you only want to move a single vertex, then you need to change it's position before you submit it to the gpu.

without seeing what your doing with code, and you telling us what u've learned/why your having problems, then we can't help you.

_paf
_paf

IF you're using the old OpenGL, then you're probably using something like this to draw the triangle:

I assume you're using glBegin()/glEnd() pairs, since you don't know how to move a vertex.


glBegin(GL_TRIANGLES);
glVertex3f(-1.0f, -1.0f, 0.0f);
glVertex3f( 1.0f, -1.0f, 0.0f);
glVertex3f( 0.0f,  1.0f, 0.0f); //In this example this is the top vertex
glEnd();

So in this code, the top vertex is the last, so to move it, change the values of the last glVertex3f() call.

blueshogun96
blueshogun96

I'm a bit confused, do you want to make the triangle a bit taller, or do you actually want to use OpenGL's transformation functions to "resize" it?

Shogun.

Topic Locked

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

Sign in to reply to this topic.