sorry, stupid question

Member
Posts: 185
Joined: 2005.02
Post: #1
sorry i'm kinda neew to openGL. i have been tying to figure out what i did wrong for about an hour now. why doesn't this work? :

glEnableClientState(GL_VERTEX_ARRAY);
static GLint kpoints[] = {0.4, 0.4,
0.6, 0.4,
0.7, 0.5,
0.5, 0.7};
glVertexPointer (2, GL_INT, 0, kpoints);
glBegin(GL_POLYGON);
glArrayElement(0);
glArrayElement(1);
glArrayElement(2);
glArrayElement(3);
glEnd();
Quote this message in a reply
Member
Posts: 144
Joined: 2004.07
Post: #2
Not so much a stupid question as a stupid topic name Rasp (it's very non-descriptive of the problem and not helpful for people searching and cruising).

Anyways, one big problem I see there is you're treating floating-point numbers as ints. A GLint is an integer, so 0, 1, 2, 3, etc. A GLfloat on the other hand would be 0.4f, 0.5f, 50.3f, etc. So I'd recommend switching all your GLint's to GLfloat.

The other big problem I see is you're not specifying a pointer to your kpoints, I believe you'd have to do:
glVertexPointer (2, GL_INT, 0, &kpoints);
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
the ampersand is unnecessary, the GLint/GL_INT is a serious problem Rasp
Quote this message in a reply
Member
Posts: 185
Joined: 2005.02
Post: #4
ok, thanks, it works now.
i feel kinda dumb....
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #5
Yes, you will feel dumb when super smart people answer your questions.

Please understand that everybody here asked dumb questions like that too.

A long time ago I asked why
Code:
unsigned char keys[128];
GetKeys(*keys);
didn't work...
(passing a 128 byte variable to a function that sets only 128 bits)

Suck it in a be proud that you even know what you know.

Global warming is caused by hobos and mooses
Quote this message in a reply
Member
Posts: 129
Joined: 2005.02
Post: #6
My favorite thing is when I am scratching my head over a problem, and after 15 minutes I will bring over a coworker to ask him what I have done wrong. However, his help is more of a programmer mojo, because the instant he comes over, I notice a missing semicolon, equals sign, or something of the sort. It happens to everyone though Smile
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  stupid GL_POINTs dave05 8 3,882 May 16, 2006 08:13 AM
Last Post: MacFiend