C/C++ :: Fix Upside-down Characters In OpenGL?

Jun 20, 2014

I'm printing characters on a texture map using OpenGL and GLUT with C++. The problem is that when they appear on the map the x-coordinates are correct but the y-coordinates are upside down. The coordinates are being read from an input file and are in the form x,y with a semicolon separating each xy pair. I tried putting a negative sign in front of the y-coordinates to see if that would force the characters to go in the right place but that just made minus signs appear on the screen. Is there a function in OpenGL/GLUT that can invert coordinates by a certain value?

View 12 Replies


ADVERTISEMENT

C :: How To Print Characters But No String Just Array Of Characters

Mar 20, 2014

so my question is i want to print characters,no string just an array of characters,i do this but it s not working,maybe i have to put the '' at the end?

Code:

int main() {
int i;
char ch[5];
for(i = 0; i < 5; i++) {
scanf("%c",&ch[i]);

[Code]...

View 6 Replies View Related

C/C++ :: Find The Common Characters Between Two String Characters

Jul 6, 2014

Im supposed to find the common characters between two string characters, assuming that the user wont input duplicate letters like ddog. When I run my code I get an output of a question mark upside down. Here is my code with comments on what each part is supposed to do

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char str1[20], str2[20],remp = '';
int size1,i,j,temp;
printf ("Input the first string");

[Code]...

View 6 Replies View Related

C/C++ :: Check For Set Of Characters In Array Of Characters?

Mar 26, 2014

I have an array of characters. I am trying to find "houston". The only way I can think of to do this is to use a for loop and check each individual character. Is there an easier way to do this?

char string[] = "Fishing tourism miami atlanta dallas houston";

View 9 Replies View Related

C++ :: OpenGL And 2D Games

Sep 12, 2013

How I can make 2D games in OpenGL. I have sprites, but when I load them in game, they're all big and stuff, not pixel for pixel how I'd like them. How can I do this?

View 16 Replies View Related

C++ ::  Use DirectX Or OpenGL?

Feb 6, 2014

I am because I don't know what to use OpenGL or DirectX? I heard some people saying I can use both. How is this? What is better for online games? And when I choose I will need some tutorials too ....

View 1 Replies View Related

C++ :: OpenGL - Draw On Top Of Image

Jun 22, 2014

This is my first time using opengl and I am experimenting with adding/drawing polygons/points/etc. on top of a PPM image. The image is already loaded when the application runs. My attempt to draw a square is from lines 30 - 35. The program runs but the square is not present. Just the image.

#include<windows.h>
#include <stdio.h>
#include <stdlib.h>
#include<Gl/gl.h>
#include<GL/glut.h>

int n;
int m;
int *image;

[Code] ....

View 5 Replies View Related

C++ :: How To Draw A 3D Snake In OpenGL

Jan 3, 2014

i want to draw a 3D snake in opengl.. i can't get nothing out of my search to make a start.. how it is made

View 4 Replies View Related

C++ :: Taking A Screenshot In OpenGL

Sep 14, 2013

I've read up on .bmp files on wikipedia and am currently attempting to make a function that can export a .bmp file of the screen of my programs. I've already begun work on it but it isn't working. The code I have so far is:

typedef char Byte;
typedef int Byte4;
typedef short Byte2;
struct BMP_Header {

[Code] ....

My problems are that when less then the required amount of bytes is needed to store a value in the file, the 00 bytes are skipped (Ex. The file will contain 42 instead of 42 00 00 00), and the Pixels are stored as nothing but 0D ( every value intended for storing pixel data is 0D ).

View 4 Replies View Related

C++ :: Textures White In OpenGL

Nov 17, 2013

I don't know why, but textures in OpenGL are white. One day, I must've change something, and now my textures wont load properly. I tried rewriting my code that loads things multiple times, my textures still are white. Here is my code:

(I switched back to the FF pipeline temporarily, in my other projects I use shaders.)

Sprite.hpp

#include <SDL.h>
#include <SDL_opengl.h>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>

#ifndef _SPRITE_H_
#define _SPRITE_H_

[Code] ....

View 2 Replies View Related

C++ :: How To Make Fractals With OpenGL

Jan 20, 2013

Where can I learn how to make fractals with opengl?

View 1 Replies View Related

C++ :: Designing Object In Solidworks -> OpenGL?

Jul 11, 2014

If I wanted to design an object in SolidWorks, and then output that object (I guess as a .stl file), is it possible to open that up and manipulate using openGL? How would I go about doing that?

View 1 Replies View Related

C++ :: How To Convert Pixel To Coordinate In OpenGL

May 23, 2013

How can i convert pixel to [-1..1]coordinate in opengl? Which function? I want to write a program that is work with

glutmousefunc(),

When I click on the screen a ball is appear on it where clicked. but mouse work with pixel and circle work with coordinate between -1 and 1 ....

View 4 Replies View Related

C++ :: Print Score In SDL With OpenGL Using Ostream?

Mar 5, 2013

I am using the following code to print in SDL screen

SDL_GL_RenderText( timer, font, color, &position);
sprintf(timer," Time : %d",time);

to print in SDL screen(used with opengl) , i am doing project on C++, as "sprintf" is C style function , so i can't do like this , i am trying to use" ostringstream" , but i am not sure how to use it.

View 1 Replies View Related

C++ :: Compile OpenGL Program In Ubuntu

Aug 15, 2014

I am trying to compile an OpenGL program in Ubuntu.This program opens a blank window.

Code:

#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <cstdio>
#include <iostream>
int main(int argc,char* argv[])

[code]....

View 6 Replies View Related

C++ :: Create 3D Game Engine With OpenGL?

Jul 19, 2013

What i'm trying to do is create a 3d game engine with opengl and i want to be multi platform. I'm trying to use code-blocks for this reason but i'm having trouble setting up opengl for code-blocks

View 1 Replies View Related

C++ :: GLSL Heightmap Coloring (OpenGL)

Aug 27, 2013

I recently made a heightmap, it uses a triangle strip /row, and I try to figure out how can i color the triangles one by one. So, for example I have a color array of 9:

[0.0f,0.2f,0.6f //a triangles first vertex
0.0f,0.4f,0.3f //second vertex
0.0f,0.7f,0.2f] //third vertex

And I want to use it to color all triangles with it. My heightmap coords are in a vector:

vector<GLfloat> hmapcrds [x1,h1,z1; x2,h2,z2;...]

Like this:

c1 c2 c3 c4 c5 //row 1
c6 c7 c8 c9 c10 //row 2 coordinates

index array:c6->c1->c7->c2 ...cn->c(n-rwosize)->c(n+1)->cn->c(n-rwosize+1)

I draw my elements with a VAO and drawelements/row; (i tried drawrange but didnt work)
...
glGenVertexArrays(1,&VertArrObj);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,indexBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER,sizeof(GLuint)*v_heightIndexes.sie(),&v_heightIndexes[0],GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER,vertexBuffer);

[Code] ....

I think it want to index my color array too, so how can i do that it only reads the 3 colors from my array, the repeat it /vertex/triangle till the end of drawing.

The shaders work fine, i changed the map to a triangle so it applied these colors, but with the map "I see only darkness before me".

with my working shader without color "in" - height coloring: [URL] ....

(I also want to do texturing per triangle.)

View 2 Replies View Related

C++ :: OpenGL Preserve States (SFML)

Feb 12, 2013

So I did read, however it said also that it was memory intensive and I had a question... I also came across this:

Window.pushGLStates();
Window.draw("Sfml Text");
Window.popGLStates();

The problem here is that none of these commands exist!

Window.draw should exist and even though I have all the proper includes I still get it telling me that 'Draw' is not a member of sf::Window

I have encountered that error many times everywhere across my sfml related code, it's not like they removed all those features in the update (Which they did not) but, why then would it not be a member?

View 8 Replies View Related

C++ ::  Drawing Rectangular Prism OpenGL

Oct 10, 2013

I am supposed to create a class of rectangular prism in opengl. I am having touble in writing my "draw()" function.

I have searched the web, and lots of the sites have:

glBegin(GL_Quads);

glVertex3f(x,y,z);
glVertex3f(...);
glVertex3f(...);
glVertex3f(...);

3D coordinates for each face.

For my code, I am getting a value for lengths of x, y and z like "getXlength(x_length)" etc... I would like to know how I can use these values to draw the prism rather than giving values for each coordinates in each face.

View 1 Replies View Related

C++ :: How To Make A Simple 3D Cube With OpenGL

Nov 26, 2013

I am using SFML CodeBlocks and OpenGL i am not very good in OGL ...

i want 2 know how to make a simple 3d Cube with OGL ...

View 1 Replies View Related

C++ :: Segmentation Fault With OpenGL Tessellation

May 4, 2013

I wrote a program in C + + and OpenGL using MinGW, which displays a map in 2D.

The following is a function that does the fault occur, ie when executes the statement gluTessEndPolygon (tobj) gives me segmentation fault:

// render each block as a polygon extruded into Z
void BlockGroup::BuildDisplayList() {
static GLUtesselator *tobj = NULL;
if( ! mod.world->IsGUI() )

[code]....

contours is a list of vectors of the following type:

std::vector<std::vector<GLdouble> > contours;

I report also:

#define VAR(V, init) __typeof(init) V=(init)
#define FOR_EACH(I,C) for(VAR(I, (C).begin()), ite = (C).end(); (I) != ite;
++(I))

I tried to use the debug and have come to the message of Segmentation Fault on education above. Now I do not know what to do.

View 2 Replies View Related

C++ :: Get OpenGL Working In Code Blocks?

Dec 28, 2013

how to get opengl working in code blocks? I have tried putting in the libraries and such in the correct folder. But I get an error saying that glut32.dll could not be found. I am running a 10.5 code blocks

View 1 Replies View Related

C++ :: OPENGL How To Load A Texture With Alpha Channel

Jun 27, 2014

I'm trying to load a Quad with a Monster Image on it that will always face the Camera, a la Doom 2.

Now I don't know how to load an image with an Alpha part on it.

In 2D using SDL I always used tga files.

Here is my LoadTexture functions.

AUX_RGBImageRec *LoadBMP(char *Filename) // Loads A Bitmap Image
{
FILE *File=NULL; // File Handle

[Code].....

View 2 Replies View Related

C/C++ :: Rendering OpenGL Inside Of Win32 Control?

Feb 22, 2015

I am trying to get OpenGL to render inside of a Win32 api static control. I've gone through Nehe's tutorial [URL] on how to render to an entire window. I understand how to do that and I can do it, but I'm not totally sure how to get it to render inside of a static control(or any control). The idea is to have a gui built around an OpenGL view. how I could render inside a static or custom win32 control?

View 4 Replies View Related

C/C++ :: Search Simple Window Library For OpenGL

Sep 7, 2014

I search for a really simple window library with a OpenGL context. I really only want to create window, I don't want a GUI library like wxWidgets. The best would be, if the library is cross platform compatible. In Google I only find very big libraries with widgets and other stuff.

View 4 Replies View Related

C/C++ :: Automatic Cast Object To OpenGL Handle / ID

Oct 24, 2014

I programming currently something with OpenGL. Now I have written some wrapper classes, like Shader, Program .... All works fine, but I don't like to call Shader.GetHandle() every time I want to call a OpenGL function manually where I need the object handle/id. (GetHandle() returns the OpenGL ID of the object)

So now I wonder, is it possible to program it in C++ so, that I can put my objects to gl methods and c++ automatically pass the handle/id member to that function ? Is there maybe a operator that I can use for that?

For example:

The way I do it now:

Shader vertexShader();
glCompileShader(vertexShader.GetHandle());

The way I want to:

Shader vertexShader;
glCompileShader(vertexShader);

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved