Hello,
Im trying to plot some points but all i get is a small rectangle at
the top of the window.
The coordinates returned are in the range q=~350 to 0.
The Code:
#include <windows.h>
#include <glut.h>
#include <stdlib.h>
#include <stdio.h>
void display(void)
{
unsigned q;
//char h;
int i;
FILE *fopen(),*f, *g;
glClear (GL_COLOR_BUFFER_BIT);
f=fopen("d3.dat","r+b");
g=fopen("out.dat","w");
if(f!= NULL)
{
glPointSize(20.0);
glBegin(GL_POINTS);
glColor3f (1.0, 1.0, 1.0);
for(i=0;i!=1000;++i){
fread(&q,sizeof(q),1,f);
q=q/10000000;
printf("%u\n,%d\n",q,i);
glVertex2f(q, i);
//glVertex3f (0, .25, 0.0);
//glVertex3f (.75, 1.0, 0.0);
//glVertex3f (1.0, .75, 0.0);
glEnd();
}
}
glFlush ();
}
void init (void)
{
/* select clearing color */
glClearColor (0.7, 0.3, 0.6, 0.2);
/* initialize viewing values */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,1000.0,1000.0,0.0);
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (250, 250);
glutInitWindowPosition (100, 100);
glutCreateWindow ("hello");
init ();
glutDisplayFunc(display);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}
Thanks
Mike
|
|
0
|
|
|
|
Reply
|
mpeloso
|
4/5/2004 5:04:26 PM |
|
Mike p wrote:
> Hello,
> Im trying to plot some points but all i get is a small rectangle at
> the top of the window.
.....
> The coordinates returned are in the range q=~350 to 0.
>
....
> gluOrtho2D(0.0,1000.0,1000.0,0.0);
> }
>
You set up your view system to only show things
in the range 0 to 1000....
--
<\___/> "To err is human, to moo bovine."
/ O O \
\_____/ FTB. For email, remove my socks.
|
|
0
|
|
|
|
Reply
|
fungus
|
4/5/2004 7:44:23 PM
|
|
Hello,
The range of my x coordinates run from 429 to 0 to 429 and my y from 1 to
1000. (a sine wave)shouldnt they display?
Help and Thanks
Mike
"fungus" <openglMY@SOCKSartlum.com> wrote in message
news:rGicc.4389386$uj6.14258283@telenews.teleline.es...
> Mike p wrote:
>
> > Hello,
> > Im trying to plot some points but all i get is a small rectangle at
> > the top of the window.
>
> ....
>
> > The coordinates returned are in the range q=~350 to 0.
> >
>
>
> ...
>
>
> > gluOrtho2D(0.0,1000.0,1000.0,0.0);
> > }
> >
>
> You set up your view system to only show things
> in the range 0 to 1000....
>
>
> --
> <\___/> "To err is human, to moo bovine."
> / O O \
> \_____/ FTB. For email, remove my socks.
>
>
|
|
0
|
|
|
|
Reply
|
mike
|
4/5/2004 11:36:31 PM
|
|
Im also only getting one point to plot
"Mike p" <mpeloso@princeton.edu> wrote in message
news:5f6f0a73.0404050904.5b8d1f92@posting.google.com...
> Hello,
> Im trying to plot some points but all i get is a small rectangle at
> the top of the window.
> The coordinates returned are in the range q=~350 to 0.
> The Code:
> #include <windows.h>
> #include <glut.h>
> #include <stdlib.h>
> #include <stdio.h>
>
> void display(void)
> {
> unsigned q;
> //char h;
> int i;
> FILE *fopen(),*f, *g;
>
> glClear (GL_COLOR_BUFFER_BIT);
>
>
>
> f=fopen("d3.dat","r+b");
> g=fopen("out.dat","w");
> if(f!= NULL)
> {
>
>
> glPointSize(20.0);
> glBegin(GL_POINTS);
> glColor3f (1.0, 1.0, 1.0);
>
> for(i=0;i!=1000;++i){
> fread(&q,sizeof(q),1,f);
> q=q/10000000;
> printf("%u\n,%d\n",q,i);
>
> glVertex2f(q, i);
> //glVertex3f (0, .25, 0.0);
> //glVertex3f (.75, 1.0, 0.0);
> //glVertex3f (1.0, .75, 0.0);
>
> glEnd();
> }
> }
> glFlush ();
> }
>
> void init (void)
> {
> /* select clearing color */
> glClearColor (0.7, 0.3, 0.6, 0.2);
>
> /* initialize viewing values */
> glMatrixMode(GL_PROJECTION);
> glLoadIdentity();
> gluOrtho2D(0.0,1000.0,1000.0,0.0);
> }
>
> int main(int argc, char** argv)
> {
> glutInit(&argc, argv);
> glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
> glutInitWindowSize (250, 250);
> glutInitWindowPosition (100, 100);
> glutCreateWindow ("hello");
> init ();
> glutDisplayFunc(display);
> glutMainLoop();
> return 0; /* ANSI C requires main to return int. */
> }
>
>
> Thanks
> Mike
|
|
0
|
|
|
|
Reply
|
mike
|
4/6/2004 1:07:39 AM
|
|
On Mon, 05 Apr 2004 10:04:26 -0700, Mike p wrote:
> Hello,
> Im trying to plot some points but all i get is a small rectangle at
> the top of the window.
> The coordinates returned are in the range q=~350 to 0.
> The Code:
> #include <windows.h>
> #include <glut.h>
> #include <stdlib.h>
> #include <stdio.h>
>
> void display(void)
> {
> unsigned q;
> //char h;
> int i;
> FILE *fopen(),*f, *g;
>
> glClear (GL_COLOR_BUFFER_BIT);
>
>
>
> f=fopen("d3.dat","r+b");
> g=fopen("out.dat","w");
> if(f!= NULL)
> {
>
>
> glPointSize(20.0);
> glBegin(GL_POINTS);
> glColor3f (1.0, 1.0, 1.0);
>
> for(i=0;i!=1000;++i){
> fread(&q,sizeof(q),1,f);
> q=q/10000000;
> printf("%u\n,%d\n",q,i);
>
> glVertex2f(q, i);
> //glVertex3f (0, .25, 0.0);
> //glVertex3f (.75, 1.0, 0.0);
> //glVertex3f (1.0, .75, 0.0);
>
> glEnd();
> }
> }
> glFlush ();
> }
>
> void init (void)
> {
> /* select clearing color */
> glClearColor (0.7, 0.3, 0.6, 0.2);
>
> /* initialize viewing values */
> glMatrixMode(GL_PROJECTION);
> glLoadIdentity();
> gluOrtho2D(0.0,1000.0,1000.0,0.0);
> }
Shouldn't you set the matrix to
GL_MODELVIEW now ?
--
Nils Olav Sel�sdal
System Engineer
w w w . u t e l s y s t e m s . c o m
|
|
0
|
|
|
|
Reply
|
iso
|
4/6/2004 7:03:09 AM
|
|
|
4 Replies
125 Views
(page loaded in 2.501 seconds)
Similiar Articles: Plotting feasible region of a linear programme - comp.soft-sys ...I am trying to plot data with pcolor that is linear in the Y ... ... linear equations this is a constant rate ... newbie ... or straight lookup are feasible. ... Or, plot each point ... freqz() and plot() - comp.soft-sys.matlab... and one is normal plot command to show variance in output due to fixed point ... comp.dsp I am trying to plot the ... Please help a newbie: Matlab freqz.m -- Plotting a ... simulink frequency response of zero order hold - comp.soft-sys ...I'm trying to do something which I thought ... results depend very much on number of points ... Please help a newbie: Matlab freqz.m -- Plotting a functions ... 548 Views ... Help importing many csv files - comp.soft-sys.matlabHello, I am trying to automate the importing process ... many csv files - comp.soft-sys.matlab How to plot data ... csv files - comp.soft-sys.matlab | Computer Group Newbie ... crop image by polygon - comp.soft-sys.matlabI'm trying to do it by imcrop: imcrop(X, map, rect), but ... This would be the starting point, extracting a submatrix ... subplot(2, 2, 1); % Plot over original image. hold on ... Finding the normal to a binary contour image - comp.soft-sys ...... triangle in a Surface. - comp ... Matlab Newbie needs to 3D contour plot a ... ... 17 Contour an image #2 0 1 Hi all, I'm trying to ... the normals of binary image contour points ... ... create a sine wave - comp.soft-sys.matlabI am trying to generate a sine wave whose frequency ... down conversion process in Matlab using fixed point ... experiencing a problem with Simulink (I'm a newbie). single/multiple VBOs - comp.graphics.api.openglApplication to zoom and pan through a very large image - comp ... 1 Replies 188 Views (0.085 seconds) Tweet ... VBOs for very large point sets? - comp.graphics.api ... Surface normals? - comp.graphics.api.openglI presume that you're a 3D rendering newbie. With some experience you'll see, that ... normals calculation much less useful than, for example, drawing anti-aliased points? Anyone using AbcPDF? EMF image trouble... - comp.text.pdf ...I'm trying to add an EMF file to my PDF, but these ... plotting pdf with oce tds400 - comp.text.pdf Anyone using ... TGA /BMP to RGBA - Newbie - comp.graphics.api.opengl ... Plot multiple points on Google Map - Google Maps API V2 | Google ...I am a newbie to Geocoding and I'm just trying to find an example of how to plot multiple address locations on ... or a JASON object and plot the points? I just want to ... Matlab: Please help with a 2D contour plot, I'm a newbie ...I have a file with data points taken at x,y coordinates. I am trying to make a contour plot of the data in relationship to the x,y coordinates. I can't seem to figure ... 7/26/2012 11:09:25 AM
|