Skip to main content
gamedev.net
🔒 Locked

Plot 2d data

Started by Zdravko Jul 30, 2007 at 9:38 AM 0 replies 1k views
Original Post
Zdravko
Zdravko
Hi there! I would like to draw several points (packed in an array pair)in a 2d cartesian coordinate system (let's say 1000x1000 units) drawn in a window with fixed size (let's say 640x480) - only in the 1st quadrant. What is the OpenGl initialization and drawing code for this? Thanks in advance!
The future belongs to those who believe in the beauty of their dreams.
falkone
falkone
Use something like this.
glViewport(0,0,640,480);glMatrixMode(GL_PROJECTION);glLoadIdentity();gluOrtho2D(0,1000,0,1000);


If you want it to take only the upper-left quarter of the screen you can use

glViewport(0,0,320,240);


if you want to draw points, just iterate through the array and use GL_POINTS

  glBegin(GL_POINTS);        glVertex3f(point.x, point.y); // x and y : 0-1000  glEnd();
Disclaimer: "I am in no way qualified to present advice n any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)" o

Topic Locked

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

Sign in to reply to this topic.